Class: Spid::Saml2::Settings

Inherits:
Object
  • Object
show all
Defined in:
lib/spid/saml2/settings.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(identity_provider:, service_provider:, attribute_index: nil, authn_context: nil) ⇒ Settings

Returns a new instance of Settings.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/spid/saml2/settings.rb', line 13

def initialize(
      identity_provider:,
      service_provider:,
      attribute_index: nil,
      authn_context: nil
    )
  @authn_context = authn_context || Spid::L1
  @attribute_index = attribute_index
  unless AUTHN_CONTEXTS.include?(@authn_context)
    raise Spid::UnknownAuthnContextError,
          "Provided authn_context '#{@authn_context}' is not valid:" \
          " use one of #{AUTHN_CONTEXTS.join(', ')}"
  end

  @identity_provider = identity_provider
  @service_provider = service_provider
end

Instance Attribute Details

#attribute_indexObject (readonly)

Returns the value of attribute attribute_index.



11
12
13
# File 'lib/spid/saml2/settings.rb', line 11

def attribute_index
  @attribute_index
end

#authn_contextObject (readonly)

Returns the value of attribute authn_context.



10
11
12
# File 'lib/spid/saml2/settings.rb', line 10

def authn_context
  @authn_context
end

#identity_providerObject (readonly)

Returns the value of attribute identity_provider.



8
9
10
# File 'lib/spid/saml2/settings.rb', line 8

def identity_provider
  @identity_provider
end

#service_providerObject (readonly)

Returns the value of attribute service_provider.



9
10
11
# File 'lib/spid/saml2/settings.rb', line 9

def service_provider
  @service_provider
end

Instance Method Details

#acs_indexObject



87
88
89
# File 'lib/spid/saml2/settings.rb', line 87

def acs_index
  "0"
end

#certificateObject



71
72
73
# File 'lib/spid/saml2/settings.rb', line 71

def certificate
  service_provider.certificate
end

#digest_methodObject



83
84
85
# File 'lib/spid/saml2/settings.rb', line 83

def digest_method
  service_provider.digest_method
end

#force_authn?Boolean

Returns:

  • (Boolean)


91
92
93
# File 'lib/spid/saml2/settings.rb', line 91

def force_authn?
  authn_context > Spid::L1
end

#idp_certificateObject



75
76
77
# File 'lib/spid/saml2/settings.rb', line 75

def idp_certificate
  identity_provider.certificate
end

#idp_entity_idObject



31
32
33
# File 'lib/spid/saml2/settings.rb', line 31

def idp_entity_id
  identity_provider.entity_id
end

#idp_slo_target_urlObject



39
40
41
# File 'lib/spid/saml2/settings.rb', line 39

def idp_slo_target_url
  identity_provider.slo_target_url
end

#idp_sso_target_urlObject



35
36
37
# File 'lib/spid/saml2/settings.rb', line 35

def idp_sso_target_url
  identity_provider.sso_target_url
end

#private_keyObject



67
68
69
# File 'lib/spid/saml2/settings.rb', line 67

def private_key
  service_provider.private_key
end

#signature_methodObject



79
80
81
# File 'lib/spid/saml2/settings.rb', line 79

def signature_method
  service_provider.signature_method
end

#sp_acs_bindingObject



51
52
53
# File 'lib/spid/saml2/settings.rb', line 51

def sp_acs_binding
  service_provider.acs_binding
end

#sp_acs_urlObject



47
48
49
# File 'lib/spid/saml2/settings.rb', line 47

def sp_acs_url
  service_provider.acs_url
end

#sp_attribute_servicesObject



63
64
65
# File 'lib/spid/saml2/settings.rb', line 63

def sp_attribute_services
  service_provider.attribute_services
end

#sp_entity_idObject



43
44
45
# File 'lib/spid/saml2/settings.rb', line 43

def sp_entity_id
  service_provider.host
end

#sp_slo_service_bindingObject



59
60
61
# File 'lib/spid/saml2/settings.rb', line 59

def sp_slo_service_binding
  service_provider.slo_binding
end

#sp_slo_service_urlObject



55
56
57
# File 'lib/spid/saml2/settings.rb', line 55

def sp_slo_service_url
  service_provider.slo_url
end

#x509_certificate_derObject



95
96
97
98
99
100
# File 'lib/spid/saml2/settings.rb', line 95

def x509_certificate_der
  @x509_certificate_der ||=
    begin
      Base64.encode64(certificate.to_der).delete("\n")
    end
end