OpenmaizeJWT v0.10.0 OpenmaizeJWT.Config

This module provides an abstraction layer for configuration.

The following are valid configuration items.

nametypedefault
token_algatom:sha512
token_validityint120 (minutes)
token_datalist%{}
keyrotate_daysint28

Examples

The simplest way to change the default values would be to add an openmaize_jwt entry to the config.exs file in your project, like the following example.

config :openmaize_jwt,
  token_alg: :sha256,
  token_validity: 60,
  token_data: %{iss: "www.example.com"},
  keyrotate_days: 7

Summary

Functions

The algorithm used to sign the token

The number of days after which the JWT signing keys will be rotated

Additional information to be added to the token

The length of time after which a JSON Web Token expires

Functions

get_token_alg()

The algorithm used to sign the token.

The default value is :sha512, and :sha256 is also supported.

keyrotate_days()

The number of days after which the JWT signing keys will be rotated.

token_data()

Additional information to be added to the token.

This is a map with atoms as keys. The default is an empty map.

Warning

Do not include any sensitive data in the JSON Web Token.

token_validity()

The length of time after which a JSON Web Token expires.

The default length of time is 120 minutes (2 hours).