Class: SimpleJwtAuth::Decode

Inherits:
Object
  • Object
show all
Includes:
Traits::Configurable
Defined in:
lib/simple_jwt_auth/decode.rb

Instance Method Summary collapse

Constructor Details

#initialize(token, options = {}) ⇒ Decode

Returns a new instance of Decode.



7
8
9
10
# File 'lib/simple_jwt_auth/decode.rb', line 7

def initialize(token, options = {})
  @token = token
  @options = options
end

Instance Method Details

#callObject



12
13
14
15
16
17
18
19
# File 'lib/simple_jwt_auth/decode.rb', line 12

def call
  JWT.decode(token, nil, true, options) do |_headers, payload|
    issuer = payload['iss']

    config.logger.debug "Decoding JWT token from issuer: #{issuer}"
    secrets.secret_for(issuer)
  end
end