Skip to content

Commit

Permalink
Update readme explaining key construction (#212)
Browse files Browse the repository at this point in the history
  • Loading branch information
cottinisimone authored Mar 11, 2024
1 parent 3fc10c1 commit 5c71e43
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ config :prima_auth0_ex, :clients, default_client: [
# Credentials on Auth0
client_id: "",
client_secret: "",
# Namespace for tokens of this client on the shared cache. Should be unique per client
# Namespace for tokens of this client on the shared cache. Should be unique per client.
cache_namespace: "my-client"
]
```
Expand Down Expand Up @@ -128,6 +128,15 @@ config :prima_auth0_ex, :redis,
ssl_allow_wildcard_certificates: false
```

Keep in mind that when saving the token, its value will be stored within a key generated through interpolation,
structured as `prima_auth0_ex_tokens:${cache_namespace}:${requested_audience}`. It's important to note that this
implementation detail could potentially be subject to change in the future.

In case a particular need emerges, you can develop a personalized iteration of the `EncryptedRedisTokenCache` by directly
applying the `PrimaAuth0Ex.TokenCache` behavior. This involves substituting the
`config :prima_auth0_ex, :token_cache, EncryptedRedisTokenCache` configuration with the newly crafted custom TokenCache
implementation.

#### Operational requirements

To cache tokens on Redis you'll need to generate a `cache_encryption_key`. This can be done either by running `mix keygen` or by using the following snippet:
Expand Down

0 comments on commit 5c71e43

Please sign in to comment.