Class: OmniAuth::SAML::MultiProvider::Handler

Inherits:
Object
  • Object
show all
Defined in:
lib/omniauth/saml/multi_provider/handler.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path_prefix: OmniAuth.config.path_prefix, identity_provider_id_regex: /\w+/, &identity_provider_options_generator) ⇒ Handler

Returns a new instance of Handler.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/omniauth/saml/multi_provider/handler.rb', line 10

def initialize(path_prefix: OmniAuth.config.path_prefix,
               identity_provider_id_regex: /\w+/, &identity_provider_options_generator)
  raise 'Missing provider options generator block' unless block_given?

  @path_prefix = path_prefix
  @identity_provider_id_regex = identity_provider_id_regex
  @identity_provider_options_generator = identity_provider_options_generator

  # Eagerly compute these since lazy evaluation will not be threadsafe
  @provider_path_prefix = "#{@path_prefix}/saml"
  @saml_path_regex = /^#{@provider_path_prefix}\/(?<identity_provider_id>#{@identity_provider_id_regex})/
  @request_path_regex = /#{saml_path_regex}\/?$/
  @callback_path_regex = /#{saml_path_regex}\/callback\/?$/
end

Instance Attribute Details

#identity_provider_id_regexObject (readonly)

Returns the value of attribute identity_provider_id_regex.



8
9
10
# File 'lib/omniauth/saml/multi_provider/handler.rb', line 8

def identity_provider_id_regex
  @identity_provider_id_regex
end

#path_prefixObject (readonly)

Returns the value of attribute path_prefix.



8
9
10
# File 'lib/omniauth/saml/multi_provider/handler.rb', line 8

def path_prefix
  @path_prefix
end

Instance Method Details

#provider_optionsObject



25
26
27
28
29
30
31
# File 'lib/omniauth/saml/multi_provider/handler.rb', line 25

def provider_options
  {
      request_path: method(:request_path?),
      callback_path: method(:callback_path?),
      setup: method(:setup)
  }
end