Skip to content

Commit

Permalink
Merge pull request #124 from iainbeeston/session-index
Browse files Browse the repository at this point in the history
feat: include SessionIndex in logout requests
  • Loading branch information
md5 committed Mar 23, 2017
2 parents 0402c4d + fb6ad86 commit 9468019
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/omniauth/strategies/saml.rb
Expand Up @@ -159,7 +159,7 @@ def other_phase
Hash[found_attributes]
end

extra { { :raw_info => @attributes, :response_object => @response_object } }
extra { { :raw_info => @attributes, :session_index => @session_index, :response_object => @response_object } }

def find_attribute_by(keys)
keys.each do |key|
Expand All @@ -182,6 +182,7 @@ def handle_response(raw_response, opts, settings)

response.is_valid?
@name_id = response.name_id
@session_index = response.sessionindex
@attributes = response.attributes
@response_object = response

Expand All @@ -190,6 +191,7 @@ def handle_response(raw_response, opts, settings)
end

session["saml_uid"] = @name_id
session["saml_session_index"] = @session_index
yield
end

Expand Down Expand Up @@ -220,6 +222,7 @@ def handle_logout_response(raw_response, settings)

session.delete("saml_uid")
session.delete("saml_transaction_id")
session.delete("saml_session_index")

redirect(slo_relay_state)
end
Expand Down Expand Up @@ -254,6 +257,10 @@ def generate_logout_request(settings)
settings.name_identifier_value = session["saml_uid"]
end

if settings.sessionindex.nil?
settings.sessionindex = session["saml_session_index"]
end

logout_request.create(settings, RelayState: slo_relay_state)
end
end
Expand Down

0 comments on commit 9468019

Please sign in to comment.