architmmmec opened a new issue, #23764:
URL: https://github.com/apache/superset/issues/23764

   A clear and concise description of what the bug is.
   AuthN integration is not working
   
   #### How to reproduce the bug
   
   class CustomSsoSecurityManager(SupersetSecurityManager):
   
       def oauth_user_info(self, provider, response=None):
           logging.debug("Oauth2 provider: {0}.".format(provider))
           if provider == 'authn':
               headers = {
                   'Authorization': 'Bearer ' + response.get('access_token')
               }
               me = 
self.appbuilder.sm.oauth_remotes[provider].get('userDetails').data
               logging.debug("user_data: {0}".format(me))
               logging.debug("Headers" + headers)
               authn_user_info_response = self.appbuilder.sm \
                   .oauth_remotes[provider] \
                   .get('/oauth/r/api/v1/user/details', headers=headers)
               logging.debug("AuthN user info" + authn_user_info_response)
               user_info = authn_user_info_response.data
               return {
                   'name': user_info['sub'],
                   'email': user_info['email'],
                   'id': user_info['sub'],
                   'username': user_info['sub'],
                   'first_name': user_info['sub'].split(".")[0],
                   'last_name': user_info['sub'].split(".")[-1]
               }
   
   AUTHN_URL = os.environ["AUTHN_URL"]
   OAUTH_PROVIDERS = [
       {
           'name': 'authn',
           'whitelist': '*****',
           'token_key': 'access_token',
           'icon': 'fa-address-card',
           'remote_app': {
               # 'consumer_key': CONFIG_DATA['CLIENT_ID'],
               # 'consumer_secret': CONFIG_DATA['CLIENT_SECRET'],
   
               'client_id':'*******',
               'client_secret': '*****',
   
               'request_token_params': {
                   'scope': 'user.profile'
               },
               'access_token_params':{        # Additional parameters for calls 
to access_token_url
                   'client_id': '******'
               },
               'request_token_url': None,
               'access_token_method': 'POST',
               'api_base_url': AUTHN_URL,
               'access_token_url': AUTHN_URL + '/oauth/token',
               'authorize_url': AUTHN_URL + '/oauth/authorize'
           }
       }
   ]
   
   ### Expected results
   Should be able to lntegrate with AuthN and login 
   
   what you expected to happen.
   
   ### Actual results
   Login denied
   
   what actually happens.
   
   #### Screenshots
   
   If applicable, add screenshots to help explain your problem.
   
   
   ### Environment
   
   (please complete the following information):
   
   - browser type and version:
   - superset version: 2.1.0
   - python version: 3.9
   - node.js version: `node -v`
   - any feature flags active: Yes
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to