Skip to content

Commit fe1c4d5

Browse files
committed
Docstring
1 parent 82ef5b2 commit fe1c4d5

File tree

1 file changed

+21
-0
lines changed
  • runtime/eoapi/stac/eoapi/stac

1 file changed

+21
-0
lines changed

runtime/eoapi/stac/eoapi/stac/auth.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff 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")

0 commit comments

Comments
 (0)