Get the state of an account for a given token type
779293
def get_account(self, address, token_type):
        
        cur = self.db.cursor()
        return namedb_get_account(cur, address, token_type)
424666
def get_auth_token(self):
        """"""
        data = [str(self.id), hash_data(self.password)]
        return _security.remember_token_serializer.dumps(data)
1256907
function processToken(token, done) {
    var user = _.find(users, function (item) {
        return item.username === token[claims.username];
    });
    if (!user) {
        user = {
            id          : token[claims.id] || currId++,
            username    : token[claims.username],
            email       : token[claims.email],
            firstName   : token[claims.firstName],
            lastName    : token[claims.lastName]
        };
        var roles = token[claims.role];
        if (!roles) {
            roles = ["guest"];
        } else if (!(roles instanceof Array)) {
            roles = [roles];
        }
        user.roles = roles;
        users.push(user);
    }
    done(null, user);
}
60597
def get_token(self, client_id, target, api_type, grant_type,
                  id_token=None, refresh_token=None, scope='openid'):

        

        if id_token and refresh_token:
            raise ValueError('Only one of id_token or refresh_token '
                             'can be None')

        data = {
            'client_id': client_id,
            'grant_type': grant_type,
            'target': target,
            'scope': scope,
            'api_type': api_type,
        }

        if id_token:
            data.update({'id_token': id_token})
        elif refresh_token:
            data.update({'refresh_token': refresh_token})
        else:
            raise ValueError('Either id_token or refresh_token must '
                             'have a value')

        return self.post(
            'https://{}/delegation'.format(self.domain),
            headers={'Content-Type': 'application/json'},
            data=data
        )
724307
def get_user_token():
    """"""
    if not hasattr(stack.top, 'current_user'):
        return ''
    current_user = stack.top.current_user
    return current_user.get('token', '')
181358
def get_tok(self, tok):
        '''
        
        '''
        tdata = self.tokens["{0}.get_token".format(self.opts['eauth_tokens'])](self.opts, tok)
        if not tdata:
            return {}

        rm_tok = False
        if 'expire' not in tdata:
            # invalid token, delete it!
            rm_tok = True
        if tdata.get('expire', '0') < time.time():
            rm_tok = True
        if rm_tok:
            self.rm_token(tok)

        return tdata
338938
def token_get(profile=None, **connection_args):
    '''
    
    '''
    kstone = auth(profile, **connection_args)
    token = kstone.service_catalog.get_token()
    return {'id': token['id'],
            'expires': token['expires'],
            'user_id': token['user_id'],
            'tenant_id': token['tenant_id']}
712530
def get_poolmember_state(self, id_pools, checkstatus=0):
        

        uri = "api/v3/pool/real/%s/member/status/?checkstatus=%s" % (';'.join(id_pools), checkstatus)

        return self.get(uri)
539725
def authenticate_account(self, authc_token):
        
        try:
            identifier = authc_token.identifier
        except AttributeError:
            msg = 'Failed to obtain authc_token.identifiers'
            raise AttributeError(msg)

        tc = authc_token.__class__
        try:
            verifier = self.token_resolver[tc]
        except KeyError:
            raise TypeError('realm does not support token type: ', tc.__name__)

        account = self.get_authentication_info(identifier)

        try:
            if account.get('account_locked'):
                msg = "Account Locked:  {0} locked at: {1}".\
                    format(account['account_id'], account['account_locked'])
                raise LockedAccountException(msg)
        except (AttributeError, TypeError):
            if not account:
                msg = "Could not obtain account credentials for: " + str(identifier)
                raise AccountException(msg)

        self.assert_credentials_match(verifier, authc_token, account)

        return account
10455
def look(self):
        """"""
        old_token = next(self)
        result = self.current
        self.push(result)
        self.current = old_token
        return result
1175741
def get_channelstate_open(
        chain_state: ChainState,
        payment_network_id: PaymentNetworkID,
        token_address: TokenAddress,
) -> List[NettingChannelState]:
    """"""
    return get_channelstate_filter(
        chain_state,
        payment_network_id,
        token_address,
        lambda channel_state: channel.get_status(channel_state) == CHANNEL_STATE_OPENED,
    )
532082
def _oauth_tokengetter(token=None):
    
    token = session.get("oauth")
    log.debug("Token Get: {0}".format(token))
    return token
433929
def token_getter(provider, token=None):
        
        session_key = provider + '_token'
        if token is None:
            token = session.get(session_key)
        return token
526990
def process_token(type, token)
      # Remove the "Bot " prefix if it exists
      token = token[4..-1] if token.start_with? 'Bot '

      token = 'Bot ' + token unless type == :user
      token
    end
341924
def snapshot(self) -> Tuple[Hash32, UUID]:
        
        return self.state_root, self._account_db.record()
648108
def auth_token(cls, token):
        

        store = goldman.sess.store
        login = store.find(cls.RTYPE, 'token', token)

        if not login:
            msg = 'No login found with that token. It may have been revoked.'
            raise AuthRejected(**{'detail': msg})
        elif login.locked:
            msg = 'The login account is currently locked out.'
            raise AuthRejected(**{'detail': msg})
        else:
            login.post_authenticate()
5457
def get_instance(self, payload):
        
        return TokenInstance(self._version, payload, account_sid=self._solution['account_sid'], )