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

Instance Method Summary collapse

Instance Method Details

#authenticate!Object



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

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

#store?Boolean

Returns:

  • (Boolean)


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

def store?
  false
end

#valid?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/warden/jwt_auth/strategy.rb', line 10

def valid?
  token_exists? && issuer_claim_valid?
end