Update app/api/auth2.py
This commit is contained in:
+7
-1
@@ -8,7 +8,13 @@ TENANT_ID = "your-tenant-id"
|
|||||||
API_CLIENT_ID = "your-backend-api-client-id" # The Application ID of the API itself
|
API_CLIENT_ID = "your-backend-api-client-id" # The Application ID of the API itself
|
||||||
JWKS_URL = f"https://login.microsoftonline.com/{TENANT_ID}/discovery/v2.0/keys"
|
JWKS_URL = f"https://login.microsoftonline.com/{TENANT_ID}/discovery/v2.0/keys"
|
||||||
|
|
||||||
jwks_client = PyJWKClient(JWKS_URL)
|
jwks_client = PyJWKClient(
|
||||||
|
JWKS_URL,
|
||||||
|
cache_keys=True, # Enabled by default. Set to False to disable caching completely.
|
||||||
|
max_cached_keys=16, # The maximum number of distinct keys to store (Default is 16).
|
||||||
|
cache_jwk_set=True, # Caches the entire JWK set response, not just individual keys.
|
||||||
|
lifespan=3600 # How long (in seconds) keys stay in the cache before expiring (Default: 3600s / 1 hour).
|
||||||
|
)
|
||||||
|
|
||||||
# Native security scheme enables the top-right "Authorize" button in Swagger UI
|
# Native security scheme enables the top-right "Authorize" button in Swagger UI
|
||||||
oauth2_scheme = OAuth2AuthorizationCodeBearer(
|
oauth2_scheme = OAuth2AuthorizationCodeBearer(
|
||||||
|
|||||||
Reference in New Issue
Block a user