update focus

This commit is contained in:
2025-09-18 00:39:36 -03:00
parent b4c7e191fe
commit 0ebf108a94
4 changed files with 48 additions and 22 deletions

View File

@@ -30,7 +30,10 @@ class OAuth2Client(ClientMixin):
def get_client_id(self):
return self.client_id
def get_allowed_scope(self, scope: Collection[str]) -> str:
def get_allowed_scope(
self,
scope: Collection[str],
) -> str:
if not scope:
return ''
@@ -44,20 +47,36 @@ class OAuth2Client(ClientMixin):
raise ValueError('Missing redirect_uris')
def check_response_type(self, response_type: str) -> bool:
def check_response_type(
self,
response_type: str,
) -> bool:
return response_type in self.response_types
def check_redirect_uri(self, redirect_uri: str) -> bool:
def check_redirect_uri(
self,
redirect_uri: str,
) -> bool:
return redirect_uri in self.redirect_uris
def check_endpoint_auth_method(self, method: str, endpoint: str) -> bool:
def check_endpoint_auth_method(
self,
method: str,
endpoint: str,
) -> bool:
if endpoint == 'token':
return self.token_endpoint_auth_method == method
return True
def check_grant_type(self, grant_type: str) -> bool:
def check_grant_type(
self,
grant_type: str,
) -> bool:
return grant_type in self.grant_types
def check_client_secret(self, client_secret: str) -> bool:
def check_client_secret(
self,
client_secret: str,
) -> bool:
return secrets.compare_digest(self.client_secret, client_secret)