View Source Gamora.Cache.Userinfo (gamora v0.13.0)

This module that allows to get, set and fetch user's claims in the cache in order to improve performance.

Link to this section Summary

Functions

Deletes introspect cache for the given access token.

Returns introspect data for the given access token if exists, otherwise it will fetch it and store it.

Returns introspect data for the given access token.

Stores introspect data for the given access token.

Link to this section Functions

@spec del(access_token :: String.t()) :: {:ok, map()}

Deletes introspect cache for the given access token.

parameters

Parameters

  • access_token: String [Access token from IDP].

examples

Examples

iex> del("ACCESS_TOKEN")
{:ok, true}
@spec fetch(access_token :: String.t()) :: {:ok, map()} | {:error, term()}

Returns introspect data for the given access token if exists, otherwise it will fetch it and store it.

parameters

Parameters

  • access_token: String [Access token from IDP].

examples

Examples

iex> fetch("ACCESS_TOKEN")
{:ok, %{"active" => true, ...}}
@spec get(access_token :: String.t()) :: {:ok, nil} | {:ok, map()}

Returns introspect data for the given access token.

parameters

Parameters

  • access_token: String [Access token from IDP].

examples

Examples

iex> get("ACCESS_TOKEN")
{:ok, nil}

iex> get("ACCESS_TOKEN")
{:ok, %{"active" => true, ...}}
@spec put(access_token :: String.t(), data :: map()) :: {:ok, map()}

Stores introspect data for the given access token.

parameters

Parameters

  • access_token: String [Access token from IDP].

examples

Examples

iex> put("ACCESS_TOKEN", %{"active" => true, ...})
{:ok, %{"active" => true, ...}}