Class: Drillbit::Middleware::TokenProcessor
- Inherits:
-
Object
- Object
- Drillbit::Middleware::TokenProcessor
- Defined in:
- lib/drillbit/middleware/token_processor.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ TokenProcessor
constructor
A new instance of TokenProcessor.
Constructor Details
#initialize(app) ⇒ TokenProcessor
Returns a new instance of TokenProcessor.
9 10 11 |
# File 'lib/drillbit/middleware/token_processor.rb', line 9 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/drillbit/middleware/token_processor.rb', line 13 def call(env) request = Requests::Base.resolve(env) token = request. return Responses::InvalidToken.call(env, application_name: request.application_name) \ unless token.valid? env['X_JSON_WEB_TOKEN'] = token.to_h @app.call(env) end |