File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -153,6 +153,23 @@ class AuthenticationApi < Grape::API
153153 end
154154 redirect "#{ host } /sign_in?authToken=#{ onetime_token . authentication_token } &username=#{ user . username } "
155155 end
156+
157+ # Saml 2 logout callback
158+ desc 'SAML2.0 logout callback'
159+ params do
160+ requires :SAMLResponse , type : String , desc : 'SAML logout response data.'
161+ end
162+ post '/auth/saml_logout' do
163+ response = OneLogin ::RubySaml ::Logoutresponse . new ( params [ :SAMLResponse ] , allowed_clock_drift : 1 . second ,
164+ settings : AuthenticationHelpers . saml_settings )
165+
166+ # Check if the SAML response is valid - if not log an error
167+ unless response . is_valid?
168+ logger . error "Invalid SAML logout response: #{ response . errors . join ( ', ' ) } "
169+ end
170+
171+ redirect "#{ host } /sign_in"
172+ end
156173 end
157174
158175 #
@@ -343,7 +360,7 @@ class AuthenticationApi < Grape::API
343360 end
344361
345362 # Remove the refresh token cookie - if remember is false
346- add_refresh_cookie_to_response ( false ) unless params [ :remember ]
363+ add_refresh_cookie_to_response ( false ) if params [ :remember ]
347364 present nil
348365 end
349366
You can’t perform that action at this time.
0 commit comments