Class: JWT::Configuration::DecodeConfiguration

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

Overview

The DecodeConfiguration class holds the configuration settings for decoding JWT tokens.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDecodeConfiguration

Initializes a new DecodeConfiguration instance with default settings.



40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/jwt/configuration/decode_configuration.rb', line 40

def initialize
  @verify_expiration = true
  @verify_not_before = true
  @verify_iss = false
  @verify_iat = false
  @verify_jti = false
  @verify_aud = false
  @verify_sub = false
  @leeway = 0
  @algorithms = ['HS256']
  @required_claims = []
end

Instance Attribute Details

#algorithmsArray<String>

Returns the list of acceptable algorithms.

Returns:

  • (Array<String>)

    the list of acceptable algorithms.



28
29
30
31
32
33
34
35
36
37
# File 'lib/jwt/configuration/decode_configuration.rb', line 28

attr_accessor :verify_expiration,
:verify_not_before,
:verify_iss,
:verify_iat,
:verify_jti,
:verify_aud,
:verify_sub,
:leeway,
:algorithms,
:required_claims

#leewayInteger

Returns the leeway in seconds for time-based claims.

Returns:

  • (Integer)

    the leeway in seconds for time-based claims.



28
29
30
31
32
33
34
35
36
37
# File 'lib/jwt/configuration/decode_configuration.rb', line 28

attr_accessor :verify_expiration,
:verify_not_before,
:verify_iss,
:verify_iat,
:verify_jti,
:verify_aud,
:verify_sub,
:leeway,
:algorithms,
:required_claims

#required_claimsArray<String>

Returns the list of required claims.

Returns:

  • (Array<String>)

    the list of required claims.



28
29
30
31
32
33
34
35
36
37
# File 'lib/jwt/configuration/decode_configuration.rb', line 28

attr_accessor :verify_expiration,
:verify_not_before,
:verify_iss,
:verify_iat,
:verify_jti,
:verify_aud,
:verify_sub,
:leeway,
:algorithms,
:required_claims

#verify_audBoolean

Returns whether to verify the audience claim.

Returns:

  • (Boolean)

    whether to verify the audience claim.



28
29
30
31
32
33
34
35
36
37
# File 'lib/jwt/configuration/decode_configuration.rb', line 28

attr_accessor :verify_expiration,
:verify_not_before,
:verify_iss,
:verify_iat,
:verify_jti,
:verify_aud,
:verify_sub,
:leeway,
:algorithms,
:required_claims

#verify_expirationBoolean

Returns whether to verify the expiration claim.

Returns:

  • (Boolean)

    whether to verify the expiration claim.



28
29
30
# File 'lib/jwt/configuration/decode_configuration.rb', line 28

def verify_expiration
  @verify_expiration
end

#verify_iatBoolean

Returns whether to verify the issued at claim.

Returns:

  • (Boolean)

    whether to verify the issued at claim.



28
29
30
31
32
33
34
35
36
37
# File 'lib/jwt/configuration/decode_configuration.rb', line 28

attr_accessor :verify_expiration,
:verify_not_before,
:verify_iss,
:verify_iat,
:verify_jti,
:verify_aud,
:verify_sub,
:leeway,
:algorithms,
:required_claims

#verify_issBoolean

Returns whether to verify the issuer claim.

Returns:

  • (Boolean)

    whether to verify the issuer claim.



28
29
30
31
32
33
34
35
36
37
# File 'lib/jwt/configuration/decode_configuration.rb', line 28

attr_accessor :verify_expiration,
:verify_not_before,
:verify_iss,
:verify_iat,
:verify_jti,
:verify_aud,
:verify_sub,
:leeway,
:algorithms,
:required_claims

#verify_jtiBoolean

Returns whether to verify the JWT ID claim.

Returns:

  • (Boolean)

    whether to verify the JWT ID claim.



28
29
30
31
32
33
34
35
36
37
# File 'lib/jwt/configuration/decode_configuration.rb', line 28

attr_accessor :verify_expiration,
:verify_not_before,
:verify_iss,
:verify_iat,
:verify_jti,
:verify_aud,
:verify_sub,
:leeway,
:algorithms,
:required_claims

#verify_not_beforeBoolean

Returns whether to verify the not before claim.

Returns:

  • (Boolean)

    whether to verify the not before claim.



28
29
30
31
32
33
34
35
36
37
# File 'lib/jwt/configuration/decode_configuration.rb', line 28

attr_accessor :verify_expiration,
:verify_not_before,
:verify_iss,
:verify_iat,
:verify_jti,
:verify_aud,
:verify_sub,
:leeway,
:algorithms,
:required_claims

#verify_subBoolean

Returns whether to verify the subject claim.

Returns:

  • (Boolean)

    whether to verify the subject claim.



28
29
30
31
32
33
34
35
36
37
# File 'lib/jwt/configuration/decode_configuration.rb', line 28

attr_accessor :verify_expiration,
:verify_not_before,
:verify_iss,
:verify_iat,
:verify_jti,
:verify_aud,
:verify_sub,
:leeway,
:algorithms,
:required_claims

Instance Method Details

#to_hObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/jwt/configuration/decode_configuration.rb', line 54

def to_h
  {
    verify_expiration: verify_expiration,
    verify_not_before: verify_not_before,
    verify_iss: verify_iss,
    verify_iat: verify_iat,
    verify_jti: verify_jti,
    verify_aud: verify_aud,
    verify_sub: verify_sub,
    leeway: leeway,
    algorithms: algorithms,
    required_claims: required_claims
  }
end