@@ -25,20 +25,20 @@ class SessionService(BaseModel):
2525
2626 Attributes:
2727 model_config (ConfigDict): Configuration dictionary for the model.
28+ issuer (str): Issuer of the session tokens.
29+ jwks_uri (str): URI of the JSON Web Key Set (JWKS) endpoint.
2830 last_session_token_validation_result (str): Result of the last short session validation.
29- project_id (str): Corbado Project Id.
30- _issuer (str): Issuer of the session tokens.
31- _jwks_uri (str): URI of the JSON Web Key Set (JWKS) endpoint.
3231 _jwk_client (PyJWKClient): JSON Web Key (JWK) client for handling JWKS.
32+ project_id (str): Corbado Project Id.
3333 """
3434
3535 model_config = ConfigDict (arbitrary_types_allowed = True , validate_assignment = True )
3636
3737 # Fields
38+ issuer : Annotated [str , StringConstraints (strip_whitespace = True , min_length = 1 )]
39+ jwks_uri : Annotated [str , StringConstraints (strip_whitespace = True , min_length = 1 )]
3840 last_session_token_validation_result : str = ""
3941 project_id : str
40- _issuer : Annotated [str , StringConstraints (strip_whitespace = True , min_length = 1 )]
41- _jwks_uri : Annotated [str , StringConstraints (strip_whitespace = True , min_length = 1 )]
4242 _jwk_client : PyJWKClient
4343
4444 # Constructor
@@ -49,14 +49,16 @@ def __init__(self, **kwargs) -> None: # type: ignore
4949 Args:
5050 **kwargs: Additional keyword arguments to initialize the SessionService.
5151 These keyword arguments should include values for the attributes defined in the class,
52- such as 'issuer', '_jwks_uri' and 'last_session_token_validation_result',
52+ such as 'issuer', 'jwks_uri', 'last_session_token_validation_result',
53+ 'cache_keys',cache_jwk_set and 'session_token_cookie_length'.
5354
5455 Raises:
5556 Any errors raised during the initialization process.
57+
5658 """
5759 super ().__init__ (** kwargs )
5860 self ._jwk_client = PyJWKClient (
59- uri = self ._jwks_uri ,
61+ uri = self .jwks_uri ,
6062 lifespan = DEFAULT_SESSION_TOKEN_LENGTH ,
6163 )
6264
@@ -140,7 +142,7 @@ def _set_issuer_mismatch_error(self, token_issuer: str) -> None:
140142 Args:
141143 token_issuer (str): Token issuer.
142144 """
143- self .last_session_token_validation_result = f"Mismatch in issuer (configured: { self ._issuer } , JWT: { token_issuer } )"
145+ self .last_session_token_validation_result = f"Mismatch in issuer (configured: { self .issuer } , JWT: { token_issuer } )"
144146
145147 def _set_validation_error (self , error : Exception ) -> None :
146148 """Set validation error.
@@ -164,8 +166,7 @@ def _validate_issuer(self, token_issuer: str, session_token: str) -> None:
164166 """
165167 if not token_issuer :
166168 raise TokenValidationException (
167- error_type = ValidationErrorType .CODE_JWT_ISSUER_EMPTY ,
168- message = f"Issuer is empty. Session token: { session_token } "
169+ error_type = ValidationErrorType .CODE_JWT_ISSUER_EMPTY , message = f"Issuer is empty. Session token: { session_token } "
169170 )
170171
171172 # Check for old Frontend API (without .cloud.)
@@ -179,8 +180,8 @@ def _validate_issuer(self, token_issuer: str, session_token: str) -> None:
179180 return
180181
181182 # Check against the configured issuer (e.g., a custom domain or CNAME)
182- if token_issuer != self ._issuer :
183+ if token_issuer != self .issuer :
183184 raise TokenValidationException (
184185 error_type = ValidationErrorType .CODE_JWT_ISSUER_MISSMATCH ,
185- message = f"Issuer mismatch (configured via FrontendAPI: '{ self ._issuer } ', JWT issuer: '{ token_issuer } ')" ,
186+ message = f"Issuer mismatch (configured via FrontendAPI: '{ self .issuer } ', JWT issuer: '{ token_issuer } ')" ,
186187 )
0 commit comments