Class: Warden::JWTAuth::Strategy

Inherits:
Strategies::Base
  • Object
show all
Defined in:
lib/warden/jwt_auth/strategy.rb

Overview

Warden strategy to authenticate an user through a JWT token in the ‘Authorization` request header :reek:PrimaDonnaMethod

Instance Method Summary collapse

Instance Method Details

#authenticate!Object



20
21
22
23
24
25
26
# File 'lib/warden/jwt_auth/strategy.rb', line 20

def authenticate!
  aud = EnvHelper.aud_header(env)
  user = UserDecoder.new.call(token, scope, aud)
  success!(user)
rescue JWT::DecodeError => exception
  fail!(exception.message)
end

#store?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/warden/jwt_auth/strategy.rb', line 16

def store?
  false
end

#valid?Boolean

:reek:NilCheck

Returns:

  • (Boolean)


12
13
14
# File 'lib/warden/jwt_auth/strategy.rb', line 12

def valid?
  !token.nil?
end