Auctoritas v0.9.1 Auctoritas.Config View Source
Link to this section Summary
Link to this section Types
Link to this type
expiration()
View Source
expiration()
View Source
expiration() :: non_neg_integer()
expiration() :: non_neg_integer()
Link to this type
t()
View Source
t()
View Source
t() :: %Auctoritas.Config{
data_storage: module(),
expiration: expiration(),
name: String.t(),
refresh_token_expiration: expiration(),
token_manager: module(),
token_type: :static | :sliding | :refresh_token
}
t() :: %Auctoritas.Config{ data_storage: module(), expiration: expiration(), name: String.t(), refresh_token_expiration: expiration(), token_manager: module(), token_type: :static | :sliding | :refresh_token }
Link to this section Functions
Link to this function
new(options \\ []) View Source
Create new config for Auctoritas
Arguments:
- secret_key: Secret key to use when generating authentication tokens.
- data_storage: Data storage module to save data and manage authentication tokens. (DEFAULT value exists)
- token_manager: Token manager module to generate and read tokens. (DEFAULT value exists)
Examples
iex> Auctoritas.Config.new()
%Auctoritas.Config{
name: "auctoritas_default",
data_storage: Auctoritas.AuthenticationManager.CachexDataStorage,
token_manager: Auctoritas.AuthenticationManager.DefaultTokenManager,
token_type: :sliding,
expiration: 60 * 60 * 24, # 1 day
refresh_token_expiration: 60 * 60 * 24 * 3 # 3 days
}
iex> Auctoritas.Config.new(name: "custom_name")
%Auctoritas.Config{
name: "custom_name",
data_storage: Auctoritas.AuthenticationManager.CachexDataStorage,
token_manager: Auctoritas.AuthenticationManager.DefaultTokenManager,
token_type: :sliding,
expiration: 60 * 60 * 24, # 1 day
refresh_token_expiration: 60 * 60 * 24 * 3 # 3 days
}
Link to this function