Class: Saml::Kit::Builders::AuthenticationRequest

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(configuration: Saml::Kit.configuration, sign: true) ⇒ AuthenticationRequest

Returns a new instance of AuthenticationRequest.



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

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

Instance Attribute Details

#assertion_consumer_service_url ⇒ Object

Returns the value of attribute assertion_consumer_service_url.



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

def assertion_consumer_service_url
  @assertion_consumer_service_url
end

#destination ⇒ Object

Returns the value of attribute destination.



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

def destination
  @destination
end

#id ⇒ Object

Returns the value of attribute id.



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

def id
  @id
end

#issuer ⇒ Object

Returns the value of attribute issuer.



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

def issuer
  @issuer
end

#name_id_format ⇒ Object

Returns the value of attribute name_id_format.



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

def name_id_format
  @name_id_format
end

#now ⇒ Object

Returns the value of attribute now.



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

def now
  @now
end

#sign ⇒ Object

Returns the value of attribute sign.



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

def sign
  @sign
end

#version ⇒ Object

Returns the value of attribute version.



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

def version
  @version
end

Instance Method Details

#build ⇒ Object



27
28
29
# File 'lib/saml/kit/builders/authentication_request.rb', line 27

def build
  Saml::Kit::AuthenticationRequest.new(to_xml)
end

#to_xml ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/saml/kit/builders/authentication_request.rb', line 17

def to_xml
  Signature.sign(sign: sign) do |xml, signature|
    xml.tag!('samlp:AuthnRequest', request_options) do
      xml.tag!('saml:Issuer', issuer)
      signature.template(id)
      xml.tag!('samlp:NameIDPolicy', Format: name_id_format)
    end
  end
end