Class: Rack::Auth::Bearer::Request

Inherits:
AbstractRequest
  • Object
show all
Defined in:
lib/hadley/authz/bearer.rb

Overview

This class represents a custom rack authorization request type for bearer token based authorization

Instance Method Summary collapse

Instance Method Details

#bearer?Boolean

Provides a means to determin if the current requests authorization type is ‘Bearer’.

Returns:

  • (Boolean)

    true if and only if the current requests authorization type is ‘Bearer’.



10
11
12
# File 'lib/hadley/authz/bearer.rb', line 10

def bearer?
  :bearer == scheme
end

#tokenString

Provides access to the bearer token associated with the current request.

Returns:

  • (String)

    The token assiciated with the current request.



17
18
19
# File 'lib/hadley/authz/bearer.rb', line 17

def token
  @token ||= params.split(' ', 2).first
end