Class: MaticJWT::Grape::Middleware::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/matic-jwt/grape/middleware/request.rb

Constant Summary collapse

AUTHORIZATION_KEYS =
%w[
  Authorization
  HTTP_AUTHORIZATION
  X-HTTP_AUTHORIZATION
  X_HTTP_AUTHORIZATION
].freeze

Instance Method Summary collapse

Constructor Details

#initialize(env) ⇒ Request

Returns a new instance of Request.



14
15
16
# File 'lib/matic-jwt/grape/middleware/request.rb', line 14

def initialize(env)
  @env = env
end

Instance Method Details

#auth_tokenObject



22
23
24
# File 'lib/matic-jwt/grape/middleware/request.rb', line 22

def auth_token
  @env[auth_key]
end

#valid?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/matic-jwt/grape/middleware/request.rb', line 18

def valid?
  !@env[auth_key].nil?
end