class SamlIdp::SamlResponse

Attributes

algorithm[RW]
asserted_attributes_opts[RW]
audience_uri[RW]
authn_context_classref[RW]
compression_opts[RW]
encryption_opts[RW]
expiry[RW]
issuer_uri[RW]
name_id_formats_opts[RW]
principal[RW]
reference_id[RW]
response_id[RW]
saml_acs_url[RW]
saml_request_id[RW]
secret_key[RW]
session_expiry[RW]
signed_assertion_opts[RW]
signed_message_opts[RW]
x509_certificate[RW]

Public Class Methods

new( reference_id, response_id, issuer_uri, principal, audience_uri, saml_request_id, saml_acs_url, algorithm, authn_context_classref, expiry = 60 * 60, encryption_opts = nil, session_expiry = 0, name_id_formats_opts = nil, asserted_attributes_opts = nil, signed_message_opts = false, signed_assertion_opts = true, compression_opts = false ) click to toggle source
# File lib/saml_idp/saml_response.rb, line 27
def initialize(
  reference_id,
  response_id,
  issuer_uri,
  principal,
  audience_uri,
  saml_request_id,
  saml_acs_url,
  algorithm,
  authn_context_classref,
  expiry = 60 * 60,
  encryption_opts = nil,
  session_expiry = 0,
  name_id_formats_opts = nil,
  asserted_attributes_opts = nil,
  signed_message_opts = false,
  signed_assertion_opts = true,
  compression_opts = false
)

  self.reference_id = reference_id
  self.response_id = response_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.algorithm = algorithm
  self.secret_key = secret_key
  self.x509_certificate = x509_certificate
  self.authn_context_classref = authn_context_classref
  self.expiry = expiry
  self.encryption_opts = encryption_opts
  self.session_expiry = session_expiry
  self.signed_message_opts = signed_message_opts
  self.name_id_formats_opts = name_id_formats_opts
  self.asserted_attributes_opts = asserted_attributes_opts
  self.signed_assertion_opts = signed_assertion_opts
  self.name_id_formats_opts = name_id_formats_opts
  self.asserted_attributes_opts = asserted_attributes_opts
  self.compression_opts = compression_opts
end

Public Instance Methods

build() click to toggle source
# File lib/saml_idp/saml_response.rb, line 70
def build
  @build ||= encoded_message
end

Private Instance Methods

assertion_builder() click to toggle source
# File lib/saml_idp/saml_response.rb, line 99
def assertion_builder
  @assertion_builder ||=
    AssertionBuilder.new SecureRandom.uuid,
                         issuer_uri,
                         principal,
                         audience_uri,
                         saml_request_id,
                         saml_acs_url,
                         algorithm,
                         authn_context_classref,
                         expiry,
                         encryption_opts,
                         session_expiry,
                         name_id_formats_opts,
                         asserted_attributes_opts
end
encoded_message() click to toggle source
# File lib/saml_idp/saml_response.rb, line 85
def encoded_message
  if signed_message_opts
    response_builder.encoded(signed_message: true, compress: compression_opts)
  else
    response_builder.encoded(signed_message: false, compress: compression_opts)
  end
end
response_builder() click to toggle source
# File lib/saml_idp/saml_response.rb, line 94
def response_builder
  ResponseBuilder.new(response_id, issuer_uri, saml_acs_url, saml_request_id, signed_assertion, algorithm)
end
signed_assertion() click to toggle source
# File lib/saml_idp/saml_response.rb, line 74
def signed_assertion
  if encryption_opts
    assertion_builder.encrypt(sign: true)
  elsif signed_assertion_opts
    assertion_builder.signed
  else
    assertion_builder.raw
  end
end