Class: SoarAuthenticationToken::CookieProvider
- Inherits:
-
Object
- Object
- SoarAuthenticationToken::CookieProvider
- Defined in:
- lib/soar_authentication_token/providers/cookie_provider.rb
Instance Method Summary collapse
- #fetch(request) ⇒ Object
-
#initialize(configuration) ⇒ CookieProvider
constructor
A new instance of CookieProvider.
- #validate_configuration ⇒ Object
Constructor Details
#initialize(configuration) ⇒ CookieProvider
Returns a new instance of CookieProvider.
5 6 7 8 |
# File 'lib/soar_authentication_token/providers/cookie_provider.rb', line 5 def initialize(configuration) @configuration = configuration validate_configuration end |
Instance Method Details
#fetch(request) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/soar_authentication_token/providers/cookie_provider.rb', line 10 def fetch(request) return false unless request.env.has_key?('HTTP_COOKIE') return false unless request..has_key?(@configuration['cookie_name']) request.[@configuration['cookie_name']] end |
#validate_configuration ⇒ Object
17 18 19 |
# File 'lib/soar_authentication_token/providers/cookie_provider.rb', line 17 def validate_configuration raise "'cookie_name' must be configured" unless @configuration['cookie_name'] end |