File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
runtime/eoapi/stac/eoapi/stac Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,10 @@ def _build_url(self, host: str):
2323 def user_validator (
2424 self ,
2525 ):
26+ """
27+ FastAPI Security Dependency to validate auth token.
28+ """
29+
2630 def valid_user_token (
2731 token_str : Annotated [str , Security (self .scheme )],
2832 required_scopes : security .SecurityScopes ,
@@ -59,14 +63,27 @@ def valid_user_token(
5963
6064 @property
6165 def internal_keycloak_api (self ):
66+ """
67+ URL for requests to Keycloak to Keycloak made from within this service.
68+
69+ e.g. When fetching JWKS keys.
70+ """
6271 return self ._build_url (self .internal_host or self .host )
6372
6473 @property
6574 def keycloak_api (self ):
75+ """
76+ URL for requests to Keycloak made from outside this service.
77+
78+ e.g. When performing OAuth2 Authorization Code flow from docs UI.
79+ """
6680 return self ._build_url (self .host )
6781
6882 @property
6983 def scheme (self ):
84+ """
85+ FastAPI Security Scheme.
86+ """
7087 return security .OAuth2AuthorizationCodeBearer (
7188 authorizationUrl = f"{ self .keycloak_api } /auth" ,
7289 tokenUrl = f"{ self .keycloak_api } /token" ,
@@ -75,4 +92,8 @@ def scheme(self):
7592
7693 @cached_property
7794 def jwks_client (self ):
95+ """
96+ PyJWKClient instance for fetching JWKS keys from Keycloak. Used when validating
97+ JWTs.
98+ """
7899 return jwt .PyJWKClient (f"{ self .internal_keycloak_api } /certs" )
You can’t perform that action at this time.
0 commit comments