Class: Spid::Rack::Login::LoginEnv
- Inherits:
-
Object
- Object
- Spid::Rack::Login::LoginEnv
- Defined in:
- lib/spid/rack/login.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
- #attribute_consuming_service_index ⇒ Object
- #authn_context ⇒ Object
- #idp_name ⇒ Object
-
#initialize(env) ⇒ LoginEnv
constructor
A new instance of LoginEnv.
- #log_message ⇒ Object
- #relay_state ⇒ Object
- #relay_state_id ⇒ Object
- #response ⇒ Object
- #responser ⇒ Object
- #session ⇒ Object
- #sso_url ⇒ Object
- #valid_path? ⇒ Boolean
- #valid_request? ⇒ Boolean
Constructor Details
#initialize(env) ⇒ LoginEnv
Returns a new instance of LoginEnv.
25 26 27 28 |
# File 'lib/spid/rack/login.rb', line 25 def initialize(env) @env = env @request = ::Rack::Request.new(env) end |
Instance Attribute Details
#env ⇒ Object (readonly)
Returns the value of attribute env.
23 24 25 |
# File 'lib/spid/rack/login.rb', line 23 def env @env end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
23 24 25 |
# File 'lib/spid/rack/login.rb', line 23 def request @request end |
Instance Method Details
#attribute_consuming_service_index ⇒ Object
88 89 90 |
# File 'lib/spid/rack/login.rb', line 88 def attribute_consuming_service_index request.params["attribute_index"] || "0" end |
#authn_context ⇒ Object
84 85 86 |
# File 'lib/spid/rack/login.rb', line 84 def authn_context request.params["authn_context"] || Spid::L1 end |
#idp_name ⇒ Object
80 81 82 |
# File 'lib/spid/rack/login.rb', line 80 def idp_name request.params["idp_name"] end |
#log_message ⇒ Object
92 93 94 95 96 |
# File 'lib/spid/rack/login.rb', line 92 def return nil unless Spid.configuration.logging_enabled Spid.configuration.logger.info responser..delete("\n") end |
#relay_state ⇒ Object
70 71 72 73 |
# File 'lib/spid/rack/login.rb', line 70 def relay_state request.params["relay_state"] || Spid.configuration.default_relay_state_path end |
#relay_state_id ⇒ Object
75 76 77 78 |
# File 'lib/spid/rack/login.rb', line 75 def relay_state_id digest = Digest::MD5.hexdigest(relay_state) "_#{digest}" end |
#response ⇒ Object
34 35 36 37 38 39 40 41 42 43 |
# File 'lib/spid/rack/login.rb', line 34 def response session["sso_request_uuid"] = responser.uuid session["relay_state"] = { relay_state_id => relay_state } session["idp"] = idp_name [ 302, { "Location" => sso_url }, [] ] end |
#responser ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/spid/rack/login.rb', line 49 def responser @responser ||= begin Spid::Sso::Request.new( idp_name: idp_name, relay_state: relay_state_id, attribute_index: attribute_consuming_service_index, authn_context: authn_context ) end end |
#session ⇒ Object
30 31 32 |
# File 'lib/spid/rack/login.rb', line 30 def session request.session["spid"] end |
#sso_url ⇒ Object
45 46 47 |
# File 'lib/spid/rack/login.rb', line 45 def sso_url responser.url end |
#valid_path? ⇒ Boolean
66 67 68 |
# File 'lib/spid/rack/login.rb', line 66 def valid_path? request.path == Spid.configuration.login_path end |
#valid_request? ⇒ Boolean
61 62 63 64 |
# File 'lib/spid/rack/login.rb', line 61 def valid_request? valid_path? && !idp_name.nil? end |