Skip to content

Instantly share code, notes, and snippets.

@rsl
Created July 14, 2016 16:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rsl/672c8b599aff0dbadb9a9375fbe347b4 to your computer and use it in GitHub Desktop.
Save rsl/672c8b599aff0dbadb9a9375fbe347b4 to your computer and use it in GitHub Desktop.
Routing fix for devise_saml_authenticatable
# Snip snip snip
devise_for :users, skip: [:registrations, :saml_authenticatable], controllers: {sessions: 'devise_sessions'}
# Manually add user editing but disallow registrations [above]
as :user do
get 'users/edit' => 'devise_registrations#edit', as: 'edit_registration'
patch 'users' => 'devise_registrations#update', as: 'registration'
# To avoid conflict saml_authenticatable routes are manually defined here.
# Also we override the controller.
resource :session, as: 'saml_session', only: [], controller: 'devise_saml_sessions', path: '/companies/:id/saml' do
get :new, path: 'sign_in', as: 'new'
post :create, path: 'auth'
match :destroy, path: 'sign_out', as: 'destroy', via: :get
get :metadata, path: 'metadata'
match :idp_sign_out, path: 'idp_sign_out', via: [:get, :post]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment