Sha256: 09ae70d8e2e0575c40a380a069a0629d5660c98abd19ac900d0be0c4b4013e76

Contents?: true

Size: 549 Bytes

Versions: 1

Compression:

Stored size: 549 Bytes

Contents

require 'http-cookie'

module SoarAuthenticationToken
  class CookieProvider
    def initialize(configuration)
      @configuration = configuration
      validate_configuration
    end

    def fetch(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 validate_configuration
      raise "'cookie_name' must be configured" unless @configuration['cookie_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/cookie_provider.rb