Class: AuthenticJwt::Grape::Middleware

Inherits:
Grape::Middleware::Base
  • Object
show all
Defined in:
lib/authentic_jwt/grape/middleware.rb

Instance Method Summary collapse

Instance Method Details

#beforeObject



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/authentic_jwt/grape/middleware.rb', line 7

def before
  return unless scope

  validator = AuthenticJwt::Validator.new
  payload = validator.call(header: header)

  authorizer = AuthenticJwt::Authorizer.new
  authorizer.call(payload: payload, scope: scope)

  context.extend(AuthMethods)
  context.jwt_payload = payload
end