@@ -434,12 +434,14 @@ def _get_user_from_invenio_user(id):
434434 raise ValueError ("User access token revoked." )
435435 return user
436436
437+
437438def _get_user_by_idpid (idp_id ):
438439 user = Session .query (User ).filter_by (idp_id = idp_id ).one_or_none ()
439440 if not user :
440441 raise ValueError ("No users registered with this id" )
441442 return user
442443
444+
443445def _get_reana_yaml_from_gitlab (webhook_data , user_id ):
444446 reana_yaml = "reana.yaml"
445447 if webhook_data ["object_kind" ] == "push" :
@@ -676,7 +678,7 @@ def fetch_and_parse_jwk():
676678 Raises:
677679 ValueError: If JWK fetch fails or no matching key found
678680 """
679- if not hasattr (fetch_and_parse_jwk , ' _cache' ):
681+ if not hasattr (fetch_and_parse_jwk , " _cache" ):
680682 fetch_and_parse_jwk ._cache = None
681683
682684 if not fetch_and_parse_jwk ._cache :
@@ -690,7 +692,6 @@ def fetch_and_parse_jwk():
690692 return jwks
691693
692694
693-
694695def _get_user_from_jwt (header : str ) -> User :
695696 """Get user from JWT token.
696697
@@ -704,7 +705,7 @@ def _get_user_from_jwt(header: str) -> User:
704705 ValueError: If token is invalid or user not found
705706 """
706707 try :
707- if not header .startswith (' Bearer ' ):
708+ if not header .startswith (" Bearer " ):
708709 raise ValueError ("Invalid authorization header format" )
709710
710711 token = header .split (" " )[1 ]
@@ -715,7 +716,7 @@ def _get_user_from_jwt(header: str) -> User:
715716 claims = jwt .decode (token , key_set )
716717 claims .validate ()
717718
718- idp_id = claims .get (' sub' )
719+ idp_id = claims .get (" sub" )
719720 if not idp_id :
720721 raise ValueError ("Token missing subject claim" )
721722
0 commit comments