44
55import base64
66import hashlib
7- import logging
87import re
98from datetime import datetime , timedelta , timezone
109from typing import cast
3837 verify_dirac_refresh_token ,
3938)
4039
41- logger = logging .getLogger (__name__ )
42-
4340
4441async def get_oidc_token (
4542 grant_type : GrantType ,
@@ -432,8 +429,6 @@ async def get_authorization_flow(auth_db: AuthDB, code: str, max_validity: int):
432429 """Get the authorization flow from the DB and check few parameters before returning it."""
433430 res = await auth_db .get_authorization_flow (code , max_validity )
434431
435- print (f"Flow status : { res ['Status' ]} " )
436-
437432 if res ["Status" ] == FlowStatus .READY :
438433 await auth_db .update_authorization_flow_status (code , FlowStatus .DONE )
439434 return res
@@ -442,32 +437,3 @@ async def get_authorization_flow(auth_db: AuthDB, code: str, max_validity: int):
442437 raise AuthorizationError ("Code was already used" )
443438
444439 raise AuthorizationError ("Bad state in authorization flow" )
445-
446-
447- async def cleanup_expired_data (auth_db : AuthDB , settings : AuthSettings ) -> None :
448- """Remove expired data from the auth database."""
449- expired_tokens , revoked_tokens = await auth_db .clean_expired_refresh_token (
450- max_validity = settings .refresh_token_expire_minutes ,
451- max_retention = settings .revoked_refresh_token_retention_days ,
452- )
453- logger .info (
454- "Deleted %d expired and %d revoked refresh tokens" ,
455- expired_tokens ,
456- revoked_tokens ,
457- )
458-
459- auth = await auth_db .clean_expired_authorization_flows (
460- max_retention = settings .completed_flow_retention_minutes ,
461- )
462- logger .info (
463- "Deleted %d expired authorization flows" ,
464- auth ,
465- )
466-
467- device = await auth_db .clean_expired_device_flows (
468- max_retention = settings .completed_flow_retention_minutes ,
469- )
470- logger .info (
471- "Deleted %d expired device flows" ,
472- device ,
473- )
0 commit comments