victortony commented on issue #7739: Custom OAuth issue
URL: 
https://github.com/apache/incubator-superset/issues/7739#issuecomment-503945364
 
 
   my config is :
   ` {'name': 'egaSSO',
        'token_key': 'access_token',  # Name of the token in the response of 
access_token_url
        'icon': 'fa-address-card',  # Icon for the provider
        'remote_app': {
            'consumer_key': 'xxxx',  # Client Id (Identify Superset application)
            'consumer_secret': 'xxxx',  # Secret for this Client Id (Identify 
Superset application)
            'request_token_params': {
                'scope': 'read'  # Scope for the Authorization
            },
            'access_token_method': 'POST',  # HTTP Method to call 
access_token_url
            'access_token_params': {  # Additional parameters for calls to 
access_token_url
                'client_id': 'xxxx'
            },
            'access_token_headers': {  # Additional headers for calls to 
access_token_url
                'Authorization': 'Basic Base64EncodedClientIdAndSecret'
            },
            'base_url': 'xxx',            
            'access_token_url': 'xxx',
            'authorize_url': 'xxxx'
        }
      }`
   
   and 
   `from superset.security import SupersetSecurityManager
   import logging
   class CustomSsoSecurityManager(SupersetSecurityManager):
       logger = logging.getLogger("CustomSsoSecurityManager")
       def oauth_user_info(self, provider, response=None):
           if provider == 'egaSSO':
               # As example, this line request a GET to base_url + '/' + 
userDetails with Bearer  Authentication,
       # and expects that authorization server checks the token, and response 
with user details
               me = 
self.appbuilder.sm.oauth_remotes[provider].get('/oauth2.0/profile').data
               arrs = me['attributes']
               email = ""
               for obj in arrs:
                   if 'email' in obj:
                       email = obj['email']
   
               logging.debug("user_data: {0}".format(me))
               retObj = { 'name' : me['id'], 'email' : email, 'username' : 
me['id'], 'first_name':me['id'], 'last_name':me['id']}
               logging.debug("obj1:{0}".format(retObj))
               return retObj`

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to