Class: JWTEasy::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/jwt_easy/configuration.rb

Overview

A configuration object used to define various options for encoding and decoding tokens.

  • This is usually not instantiated directly, but rather by way of calling JWTEasy.configure.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#algorithmString

Gets the algorithm to use when encoding tokens

  • If no secret has been set, this returns ‘none’

Returns:

  • (String)

    the algorithm to be used



21
22
23
# File 'lib/jwt_easy/configuration.rb', line 21

def algorithm
  secret ? (@algorithm || ALGORITHM_HMAC_HS256) : 'none'
end

#expiration_timeObject

Returns the value of attribute expiration_time.



11
12
13
# File 'lib/jwt_easy/configuration.rb', line 11

def expiration_time
  @expiration_time
end

#leewayObject

Returns the value of attribute leeway.



11
12
13
# File 'lib/jwt_easy/configuration.rb', line 11

def leeway
  @leeway
end

#not_before_timeObject

Returns the value of attribute not_before_time.



11
12
13
# File 'lib/jwt_easy/configuration.rb', line 11

def not_before_time
  @not_before_time
end

#secretObject

Returns the value of attribute secret.



11
12
13
# File 'lib/jwt_easy/configuration.rb', line 11

def secret
  @secret
end

Instance Method Details

#claimSymbol

Infers the claim to observe during encoding or decoding.

Returns:

  • (Symbol)

    short name for the identified claim



28
29
30
31
32
33
34
# File 'lib/jwt_easy/configuration.rb', line 28

def claim
  if expiration_time
    CLAIM_EXPIRATION_TIME
  elsif not_before_time
    CLAIM_NOT_BEFORE_TIME
  end
end