Class: Warden::JWTAuth::Middleware::TokenDispatcher
- Inherits:
-
Warden::JWTAuth::Middleware
- Object
- Warden::JWTAuth::Middleware
- Warden::JWTAuth::Middleware::TokenDispatcher
- Defined in:
- lib/warden/jwt_auth/middleware/token_dispatcher.rb
Overview
Dispatches a token (adds it to ‘Authorization` response header) if it has been added to the request `env` by [Hooks]
Constant Summary collapse
- ENV_KEY =
Debugging key added to ‘env`
'warden-jwt_auth.token_dispatcher'
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ TokenDispatcher
constructor
A new instance of TokenDispatcher.
Constructor Details
#initialize(app) ⇒ TokenDispatcher
Returns a new instance of TokenDispatcher.
14 15 16 |
# File 'lib/warden/jwt_auth/middleware/token_dispatcher.rb', line 14 def initialize(app) @app = app end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
12 13 14 |
# File 'lib/warden/jwt_auth/middleware/token_dispatcher.rb', line 12 def app @app end |
Instance Method Details
#call(env) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/warden/jwt_auth/middleware/token_dispatcher.rb', line 18 def call(env) env[ENV_KEY] = true status, headers, response = app.call(env) headers = headers_with_token(env, headers) [status, headers, response] end |