diff --git a/providers/fab/docs/auth-manager/webserver-authentication.rst b/providers/fab/docs/auth-manager/webserver-authentication.rst index 8082ef8acbfac..7ecc40ab83c42 100644 --- a/providers/fab/docs/auth-manager/webserver-authentication.rst +++ b/providers/fab/docs/auth-manager/webserver-authentication.rst @@ -232,15 +232,15 @@ Here is an example of what you might have in your webserver_config.py: .. code-block:: python - import os - import jwt - import requests import logging from base64 import b64decode + + import jwt + import requests from cryptography.hazmat.primitives import serialization - from flask_appbuilder.security.manager import AUTH_DB, AUTH_OAUTH - from airflow import configuration as conf - from airflow.www.security import AirflowSecurityManager + from flask_appbuilder.security.manager import AUTH_OAUTH + + from airflow.providers.fab.auth_manager.security_manager.override import FabAirflowSecurityManagerOverride log = logging.getLogger(__name__) @@ -284,11 +284,11 @@ Here is an example of what you might have in your webserver_config.py: public_key = serialization.load_der_public_key(key_der) - class CustomSecurityManager(AirflowSecurityManager): + class CustomSecurityManager(FabAirflowSecurityManagerOverride): def get_oauth_user_info(self, provider, response): if provider == "keycloak": token = response["access_token"] - me = jwt.decode(token, public_key, algorithms=["HS256", "RS256"]) + me = jwt.decode(token, public_key, algorithms=["HS256", "RS256"], audience="account") # Extract roles from resource access realm_access = me.get("realm_access", {})