@@ -232,15 +232,15 @@ Here is an example of what you might have in your webserver_config.py:
232
232
233
233
.. code-block :: python
234
234
235
- import os
236
- import jwt
237
- import requests
238
235
import logging
239
236
from base64 import b64decode
237
+
238
+ import jwt
239
+ import requests
240
240
from cryptography.hazmat.primitives import serialization
241
- from flask_appbuilder.security.manager import AUTH_DB , AUTH_OAUTH
242
- from airflow import configuration as conf
243
- from airflow.www.security import AirflowSecurityManager
241
+ from flask_appbuilder.security.manager import AUTH_OAUTH
242
+
243
+ from airflow.providers.fab.auth_manager.security_manager.override import FabAirflowSecurityManagerOverride
244
244
245
245
log = logging.getLogger(__name__ )
246
246
@@ -284,11 +284,11 @@ Here is an example of what you might have in your webserver_config.py:
284
284
public_key = serialization.load_der_public_key(key_der)
285
285
286
286
287
- class CustomSecurityManager (AirflowSecurityManager ):
287
+ class CustomSecurityManager (FabAirflowSecurityManagerOverride ):
288
288
def get_oauth_user_info (self , provider , response ):
289
289
if provider == " keycloak" :
290
290
token = response[" access_token" ]
291
- me = jwt.decode(token, public_key, algorithms = [" HS256" , " RS256" ])
291
+ me = jwt.decode(token, public_key, algorithms = [" HS256" , " RS256" ], audience = " account " )
292
292
293
293
# Extract roles from resource access
294
294
realm_access = me.get(" realm_access" , {})
0 commit comments