def __init__(self, **kwargs): self.id = kwargs.get('id') self.token_type = kwargs.get('token_type') self.access_token = kwargs.get('access_token') self.refresh_token = kwargs.get('refresh_token') self.client_id = kwargs.get('client_id') self.expires = kwargs.get('expires') self.user = User.get_by_id(kwargs.get('user_id')) if kwargs.get('user') is None else kwargs.get('user') self.scope = self.get_scope_string(**kwargs)
def __init__(self, **kwargs): self.id = kwargs.get('id') self.token_type = kwargs.get('token_type') self.access_token = kwargs.get('access_token') self.refresh_token = kwargs.get('refresh_token') self.client_id = kwargs.get('client_id') self.expires = kwargs.get('expires') self.user = User.get_by_id(kwargs.get( 'user_id')) if kwargs.get('user') is None else kwargs.get('user') self.scope = self.get_scope_string(**kwargs)
def jwt_identity(payload): return User.get_by_id(payload['identity'])
def get_current_user(): if 'user_id' not in session: return None return User.get_by_id(session['user_id'])