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):
23
23
def user_validator (
24
24
self ,
25
25
):
26
+ """
27
+ FastAPI Security Dependency to validate auth token.
28
+ """
29
+
26
30
def valid_user_token (
27
31
token_str : Annotated [str , Security (self .scheme )],
28
32
required_scopes : security .SecurityScopes ,
@@ -59,14 +63,27 @@ def valid_user_token(
59
63
60
64
@property
61
65
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
+ """
62
71
return self ._build_url (self .internal_host or self .host )
63
72
64
73
@property
65
74
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
+ """
66
80
return self ._build_url (self .host )
67
81
68
82
@property
69
83
def scheme (self ):
84
+ """
85
+ FastAPI Security Scheme.
86
+ """
70
87
return security .OAuth2AuthorizationCodeBearer (
71
88
authorizationUrl = f"{ self .keycloak_api } /auth" ,
72
89
tokenUrl = f"{ self .keycloak_api } /token" ,
@@ -75,4 +92,8 @@ def scheme(self):
75
92
76
93
@cached_property
77
94
def jwks_client (self ):
95
+ """
96
+ PyJWKClient instance for fetching JWKS keys from Keycloak. Used when validating
97
+ JWTs.
98
+ """
78
99
return jwt .PyJWKClient (f"{ self .internal_keycloak_api } /certs" )
You can’t perform that action at this time.
0 commit comments