Class: Devise::JWT::Cookie::Strategy

Inherits:
Warden::Strategies::Base
  • Object
show all
Defined in:
lib/devise/jwt/cookie/strategy.rb

Overview

Warden strategy to authenticate an user through a JWT token in an http-only cookie

Instance Method Summary collapse

Instance Method Details

#authenticate!Object



17
18
19
20
21
22
23
24
# File 'lib/devise/jwt/cookie/strategy.rb', line 17

def authenticate!
  # FIXME support aud
  aud = nil
  user = Warden::JWTAuth::UserDecoder.new.call(token, scope, aud)
  success!(user)
rescue ::JWT::DecodeError => exception
  fail!(exception.message)
end

#store?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/devise/jwt/cookie/strategy.rb', line 13

def store?
  false
end

#valid?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/devise/jwt/cookie/strategy.rb', line 9

def valid?
  !token.nil?
end