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 ability to get params from request and pass thru to keycloak url #24

Merged
merged 1 commit into from
Mar 1, 2023

Conversation

ccrockett
Copy link
Owner

@ccrockett ccrockett commented Mar 22, 2022

added the ability to put authorize_options keys in the setup, then pass those request params thru to keycloak

config/initializers/omniauth.rb:

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :keycloak_openid, 'myclient', '',
    client_options: {scope: [:user], site: 'http://localhost:8080', realm: 'myrealm', base_url: ''},
    authorize_options: [:ui_locale],
    name: 'keycloak'
end

app/views/logins/index.html.erb:

<%= form_tag('/auth/keycloak', method: 'post', data: {turbo: false}) do %>
  <%= hidden_field_tag :ui_locale, 'en' %>
  <button type='submit'>Login with Keycloak</button>
<% end %>

@nlsrchtr
Copy link

@ccrockett Would be great to see this merged or is there anything holding this back? When I reference this, I get a version downgrade to omniauth 2.0.4, from 2.1.1.

Thanks for your effort!

@nlsrchtr
Copy link

BTW: AFAIK the param for the locale is named ui_locales. At least this works with a direct-link to the registrations endpoint.

@ccrockett ccrockett force-pushed the add-pass-thru-for-auth-params branch from b380bc9 to 367bf69 Compare March 1, 2023 23:39
@ccrockett ccrockett merged commit 6844866 into master Mar 1, 2023
@ccrockett
Copy link
Owner Author

I created this solution and then never got back around to testing it to merge it in. Thanks for testing and commented. I've merged this into release version 1.5.1 of the gem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants