Class: Spid::Slo::IdpRequest

Inherits:
Object
  • Object
show all
Includes:
Spid::Saml2::Utils
Defined in:
lib/spid/slo/idp_request.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Spid::Saml2::Utils

#certificate_from_encoded_der, #decode, #decode_and_inflate, #deflate, #deflate_and_encode, #encode, #escaped_params, #escaped_query_string, #inflate, #query_param, #query_params, #query_string

Constructor Details

#initialize(body:, session_index:) ⇒ IdpRequest

Returns a new instance of IdpRequest.



12
13
14
15
16
# File 'lib/spid/slo/idp_request.rb', line 12

def initialize(body:, session_index:)
  @body = body
  @saml_message = decode_and_inflate(body)
  @session_index = session_index
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



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

def body
  @body
end

#saml_messageObject (readonly)

Returns the value of attribute saml_message.



9
10
11
# File 'lib/spid/slo/idp_request.rb', line 9

def saml_message
  @saml_message
end

#session_indexObject (readonly)

Returns the value of attribute session_index.



10
11
12
# File 'lib/spid/slo/idp_request.rb', line 10

def session_index
  @session_index
end

Instance Method Details

#identity_providerObject



28
29
30
31
# File 'lib/spid/slo/idp_request.rb', line 28

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

#idp_logout_requestObject



58
59
60
61
62
63
64
65
# File 'lib/spid/slo/idp_request.rb', line 58

def idp_logout_request
  @idp_logout_request ||=
    begin
      Spid::Saml2::IdpLogoutRequest.new(
        saml_message: saml_message
      )
    end
end

#idp_logout_responseObject



67
68
69
70
71
72
73
74
75
# File 'lib/spid/slo/idp_request.rb', line 67

def idp_logout_response
  @idp_logout_response ||=
    begin
      Spid::Saml2::IdpLogoutResponse.new(
        settings: settings,
        request_uuid: idp_logout_request.id
      )
    end
end

#issuerObject



38
39
40
# File 'lib/spid/slo/idp_request.rb', line 38

def issuer
  idp_logout_request.issuer
end

#responseObject



18
19
20
21
22
# File 'lib/spid/slo/idp_request.rb', line 18

def response
  [
    idp_logout_response.to_saml
  ]
end

#service_providerObject



33
34
35
36
# File 'lib/spid/slo/idp_request.rb', line 33

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

#settingsObject



42
43
44
45
46
47
# File 'lib/spid/slo/idp_request.rb', line 42

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

#valid?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/spid/slo/idp_request.rb', line 24

def valid?
  validator.call
end

#validatorObject



49
50
51
52
53
54
55
56
# File 'lib/spid/slo/idp_request.rb', line 49

def validator
  @validator ||=
    begin
      Spid::Saml2::IdpLogoutRequestValidator.new(
        request: idp_logout_request
      )
    end
end