本文整理汇总了Python中oauthlib.oauth2.MobileApplicationServer.create_revocation_response方法的典型用法代码示例。如果您正苦于以下问题:Python MobileApplicationServer.create_revocation_response方法的具体用法?Python MobileApplicationServer.create_revocation_response怎么用?Python MobileApplicationServer.create_revocation_response使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oauthlib.oauth2.MobileApplicationServer
的用法示例。
在下文中一共展示了MobileApplicationServer.create_revocation_response方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: OAuthService
# 需要导入模块: from oauthlib.oauth2 import MobileApplicationServer [as 别名]
# 或者: from oauthlib.oauth2.MobileApplicationServer import create_revocation_response [as 别名]
class OAuthService(AuthInterface):
auth_request_cls = OAuthlibRequest
validator = server = None
def __init__(self, user_cls, client_cls, token_cls, **kwargs):
self.validator = ValidatorService(
user=user_cls(),
client=client_cls(),
token=token_cls()
)
self.server = MobileApplicationServer(self.validator)
def authorize_client(self, request, *args, **kwargs):
request = request.to_auth_request()
return self.validator.authenticate_client(
request,
*args,
**kwargs
)
def authorize_token(self, request, *args, **kwargs):
token = request.token
request = request.to_auth_request()
return self.validator.validate_bearer_token(
token,
request.scopes,
request,
*args,
**kwargs
)
def validate_auth_request(self, request, *args, **kwargs):
user = request.user
request = request.to_auth_request()
return self.server.create_authorization_response(
url,
http_methed=request.http_method,
body=request.body,
headers=request.headers,
scopes=request.scope,
credentials={'user', user}
)
def validate_revoke_request(self, request,*args, **kwargs):
request = request.to_auth_req()
return self.server.create_revocation_response(
url,
http_methed=request.http_method,
body=request.body,
)