Class: Saml::Kit::Builders::LogoutResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/saml/kit/builders/logout_response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user, request, configuration: Saml::Kit.configuration, sign: true) ⇒ LogoutResponse

Returns a new instance of LogoutResponse.



8
9
10
11
12
13
14
15
16
17
# File 'lib/saml/kit/builders/logout_response.rb', line 8

def initialize(user, request, configuration: Saml::Kit.configuration, sign: true)
  @user = user
  @now = Time.now.utc
  @request = request
  @id = Id.generate
  @version = "2.0"
  @status_code = Namespaces::SUCCESS
  @sign = sign
  @issuer = configuration.issuer
end

Instance Attribute Details

#destination ⇒ Object

Returns the value of attribute destination.



5
6
7
# File 'lib/saml/kit/builders/logout_response.rb', line 5

def destination
  @destination
end

#id ⇒ Object

Returns the value of attribute id.



5
6
7
# File 'lib/saml/kit/builders/logout_response.rb', line 5

def id
  @id
end

#issuer ⇒ Object

Returns the value of attribute issuer.



5
6
7
# File 'lib/saml/kit/builders/logout_response.rb', line 5

def issuer
  @issuer
end

#now ⇒ Object

Returns the value of attribute now.



5
6
7
# File 'lib/saml/kit/builders/logout_response.rb', line 5

def now
  @now
end

#request ⇒ Object (readonly)

Returns the value of attribute request.



6
7
8
# File 'lib/saml/kit/builders/logout_response.rb', line 6

def request
  @request
end

#sign ⇒ Object

Returns the value of attribute sign.



5
6
7
# File 'lib/saml/kit/builders/logout_response.rb', line 5

def sign
  @sign
end

#status_code ⇒ Object

Returns the value of attribute status_code.



5
6
7
# File 'lib/saml/kit/builders/logout_response.rb', line 5

def status_code
  @status_code
end

#version ⇒ Object

Returns the value of attribute version.



5
6
7
# File 'lib/saml/kit/builders/logout_response.rb', line 5

def version
  @version
end

Instance Method Details

#build ⇒ Object



31
32
33
# File 'lib/saml/kit/builders/logout_response.rb', line 31

def build
  Saml::Kit::LogoutResponse.new(to_xml, request_id: request.id)
end

#to_xml ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/saml/kit/builders/logout_response.rb', line 19

def to_xml
  Signature.sign(sign: sign) do |xml, signature|
    xml.LogoutResponse logout_response_options do
      xml.Issuer(issuer, xmlns: Namespaces::ASSERTION)
      signature.template(id)
      xml.Status do
        xml.StatusCode Value: status_code
      end
    end
  end
end