Class: SamlIdp::AssertionBuilder

Inherits:
Object
  • Object
show all
Includes:
Algorithmable, Signable
Defined in:
lib/saml_idp/assertion_builder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Signable

included, #sign, #signed

Constructor Details

#initialize(reference_id, issuer_uri, principal, audience_uri, saml_request_id, saml_acs_url, raw_algorithm, authn_context_classref, expiry = 60*60, encryption_opts = nil) ⇒ AssertionBuilder

Returns a new instance of AssertionBuilder.



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/saml_idp/assertion_builder.rb', line 21

def initialize(reference_id, issuer_uri, principal, audience_uri, saml_request_id, saml_acs_url, raw_algorithm, authn_context_classref, expiry=60*60, encryption_opts=nil)
  self.reference_id = reference_id
  self.issuer_uri = issuer_uri
  self.principal = principal
  self.audience_uri = audience_uri
  self.saml_request_id = saml_request_id
  self.saml_acs_url = saml_acs_url
  self.raw_algorithm = raw_algorithm
  self.authn_context_classref = authn_context_classref
  self.expiry = expiry
  self.encryption_opts = encryption_opts
end

Instance Attribute Details

#audience_uriObject

Returns the value of attribute audience_uri.



11
12
13
# File 'lib/saml_idp/assertion_builder.rb', line 11

def audience_uri
  @audience_uri
end

#authn_context_classrefObject

Returns the value of attribute authn_context_classref.



15
16
17
# File 'lib/saml_idp/assertion_builder.rb', line 15

def authn_context_classref
  @authn_context_classref
end

#encryption_optsObject

Returns the value of attribute encryption_opts.



17
18
19
# File 'lib/saml_idp/assertion_builder.rb', line 17

def encryption_opts
  @encryption_opts
end

#expiryObject

Returns the value of attribute expiry.



16
17
18
# File 'lib/saml_idp/assertion_builder.rb', line 16

def expiry
  @expiry
end

#issuer_uriObject

Returns the value of attribute issuer_uri.



9
10
11
# File 'lib/saml_idp/assertion_builder.rb', line 9

def issuer_uri
  @issuer_uri
end

#principalObject

Returns the value of attribute principal.



10
11
12
# File 'lib/saml_idp/assertion_builder.rb', line 10

def principal
  @principal
end

#raw_algorithmObject

Returns the value of attribute raw_algorithm.



14
15
16
# File 'lib/saml_idp/assertion_builder.rb', line 14

def raw_algorithm
  @raw_algorithm
end

#reference_idObject

Returns the value of attribute reference_id.



8
9
10
# File 'lib/saml_idp/assertion_builder.rb', line 8

def reference_id
  @reference_id
end

#saml_acs_urlObject

Returns the value of attribute saml_acs_url.



13
14
15
# File 'lib/saml_idp/assertion_builder.rb', line 13

def saml_acs_url
  @saml_acs_url
end

#saml_request_idObject

Returns the value of attribute saml_request_id.



12
13
14
# File 'lib/saml_idp/assertion_builder.rb', line 12

def saml_request_id
  @saml_request_id
end

Instance Method Details

#encrypt(opts = {}) ⇒ Object



83
84
85
86
87
88
89
# File 'lib/saml_idp/assertion_builder.rb', line 83

def encrypt(opts = {})
  raise "Must set encryption_opts to encrypt" unless encryption_opts
  raw_xml = opts[:sign] ? signed : raw
  require 'saml_idp/encryptor'
  encryptor = Encryptor.new encryption_opts
  encryptor.encrypt(raw_xml)
end