Created
June 9, 2020 17:34
-
-
Save fedeagripa/00b1f67f762008677a71ea4913568c23 to your computer and use it in GitHub Desktop.
2fa_initializer_routes_patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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