Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for connection_scope in params #99

Merged
merged 2 commits into from
Apr 1, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/omniauth/strategies/auth0.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ def client
def authorize_params
params = super
parsed_query = Rack::Utils.parse_query(request.query_string)
%w[connection prompt].each do |key|
%w[connection connection_scope prompt].each do |key|
params[key] = parsed_query[key] if parsed_query.key?(key)
end

# Generate nonce
params[:nonce] = SecureRandom.hex
# Generate leeway if none exists
params[:leeway] = 60 unless params[:leeway]

# Store authorize params in the session for token verification
session['authorize_params'] = params

Expand Down
9 changes: 9 additions & 0 deletions spec/omniauth/strategies/auth0_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,15 @@
expect(redirect_url).not_to have_query('prompt')
end

it 'redirects to the hosted login page with connection_scope' do
get 'auth/auth0?connection_scope=identity_provider_scope'
expect(last_response.status).to eq(302)
redirect_url = last_response.headers['Location']
expect(redirect_url).to start_with('https://samples.auth0.com/authorize')
expect(redirect_url)
.to have_query('connection_scope', 'identity_provider_scope')
end

it 'redirects to hosted login page with prompt=login' do
get 'auth/auth0?prompt=login'
expect(last_response.status).to eq(302)
Expand Down