lib/omniauth/strategies/azure_oauth2.rb in omniauth-azure-oauth2-0.0.9 vs lib/omniauth/strategies/azure_oauth2.rb in omniauth-azure-oauth2-0.0.10

- old
+ new

@@ -25,19 +25,18 @@ options.client_id = provider.client_id options.client_secret = provider.client_secret options.tenant_id = provider.respond_to?(:tenant_id) ? provider.tenant_id : 'common' - options.base_azure_url = + options.base_azure_url = provider.respond_to?(:base_azure_url) ? provider.base_azure_url : BASE_AZURE_URL + options.authorize_params = provider.authorize_params if provider.respond_to?(:authorize_params) options.authorize_params.domain_hint = provider.domain_hint if provider.respond_to?(:domain_hint) && provider.domain_hint options.authorize_params.prompt = request.params['prompt'] if request.params['prompt'] options.client_options.authorize_url = "#{options.base_azure_url}/#{options.tenant_id}/oauth2/authorize" options.client_options.token_url = "#{options.base_azure_url}/#{options.tenant_id}/oauth2/token" - - options.token_params.resource = options.resource super end uid { raw_info['sub'] @@ -51,9 +50,14 @@ last_name: raw_info['family_name'], email: raw_info['email'] || raw_info['upn'], oid: raw_info['oid'], tid: raw_info['tid'] } + end + + def token_params + azure_resource = request.env['omniauth.params'] && request.env['omniauth.params']['azure_resource'] + super.merge(resource: azure_resource || options.resource) end def callback_url full_host + script_name + callback_path end