Class: SoarAuthenticationToken::AuthorizationHeaderProvider

Inherits:
Object
  • Object
show all
Defined in:
lib/soar_authentication_token/providers/authorization_header_provider.rb

Instance Method Summary collapse

Constructor Details

#initialize(configuration) ⇒ AuthorizationHeaderProvider

Returns a new instance of AuthorizationHeaderProvider.



3
4
5
6
# File 'lib/soar_authentication_token/providers/authorization_header_provider.rb', line 3

def initialize(configuration)
  @configuration = configuration
  validate_configuration
end

Instance Method Details

#fetch(request) ⇒ Object



8
9
10
11
12
# File 'lib/soar_authentication_token/providers/authorization_header_provider.rb', line 8

def fetch(request)
  return false unless request.env[@configuration['header_name']]

  request.env[@configuration['header_name']]
end

#validate_configurationObject



14
15
16
# File 'lib/soar_authentication_token/providers/authorization_header_provider.rb', line 14

def validate_configuration
  raise "'cookie_name' must be configured" unless @configuration['header_name']
end