I’m trying to configure the generic oauth authenticator with a callable() as username_key.
I’ve tried defining the callable function under hub.extraConfig:
hub: extraConfig: dp_username_key.py: | def get_feide_userid(response): return ([s for s in response['dataporten-userid_sec'] if 'feide' in s][0].split(':')[1])
And set the auth.custom.config.username_key to function name:
auth: type: custom custom: className: oauthenticator.generic.GenericOAuthenticator config: login_service: "Dataporten/Feide" ... username_key: get_feide_userid
The authentication works if I use a “static” value in username_key, but when I try with the callable() the hub logs indicate that it tries to match the string “get_feide_userid” to a field in the response rather than calling the function.
Is there some way to tell the config that username_key is a callable function and not a string?