Class: Spid::Slo::Response

Inherits:
Object
  • Object
show all
Includes:
Spid::Saml2::Utils
Defined in:
lib/spid/slo/response.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:, request_uuid:) ⇒ Response

Returns a new instance of Response.



13
14
15
16
17
18
# File 'lib/spid/slo/response.rb', line 13

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

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



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

def body
  @body
end

#request_uuidObject (readonly)

Returns the value of attribute request_uuid.



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

def request_uuid
  @request_uuid
end

#saml_messageObject (readonly)

Returns the value of attribute saml_message.



11
12
13
# File 'lib/spid/slo/response.rb', line 11

def saml_message
  @saml_message
end

#session_indexObject (readonly)

Returns the value of attribute session_index.



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

def session_index
  @session_index
end

Instance Method Details

#errorsObject



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

def errors
  validator.errors
end

#identity_providerObject



43
44
45
46
# File 'lib/spid/slo/response.rb', line 43

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

#issuerObject



53
54
55
# File 'lib/spid/slo/response.rb', line 53

def issuer
  saml_response.issuer
end

#responseObject



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

def response
  []
end

#saml_responseObject



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

def saml_response
  @saml_response ||= Spid::Saml2::LogoutResponse.new(
    saml_message: saml_message
  )
end

#service_providerObject



48
49
50
51
# File 'lib/spid/slo/response.rb', line 48

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

#settingsObject



57
58
59
60
61
62
# File 'lib/spid/slo/response.rb', line 57

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

#valid?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/spid/slo/response.rb', line 20

def valid?
  validator.call
end

#validatorObject



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

def validator
  @validator ||=
    begin
      Spid::Saml2::LogoutResponseValidator.new(
        response: saml_response,
        settings: settings,
        request_uuid: request_uuid
      )
    end
end