Sha256: ab8f96cb9c3296b2b99b604ccb8665923c948d731280871f3b596d4daca79ea5
Contents?: true
Size: 885 Bytes
Versions: 1
Compression:
Stored size: 885 Bytes
Contents
module SoarAuthenticationToken class CascadeProvider def initialize(configuration) @configuration = configuration validate_configuration end def fetch(request) # TODO: refactor this functionality into modules - DON'T DUPLICATE! fetch_by_cookie(request) || fetch_by_auth_header(request) end private def fetch_by_cookie(request) return false unless request.env.has_key?('HTTP_COOKIE') return false unless request.cookies.has_key?(@configuration['cookie_name']) request.cookies[@configuration['cookie_name']] end def fetch_by_auth_header(request) return false unless request.env[@configuration['header_name']] request.env[@configuration['header_name']] end def validate_configuration raise "'cookie_name' must be configured" unless @configuration['header_name'] end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
soar_authentication_token-7.1.1 | lib/soar_authentication_token/providers/cascade_provider.rb |