Class: Spid::Slo::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/spid/slo/request.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(idp_name:, session_index:, relay_state: nil) ⇒ Request

Returns a new instance of Request.



10
11
12
13
14
15
16
17
# File 'lib/spid/slo/request.rb', line 10

def initialize(idp_name:, session_index:, relay_state: nil)
  @idp_name = idp_name
  @session_index = session_index
  @relay_state =
    begin
      relay_state || Spid.configuration.default_relay_state_path
    end
end

Instance Attribute Details

#idp_nameObject (readonly)

Returns the value of attribute idp_name.



6
7
8
# File 'lib/spid/slo/request.rb', line 6

def idp_name
  @idp_name
end

#relay_stateObject (readonly)

Returns the value of attribute relay_state.



8
9
10
# File 'lib/spid/slo/request.rb', line 8

def relay_state
  @relay_state
end

#session_indexObject (readonly)

Returns the value of attribute session_index.



7
8
9
# File 'lib/spid/slo/request.rb', line 7

def session_index
  @session_index
end

Instance Method Details

#identity_providerObject



60
61
62
63
# File 'lib/spid/slo/request.rb', line 60

def identity_provider
  @identity_provider ||=
    IdentityProviderManager.find_by_entity(idp_name)
end

#logout_requestObject



46
47
48
49
50
51
# File 'lib/spid/slo/request.rb', line 46

def logout_request
  @logout_request ||= Spid::Saml2::LogoutRequest.new(
    settings: settings,
    session_index: session_index
  )
end

#query_params_signerObject



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/spid/slo/request.rb', line 30

def query_params_signer
  @query_params_signer ||=
    begin
      Spid::Saml2::Utils::QueryParamsSigner.new(
        saml_message: saml_message,
        relay_state: relay_state,
        private_key: settings.private_key,
        signature_method: settings.signature_method
      )
    end
end

#saml_messageObject



42
43
44
# File 'lib/spid/slo/request.rb', line 42

def saml_message
  @saml_message ||= logout_request.to_saml
end

#service_providerObject



65
66
67
68
# File 'lib/spid/slo/request.rb', line 65

def service_provider
  @service_provider ||=
    Spid.configuration.service_provider
end

#settingsObject



53
54
55
56
57
58
# File 'lib/spid/slo/request.rb', line 53

def settings
  @settings ||= Spid::Saml2::Settings.new(
    service_provider: service_provider,
    identity_provider: identity_provider
  )
end

#urlObject



19
20
21
22
23
24
# File 'lib/spid/slo/request.rb', line 19

def url
  [
    settings.idp_slo_target_url,
    query_params_signer.escaped_signed_query_string
  ].join("?")
end

#uuidObject



26
27
28
# File 'lib/spid/slo/request.rb', line 26

def uuid
  logout_request.uuid
end