Class: Warden::JWTAuth::Middleware::RevocationManager

Inherits:
Warden::JWTAuth::Middleware show all
Defined in:
lib/warden/jwt_auth/middleware/revocation_manager.rb

Overview

Revokes a token if it path and method match with configured

Constant Summary collapse

ENV_KEY =

Debugging key added to ‘env`

'warden-jwt_auth.revocation_manager'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ RevocationManager

Returns a new instance of RevocationManager.



13
14
15
16
17
# File 'lib/warden/jwt_auth/middleware/revocation_manager.rb', line 13

def initialize(app)
  @app = app
  @config = JWTAuth.config
  @helper = EnvHelper
end

Instance Attribute Details

#appObject (readonly)

Returns the value of attribute app.



11
12
13
# File 'lib/warden/jwt_auth/middleware/revocation_manager.rb', line 11

def app
  @app
end

#configObject (readonly)

Returns the value of attribute config.



11
12
13
# File 'lib/warden/jwt_auth/middleware/revocation_manager.rb', line 11

def config
  @config
end

#helperObject (readonly)

Returns the value of attribute helper.



11
12
13
# File 'lib/warden/jwt_auth/middleware/revocation_manager.rb', line 11

def helper
  @helper
end

Instance Method Details

#call(env) ⇒ Object



19
20
21
22
23
24
# File 'lib/warden/jwt_auth/middleware/revocation_manager.rb', line 19

def call(env)
  env[ENV_KEY] = true
  response = app.call(env)
  revoke_token(env)
  response
end