in cookbooks/aws-parallelcluster-platform/files/dcv/pcluster_dcv_authenticator.py [0:0]
def _check_auth(cls, session_id, session_token):
"""Check session token expiration to see if it is still valid for the given DCV session id."""
# validate session and session token
DCVAuthenticator._validate_param(session_id, DCVAuthenticator.SESSION_ID_REGEX, "sessionId")
DCVAuthenticator._validate_param(session_token, DCVAuthenticator.TOKEN_REGEX, "sessionToken")
# search for token in the internal authenticator token storage
token_info = cls.session_token_manager.get_token_info(session_token)
if (
token_info
and token_info.dcv_session_id == session_id
and datetime.utcnow() - token_info.creation_time <= cls.session_token_ttl
):
return token_info.user
return None