Class: Spid::Rack::Logout::LogoutEnv
- Inherits:
-
Object
- Object
- Spid::Rack::Logout::LogoutEnv
- Defined in:
- lib/spid/rack/logout.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#env ⇒ Object
readonly
Returns the value of attribute env.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
Instance Method Summary collapse
- #idp_name ⇒ Object
-
#initialize(env) ⇒ LogoutEnv
constructor
A new instance of LogoutEnv.
- #relay_state ⇒ Object
- #relay_state_id ⇒ Object
- #response ⇒ Object
- #responser ⇒ Object
- #session ⇒ Object
- #slo_url ⇒ Object
- #spid_session ⇒ Object
- #valid_path? ⇒ Boolean
- #valid_request? ⇒ Boolean
Constructor Details
#initialize(env) ⇒ LogoutEnv
Returns a new instance of LogoutEnv.
23 24 25 26 |
# File 'lib/spid/rack/logout.rb', line 23 def initialize(env) @env = env @request = ::Rack::Request.new(env) end |
Instance Attribute Details
#env ⇒ Object (readonly)
Returns the value of attribute env.
21 22 23 |
# File 'lib/spid/rack/logout.rb', line 21 def env @env end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
21 22 23 |
# File 'lib/spid/rack/logout.rb', line 21 def request @request end |
Instance Method Details
#idp_name ⇒ Object
82 83 84 |
# File 'lib/spid/rack/logout.rb', line 82 def idp_name request.params["idp_name"] end |
#relay_state ⇒ Object
72 73 74 75 |
# File 'lib/spid/rack/logout.rb', line 72 def relay_state request.params["relay_state"] || Spid.configuration.default_relay_state_path end |
#relay_state_id ⇒ Object
77 78 79 80 |
# File 'lib/spid/rack/logout.rb', line 77 def relay_state_id digest = Digest::MD5.hexdigest(relay_state) "_#{digest}" end |
#response ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/spid/rack/logout.rb', line 28 def response session["slo_request_uuid"] = responser.uuid session["relay_state"] = { relay_state_id => relay_state } session["idp"] = idp_name [ 302, { "Location" => slo_url }, [] ] end |
#responser ⇒ Object
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/spid/rack/logout.rb', line 47 def responser @responser ||= begin Spid::Slo::Request.new( idp_name: idp_name, relay_state: relay_state_id, session_index: spid_session["session_index"] ) end end |
#session ⇒ Object
39 40 41 |
# File 'lib/spid/rack/logout.rb', line 39 def session request.session["spid"] end |
#slo_url ⇒ Object
43 44 45 |
# File 'lib/spid/rack/logout.rb', line 43 def slo_url responser.url end |
#spid_session ⇒ Object
68 69 70 |
# File 'lib/spid/rack/logout.rb', line 68 def spid_session request.session["spid"] end |
#valid_path? ⇒ Boolean
64 65 66 |
# File 'lib/spid/rack/logout.rb', line 64 def valid_path? request.path == Spid.configuration.logout_path end |
#valid_request? ⇒ Boolean
58 59 60 61 62 |
# File 'lib/spid/rack/logout.rb', line 58 def valid_request? valid_path? && !idp_name.nil? && !spid_session.nil? end |