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

def ubuntu_sso::auth::AuthorisationClient::store_token (   self,
  access_token 
)

Store the given access token in the keyring.

The keyring item is identified by the OAuth realm and consumer
key to support multiple instances.

Definition at line 193 of file auth.py.

00193                                        :
        """Store the given access token in the keyring.

        The keyring item is identified by the OAuth realm and consumer
        key to support multiple instances.
        """
        logger.debug("Trying to store the token in the keyring")
        try:
            item_id = self.keyring.item_create_sync(
                None,
                gnomekeyring.ITEM_GENERIC_SECRET,
                'UbuntuOne token for %s' % self.realm,
                {'ubuntuone-realm': self.realm,
                 'oauth-consumer-key': self.consumer.key},
                access_token.to_string(),
                True)
        except gnomekeyring.DeniedError:
            logger.debug("Permission denied storing token")
        else:
            # set ACLs on the key for all apps listed in xdg BaseDir, but only
            # the root level one, not the user-level one
            logger.debug("Setting ACLs on the token in the keyring")
            set_all_key_acls(item_id=item_id)

            # keyring seems to take a while to actually apply the change
            # for when other people retrieve it, so sleep a bit.
            # this ought to get fixed.
            import time
            time.sleep(4)

    def have_access_token(self):


Generated by  Doxygen 1.6.0   Back to index