Class: SolidusJwt::Preferences

Inherits:
Spree::Preferences::Configuration
  • Object
show all
Defined in:
lib/solidus_jwt/preferences.rb

Instance Attribute Summary collapse

Instance Attribute Details

#allow_spree_api_keyString

Returns Allow spree_api_key to still be used. (default true).

Returns:

  • (String)

    Allow spree_api_key to still be used. (default true)



17
# File 'lib/solidus_jwt/preferences.rb', line 17

preference :allow_spree_api_key, :boolean, default: true

#jwt_algorithmString

Returns The hashing algorithm to use. (default ‘HS256’).

Returns:

  • (String)

    The hashing algorithm to use. (default ‘HS256’)



24
# File 'lib/solidus_jwt/preferences.rb', line 24

preference :jwt_algorithm, :string, default: 'HS256'

#jwt_expirationString

(default: 3600)

Returns:

  • (String)

    How long until the token expires in seconds.



30
# File 'lib/solidus_jwt/preferences.rb', line 30

preference :jwt_expiration, :integer, default: 3600

#jwt_optionsString

when creating the jwt payload. (default: ‘{ only: %i[email first_name id last_name] }`)

Returns:

  • (String)

    The options to pass into ‘Spree::User#as_json` when



37
# File 'lib/solidus_jwt/preferences.rb', line 37

preference :jwt_options, :hash, default: { only: %i[email first_name id last_name] }

#jwt_secretString

Get the secret token to encrypt json web tokens with.

Returns:

  • (String)

    The secret used to encrypt json web tokens



50
51
52
53
# File 'lib/solidus_jwt/preferences.rb', line 50

def jwt_secret
  # Account for different rails versions
  @jwt_secret ||= ENV['SECRET_KEY_BASE'] || Rails.application.secret_key_base
end

#refresh_expriationString

(default: 2592000)

Returns:

  • (String)

    How long until the refresh token expires in seconds



43
# File 'lib/solidus_jwt/preferences.rb', line 43

preference :refresh_expiration, :integer, default: 2_592_000