Class: OneLogin::RubySaml::Settings

Inherits:
Object
  • Object
show all
Defined in:
lib/onelogin/ruby-saml/settings.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(overrides = {}, keep_security_attributes = false) ⇒ Settings

Returns a new instance of Settings.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/onelogin/ruby-saml/settings.rb', line 7

def initialize(overrides = {}, keep_security_attributes = false)
  if keep_security_attributes
     security_attributes = overrides.delete(:security) || {}
     config = DEFAULTS.merge(overrides)
     config[:security] = DEFAULTS[:security].merge(security_attributes)
   else
     config = DEFAULTS.merge(overrides)
   end

   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
end

Instance Attribute Details

#assertion_consumer_logout_service_bindingObject

Returns the value of attribute assertion_consumer_logout_service_binding.



53
54
55
# File 'lib/onelogin/ruby-saml/settings.rb', line 53

def assertion_consumer_logout_service_binding
  @assertion_consumer_logout_service_binding
end

#assertion_consumer_logout_service_urlObject

Returns the value of attribute assertion_consumer_logout_service_url.



39
40
41
# File 'lib/onelogin/ruby-saml/settings.rb', line 39

def assertion_consumer_logout_service_url
  @assertion_consumer_logout_service_url
end

#assertion_consumer_service_urlObject

Returns the value of attribute assertion_consumer_service_url.



32
33
34
# File 'lib/onelogin/ruby-saml/settings.rb', line 32

def assertion_consumer_service_url
  @assertion_consumer_service_url
end

#authn_contextObject

Returns the value of attribute authn_context.



33
34
35
# File 'lib/onelogin/ruby-saml/settings.rb', line 33

def authn_context
  @authn_context
end

#certificateObject

Returns the value of attribute certificate.



46
47
48
# File 'lib/onelogin/ruby-saml/settings.rb', line 46

def certificate
  @certificate
end

#compress_requestObject

Returns the value of attribute compress_request.



40
41
42
# File 'lib/onelogin/ruby-saml/settings.rb', line 40

def compress_request
  @compress_request
end

#compress_responseObject

Returns the value of attribute compress_response.



41
42
43
# File 'lib/onelogin/ruby-saml/settings.rb', line 41

def compress_response
  @compress_response
end

#double_quote_xml_attribute_valuesObject

Returns the value of attribute double_quote_xml_attribute_values.



42
43
44
# File 'lib/onelogin/ruby-saml/settings.rb', line 42

def double_quote_xml_attribute_values
  @double_quote_xml_attribute_values
end

#force_authnObject

Returns the value of attribute force_authn.



43
44
45
# File 'lib/onelogin/ruby-saml/settings.rb', line 43

def force_authn
  @force_authn
end

#idp_certObject

Returns the value of attribute idp_cert.



28
29
30
# File 'lib/onelogin/ruby-saml/settings.rb', line 28

def idp_cert
  @idp_cert
end

#idp_cert_fingerprintObject

Returns the value of attribute idp_cert_fingerprint.



27
28
29
# File 'lib/onelogin/ruby-saml/settings.rb', line 27

def idp_cert_fingerprint
  @idp_cert_fingerprint
end

#idp_slo_target_urlObject

Returns the value of attribute idp_slo_target_url.



29
30
31
# File 'lib/onelogin/ruby-saml/settings.rb', line 29

def idp_slo_target_url
  @idp_slo_target_url
end

#idp_sso_target_urlObject

idp data



26
27
28
# File 'lib/onelogin/ruby-saml/settings.rb', line 26

def idp_sso_target_url
  @idp_sso_target_url
end

#issuerObject

Compability



51
52
53
# File 'lib/onelogin/ruby-saml/settings.rb', line 51

def issuer
  @issuer
end

#name_identifier_formatObject

Returns the value of attribute name_identifier_format.



35
36
37
# File 'lib/onelogin/ruby-saml/settings.rb', line 35

def name_identifier_format
  @name_identifier_format
end

#name_identifier_valueObject

Returns the value of attribute name_identifier_value.



36
37
38
# File 'lib/onelogin/ruby-saml/settings.rb', line 36

def name_identifier_value
  @name_identifier_value
end

#name_identifier_value_requestedObject

Returns the value of attribute name_identifier_value_requested.



37
38
39
# File 'lib/onelogin/ruby-saml/settings.rb', line 37

def name_identifier_value_requested
  @name_identifier_value_requested
end

#passiveObject

Returns the value of attribute passive.



44
45
46
# File 'lib/onelogin/ruby-saml/settings.rb', line 44

def passive
  @passive
end

#private_keyObject

Returns the value of attribute private_key.



47
48
49
# File 'lib/onelogin/ruby-saml/settings.rb', line 47

def private_key
  @private_key
end

#protocol_bindingObject

Returns the value of attribute protocol_binding.



45
46
47
# File 'lib/onelogin/ruby-saml/settings.rb', line 45

def protocol_binding
  @protocol_binding
end

#securityObject

Work-flow



49
50
51
# File 'lib/onelogin/ruby-saml/settings.rb', line 49

def security
  @security
end

#sessionindexObject

Returns the value of attribute sessionindex.



38
39
40
# File 'lib/onelogin/ruby-saml/settings.rb', line 38

def sessionindex
  @sessionindex
end

#sp_entity_idString

Returns SP Entity ID.

Returns:

  • (String)

    SP Entity ID



31
32
33
# File 'lib/onelogin/ruby-saml/settings.rb', line 31

def sp_entity_id
  @sp_entity_id
end

#sp_name_qualifierObject

Returns the value of attribute sp_name_qualifier.



34
35
36
# File 'lib/onelogin/ruby-saml/settings.rb', line 34

def sp_name_qualifier
  @sp_name_qualifier
end

Instance Method Details

#get_sp_certOpenSSL::X509::Certificate|nil

Returns Build the SP certificate from the settings (previously format it).

Returns:

  • (OpenSSL::X509::Certificate|nil)

    Build the SP certificate from the settings (previously format it)



122
123
124
125
126
127
# File 'lib/onelogin/ruby-saml/settings.rb', line 122

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_cert_newOpenSSL::X509::Certificate|nil

Returns Build the New SP certificate from the settings (previously format it).

Returns:

  • (OpenSSL::X509::Certificate|nil)

    Build the New SP certificate from the settings (previously format it)



131
132
133
134
135
136
# File 'lib/onelogin/ruby-saml/settings.rb', line 131

def get_sp_cert_new
  return nil if certificate_new.nil? || certificate_new.empty?

  formatted_cert = OneLogin::RubySaml::Utils.format_cert(certificate_new)
  OpenSSL::X509::Certificate.new(formatted_cert)
end

#get_sp_keyOpenSSL::PKey::RSA

Returns Build the SP private from the settings (previously format it).

Returns:

  • (OpenSSL::PKey::RSA)

    Build the SP private from the settings (previously format it)



140
141
142
143
144
145
# File 'lib/onelogin/ruby-saml/settings.rb', line 140

def get_sp_key
  return nil if private_key.nil? || private_key.empty?

  formatted_private_key = OneLogin::RubySaml::Utils.format_private_key(private_key)
  OpenSSL::PKey::RSA.new(formatted_private_key)
end

#single_logout_service_bindingString

Returns Single Logout Service Binding.

Returns:

  • (String)

    Single Logout Service Binding.



99
100
101
102
103
104
105
106
107
108
109
# File 'lib/onelogin/ruby-saml/settings.rb', line 99

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) ⇒ Object

Setter for Single Logout Service Binding.

(Currently we only support “urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect”)

Parameters:

  • url (String)


116
117
118
# File 'lib/onelogin/ruby-saml/settings.rb', line 116

def single_logout_service_binding=(url)
  @single_logout_service_binding = url
end

#single_logout_service_urlString

Returns Single Logout Service URL.

Returns:

  • (String)

    Single Logout Service URL.



78
79
80
81
82
83
84
85
86
87
88
# File 'lib/onelogin/ruby-saml/settings.rb', line 78

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) ⇒ Object

Setter for the Single Logout Service URL.

Parameters:

  • url (String)

    .



93
94
95
# File 'lib/onelogin/ruby-saml/settings.rb', line 93

def single_logout_service_url=(url)
  @single_logout_service_url = url
end