class OneLogin::RubySaml::Settings

SAML2 Toolkit Settings

Constants

DEFAULTS

Attributes

assertion_consumer_logout_service_binding[RW]
assertion_consumer_logout_service_url[RW]

Compability

assertion_consumer_service_binding[RW]
assertion_consumer_service_url[RW]
attribute_consuming_service[R]
attributes_index[RW]
authn_context[RW]
authn_context_comparison[RW]
authn_context_decl_ref[RW]
certificate[RW]
compress_request[RW]
compress_response[RW]
double_quote_xml_attribute_values[RW]
force_authn[RW]
idp_attribute_names[RW]
idp_cert[RW]
idp_cert_fingerprint[RW]
idp_cert_fingerprint_algorithm[RW]
idp_entity_id[RW]

IdP Data

idp_slo_target_url[RW]
idp_sso_target_url[RW]
issuer[RW]

SP Data

name_identifier_format[RW]
name_identifier_value[RW]
passive[RW]
private_key[RW]
protocol_binding[RW]
security[RW]

Work-flow

sessionindex[RW]
soft[RW]
sp_name_qualifier[RW]

Public Class Methods

new(overrides = {}) click to toggle source
# File lib/onelogin/ruby-saml/settings.rb, line 12
def initialize(overrides = {})
  config = DEFAULTS.merge(overrides)
  config.each do |k,v|
    acc = "#{k.to_s}=".to_sym
    if respond_to? acc
      value = v.is_a?(Hash) ? v.dup : v
      send(acc, value)
    end
  end
  @attribute_consuming_service = AttributeService.new
end

Public Instance Methods

get_fingerprint() click to toggle source

Calculates the fingerprint of the IdP x509 certificate. @return [String] The fingerprint

# File lib/onelogin/ruby-saml/settings.rb, line 107
def get_fingerprint
  idp_cert_fingerprint || begin
    idp_cert = get_idp_cert
    if idp_cert
      fingerprint_alg = XMLSecurity::BaseDocument.new.algorithm(idp_cert_fingerprint_algorithm).new
      fingerprint_alg.hexdigest(idp_cert.to_der).upcase.scan(/../).join(":")
    end
  end
end
get_idp_cert() click to toggle source

@return [OpenSSL::X509::Certificate|nil] Build the IdP certificate from the settings (previously format it)

# File lib/onelogin/ruby-saml/settings.rb, line 119
def get_idp_cert
  return nil if idp_cert.nil? || idp_cert.empty?

  formatted_cert = OneLogin::RubySaml::Utils.format_cert(idp_cert)
  OpenSSL::X509::Certificate.new(formatted_cert)
end
get_sp_cert() click to toggle source

@return [OpenSSL::X509::Certificate|nil] Build the SP certificate from the settings (previously format it)

# File lib/onelogin/ruby-saml/settings.rb, line 128
def get_sp_cert
  return nil if certificate.nil? || certificate.empty?

  formatted_cert = OneLogin::RubySaml::Utils.format_cert(certificate)
  OpenSSL::X509::Certificate.new(formatted_cert)
end
get_sp_key() click to toggle source

@return [OpenSSL::PKey::RSA] Build the SP private from the settings (previously format it)

# File lib/onelogin/ruby-saml/settings.rb, line 137
def get_sp_key
  return nil if private_key.nil? || private_key.empty?
  
  formated_private_key = OneLogin::RubySaml::Utils.format_private_key(private_key)
  OpenSSL::PKey::RSA.new(formated_private_key)
end
single_logout_service_binding() click to toggle source

@return [String] Single Logout Service Binding.

# File lib/onelogin/ruby-saml/settings.rb, line 83
def single_logout_service_binding
  val = nil
  if @single_logout_service_binding.nil?
    if @assertion_consumer_logout_service_binding
      val = @assertion_consumer_logout_service_binding
    end
  else
    val = @single_logout_service_binding
  end
  val
end
single_logout_service_binding=(url) click to toggle source

Setter for Single Logout Service Binding.

(Currently we only support “urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect”) @param url [String]

# File lib/onelogin/ruby-saml/settings.rb, line 100
def single_logout_service_binding=(url)
  @single_logout_service_binding = url
end
single_logout_service_url() click to toggle source

@return [String] Single Logout Service URL.

# File lib/onelogin/ruby-saml/settings.rb, line 62
def single_logout_service_url
  val = nil
  if @single_logout_service_url.nil?
    if @assertion_consumer_logout_service_url
      val = @assertion_consumer_logout_service_url
    end
  else
    val = @single_logout_service_url
  end
  val
end
single_logout_service_url=(url) click to toggle source

Setter for the Single Logout Service URL. @param url [String].

# File lib/onelogin/ruby-saml/settings.rb, line 77
def single_logout_service_url=(url)
  @single_logout_service_url = url
end