Class: Spid::Configuration

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

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



25
26
27
28
29
30
31
32
33
34
# File 'lib/spid/configuration.rb', line 25

def initialize
  @idp_metadata_dir_path    = "idp_metadata"
  @attribute_services       = []
  @logging_enabled          = false
  @logger                   = ::Logger.new $stdout
  init_endpoint
  init_bindings
  init_dig_sig_methods
  init_openssl_keys
end

Instance Attribute Details

#acs_bindingObject

Returns the value of attribute acs_binding.



17
18
19
# File 'lib/spid/configuration.rb', line 17

def acs_binding
  @acs_binding
end

#acs_pathObject

Returns the value of attribute acs_path.



12
13
14
# File 'lib/spid/configuration.rb', line 12

def acs_path
  @acs_path
end

#attribute_servicesObject

Returns the value of attribute attribute_services.



19
20
21
# File 'lib/spid/configuration.rb', line 19

def attribute_services
  @attribute_services
end

#certificate_pemObject

Returns the value of attribute certificate_pem.



21
22
23
# File 'lib/spid/configuration.rb', line 21

def certificate_pem
  @certificate_pem
end

#default_relay_state_pathObject

Returns the value of attribute default_relay_state_path.



16
17
18
# File 'lib/spid/configuration.rb', line 16

def default_relay_state_path
  @default_relay_state_path
end

#digest_methodObject

Returns the value of attribute digest_method.



14
15
16
# File 'lib/spid/configuration.rb', line 14

def digest_method
  @digest_method
end

#hostnameObject

Returns the value of attribute hostname.



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

def hostname
  @hostname
end

#idp_metadata_dir_pathObject

Returns the value of attribute idp_metadata_dir_path.



7
8
9
# File 'lib/spid/configuration.rb', line 7

def 
  @idp_metadata_dir_path
end

#loggerObject

Returns the value of attribute logger.



23
24
25
# File 'lib/spid/configuration.rb', line 23

def logger
  @logger
end

#logging_enabledObject

Returns the value of attribute logging_enabled.



22
23
24
# File 'lib/spid/configuration.rb', line 22

def logging_enabled
  @logging_enabled
end

#login_pathObject

Returns the value of attribute login_path.



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

def 
  @login_path
end

#logout_pathObject

Returns the value of attribute logout_path.



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

def logout_path
  @logout_path
end

#metadata_pathObject

Returns the value of attribute metadata_path.



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

def 
  @metadata_path
end

#private_key_pemObject

Returns the value of attribute private_key_pem.



20
21
22
# File 'lib/spid/configuration.rb', line 20

def private_key_pem
  @private_key_pem
end

#signature_methodObject

Returns the value of attribute signature_method.



15
16
17
# File 'lib/spid/configuration.rb', line 15

def signature_method
  @signature_method
end

#slo_bindingObject

Returns the value of attribute slo_binding.



18
19
20
# File 'lib/spid/configuration.rb', line 18

def slo_binding
  @slo_binding
end

#slo_pathObject

Returns the value of attribute slo_path.



13
14
15
# File 'lib/spid/configuration.rb', line 13

def slo_path
  @slo_path
end

Instance Method Details

#certificateObject



61
62
63
64
# File 'lib/spid/configuration.rb', line 61

def certificate
  return nil if certificate_pem.nil?
  @certificate ||= OpenSSL::X509::Certificate.new(certificate_pem)
end

#init_bindingsObject



46
47
48
49
# File 'lib/spid/configuration.rb', line 46

def init_bindings
  @acs_binding              = Spid::BINDINGS_HTTP_POST
  @slo_binding              = Spid::BINDINGS_HTTP_REDIRECT
end

#init_dig_sig_methodsObject



51
52
53
54
# File 'lib/spid/configuration.rb', line 51

def init_dig_sig_methods
  @digest_method            = Spid::SHA256
  @signature_method         = Spid::RSA_SHA256
end

#init_endpointObject



36
37
38
39
40
41
42
43
44
# File 'lib/spid/configuration.rb', line 36

def init_endpoint
  @hostname                 = nil
  @metadata_path            = "/spid/metadata"
  @login_path               = "/spid/login"
  @logout_path              = "/spid/logout"
  @acs_path                 = "/spid/sso"
  @slo_path                 = "/spid/slo"
  @default_relay_state_path = "/"
end

#init_openssl_keysObject



56
57
58
59
# File 'lib/spid/configuration.rb', line 56

def init_openssl_keys
  @private_key              = nil
  @certificate              = nil
end

#private_keyObject



66
67
68
69
# File 'lib/spid/configuration.rb', line 66

def private_key
  return nil if private_key_pem.nil?
  @private_key ||= OpenSSL::PKey::RSA.new(private_key_pem)
end

#service_providerObject



71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/spid/configuration.rb', line 71

def service_provider
  @service_provider ||=
    begin
      Spid::Saml2::ServiceProvider.new(
        acs_binding: acs_binding, acs_path: acs_path, slo_path: slo_path,
        slo_binding: slo_binding, metadata_path: ,
        private_key: private_key, certificate: certificate,
        digest_method: digest_method, signature_method: signature_method,
        attribute_services: attribute_services, host: hostname
      )
    end
end