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:PrimmaDonnaMethod

Instance Method Summary collapse

Instance Method Details

#authenticate!Object



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

def authenticate!
  user = UserDecoder.new.call(token, scope)
  success!(user)
rescue JWT::DecodeError
  fail!
end

#store?Boolean

Returns:

  • (Boolean)


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

def store?
  false
end

#valid?Boolean

Returns:

  • (Boolean)


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

def valid?
  !token.nil?
end