Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
2fa_initializer_routes_patch
# config/initializers/devise.rb
ActionDispatch::Routing::Mapper.class_eval do
protected
def devise_saml_authenticatable(mapping, controllers)
if ::Devise.saml_route_helper_prefix
prefix = ::Devise.saml_route_helper_prefix
resource :session, only: [], controller: controllers[:saml_sessions], path: '' do
get :new, path: 'saml/sign_in', as: "new_#{prefix}"
post :create, path: 'saml/auth', as: prefix
get :metadata, path: 'saml/metadata'
match :idp_sign_out, path: 'saml/idp_sign_out', as: "idp_destroy_#{prefix}", via: [:get, :post]
end
else
resource :session, only: [], controller: controllers[:saml_sessions], path: '' do
get :new, path: 'saml/sign_in', as: 'new'
post :create, path: 'saml/auth'
get :metadata, path: 'saml/metadata'
match :idp_sign_out, path: 'saml/idp_sign_out', via: [:get, :post]
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.