Logo Search packages:      
Sourcecode: ubuntu-sso-client version File versions  Download package

def ubuntu_sso::auth::AuthorisationClient::acquire_access_token (   self,
  description = None,
  store = False 
)

Create an OAuth access token authorised against the user.

Definition at line 335 of file auth.py.

00335                                                                  :
        """Create an OAuth access token authorised against the user."""
        signature_method = oauth.OAuthSignatureMethod_PLAINTEXT()

        # Create a request token ...
        logger.debug("Creating a request token to begin access request")
        parameters = {}
        if description:
            parameters['description'] = description
        # Add a nonce to the query so we know the callback (to our temp
        # webserver) came from us
        nonce = random.randint(1000000, 10000000)

        # start temporary webserver to receive browser response
        callback_url = self.get_temporary_httpd(nonce,
           self.retrieve_access_token, store)

        oauth_request = oauth.OAuthRequest.from_consumer_and_token(
            callback=callback_url,
            http_url=self.request_token_url,
            oauth_consumer=self.consumer,
            parameters=parameters)
        oauth_request.sign_request(signature_method, self.consumer, None)
        logger.debug("Making token request")
        self.request_token = self.make_token_request(oauth_request)

        # Request authorisation from the user
        oauth_request = oauth.OAuthRequest.from_token_and_callback(
            http_url=self.user_authorisation_url,
            token=self.request_token)
        nodename = os.uname()[1]
        if nodename:
            oauth_request.set_parameter("description", nodename)
        Thread(target=self.open_in_browser, name="authorization",
               args=(oauth_request.to_url(),)).start()

    def get_temporary_httpd(self, nonce, retrieve_function, store):


Generated by  Doxygen 1.6.0   Back to index