Sha256: e49080ed7ee020176ced0dc8912a7a5711c0d497d38a54a81575a12df15d2a92

Contents?: true

Size: 902 Bytes

Versions: 1

Compression:

Stored size: 902 Bytes

Contents

module JWTKeeper
  class Configuration < OpenStruct
    DEFAULTS = {
      algorithm:       'HS512',
      secret:           nil,
      expiry:           24.hours,
      issuer:           'api.example.com',
      audience:         'example.com',
      redis_connection: nil,
      version:          nil
    }.freeze

    # Creates a new Configuration from the passed in parameters
    # @param params [Hash] configuration options
    # @return [Configuration]
    def initialize(params = {})
      super(DEFAULTS.merge(params))
    end

    # @!visibility private
    def base_claims
      {
        iss: JWTKeeper.configuration.issuer,               # issuer
        aud: JWTKeeper.configuration.audience,             # audience
        exp: JWTKeeper.configuration.expiry.from_now.to_i, # expiration time
        ver: JWTKeeper.configuration.version               # Version
      }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jwt_keeper-2.0.0 lib/jwt_keeper/configuration.rb