class LpTokenAuth::Config

`LpTokenAuth::Config` manages the configuration options for the token. These can be set with the initializer provided with the generator.

Constants

DEFAULT_VALUES

Provides default values to token options

Attributes

algorithm[RW]

Creates virtual attributes for configuration options:

  • `algorithm` is a string corresponding to token encryption algorithm to use

  • `expires` is an integer corresponding to the number of hours that the token is active

  • `secret` is a string corresponding to the secret key used when encrypting the token

  • `token_transport` is a string indicating where to include the token in the HTTP response

expires[RW]

Creates virtual attributes for configuration options:

  • `algorithm` is a string corresponding to token encryption algorithm to use

  • `expires` is an integer corresponding to the number of hours that the token is active

  • `secret` is a string corresponding to the secret key used when encrypting the token

  • `token_transport` is a string indicating where to include the token in the HTTP response

secret[RW]

Creates virtual attributes for configuration options:

  • `algorithm` is a string corresponding to token encryption algorithm to use

  • `expires` is an integer corresponding to the number of hours that the token is active

  • `secret` is a string corresponding to the secret key used when encrypting the token

  • `token_transport` is a string indicating where to include the token in the HTTP response

token_transport[RW]

Creates virtual attributes for configuration options:

  • `algorithm` is a string corresponding to token encryption algorithm to use

  • `expires` is an integer corresponding to the number of hours that the token is active

  • `secret` is a string corresponding to the secret key used when encrypting the token

  • `token_transport` is a string indicating where to include the token in the HTTP response

Public Instance Methods

get_option(key) click to toggle source

Retrieves value for token option, either as set by the application, or the default @param [Symbol] key the token option name @raise [LpTokenAuth::Error] if the option has not been set by the application and a default value does not exist @return [String,Integer] the value of the token option

# File lib/lp_token_auth/config.rb, line 25
def get_option(key)
  option = send(key) || DEFAULT_VALUES[key]
  raise LpTokenAuth::Error "Missing config option value: #{ key }" unless option
  option
end