wip
This commit is contained in:
@@ -5,7 +5,7 @@ from authlib.oauth2.rfc6749 import (
|
||||
ClientMixin,
|
||||
TokenMixin,
|
||||
)
|
||||
from layercake.dateutils import fromisoformat
|
||||
from layercake.dateutils import fromisoformat, now
|
||||
|
||||
|
||||
class OAuth2AuthorizationCode(AuthorizationCodeMixin):
|
||||
@@ -32,25 +32,26 @@ class OAuth2AuthorizationCode(AuthorizationCodeMixin):
|
||||
self.code_challenge_method = code_challenge_method
|
||||
self.nonce = nonce
|
||||
|
||||
auth_time = fromisoformat(kwargs.get('created_at', '')) or now()
|
||||
created_at = kwargs.get('created_at', '')
|
||||
auth_time = fromisoformat(created_at) or now()
|
||||
self.auth_time = int(auth_time.timestamp())
|
||||
|
||||
def get_redirect_uri(self):
|
||||
def get_redirect_uri(self) -> str:
|
||||
return self.redirect_uri
|
||||
|
||||
def get_scope(self):
|
||||
def get_scope(self) -> str:
|
||||
return self.scope
|
||||
|
||||
def get_nonce(self):
|
||||
def get_nonce(self) -> str | None:
|
||||
return self.nonce
|
||||
|
||||
def get_auth_time(self):
|
||||
def get_auth_time(self) -> int:
|
||||
return self.auth_time
|
||||
|
||||
def get_acr(self):
|
||||
return '0'
|
||||
|
||||
def get_amr(self):
|
||||
def get_amr(self) -> list:
|
||||
return []
|
||||
|
||||
|
||||
@@ -77,7 +78,7 @@ class OAuth2Token(TokenMixin):
|
||||
def get_user(self) -> dict:
|
||||
return self.user
|
||||
|
||||
def check_client(self, client: ClientMixin):
|
||||
def check_client(self, client: ClientMixin) -> bool:
|
||||
return self.client_id == client.get_client_id()
|
||||
|
||||
def get_scope(self) -> str:
|
||||
|
||||
Reference in New Issue
Block a user