Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6243879
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T12:13:18+00:00 2026-05-24T12:13:18+00:00

I made a set of XMLRPC client-server programs in python and set up a

  • 0

I made a set of XMLRPC client-server programs in python and set up a little method for authenticating my clients. However, after coding pretty much the whole thing, I realized that once a client was authenticated, the flag I had set for it was global in my class i.e. as long as one client is authenticated, all clients are authenticated. I don’t know why, but I was under the impression that whenever SimpleXMLRPCServer was connected to by a client, it would create a new set of variables in my program.

Basically the way it’s set up now is

class someclass:
    authenticate(self, username, pass):
        #do something here
        if(check_for_authentication(username, pass))
             self.authenticated=True
    other_action(self, vars):
        if authenticated:
            #do whatever
        else:
            return "Not authorized."

server=SimpleXMLRPCServer.SimpleXMLRPCServer("0.0.0.0", 8000)
server.register_instance(someclass())
server.serve_forever()

I need either a way to hack this into what I am looking for (i.e. the authenticated flag needs to be set for each client that connects), or another protocol that can do this more easily. After some searching I have been looking at twisted, but since this is already written, I’d rather modify it than have to rewrite it. I know for now I could just always get the username and password from the client, but in the intrest of resources (having to authenticate on every request) and saving bandwidth (which some of my clients have in very limited quantities), I’d rather not do that.

Also, this is my first time trying to secure something like this(and I am not trained in internet security), so if I am overlooking some glaring error in my logic, please tell me. Basically, I can’t have someone sending me fake variables in “other_actions”

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T12:13:19+00:00Added an answer on May 24, 2026 at 12:13 pm

    Something like this would work:

    class SomeClass(object):
        authenticated = {}
        def authenticate(self, username, password):
            #do something here
            if authenticate(username, password):
                # make unique token can probably be just a hash
                # of the millisecond time and the username
                self.authenticated[make_unique_token(username)] = True
        def other_action(self, vars):
            # This will return True if the user is authenticated
            # and None otherwise, which evaluates to False
            if authenticated.get(vars.get('authentication-token')):
                #do whatever
                pass
            else:
                return "Not authorized."
    
    server=SimpleXMLRPCServer.SimpleXMLRPCServer("0.0.0.0", 8000)
    server.register_instance(someclass())
    server.serve_forever()
    

    You just need to pass them an authentication token once they’ve logged in.

    I assume you know you can’t actually use pass as a variable name. Please remember to accept answers to you questions (I noticed you haven’t for your last several).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I made a little app to generate Java test classes based on certain set
So I have made a webservice that interfaces with a set of data contained
Let me set the stage here. I'm a very junior developer who's recently made
I want to extend an existing application I made to make it set mixer
The problem is this. I have made a set Set<User> users = Collections.synchronizedSet(new HashSet<User>())
The FCC recently made available a small set of API calls to access FCC
I'd like to set up a convenience Moose role made up of other smaller
I'm trying to set my blog up where every time a post is made
I made a function to set or clear a specific number of bits in
I made a uitabBarItem in iphone.How can i set the xib in uitabBarItem.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.