Keycloak.Claims (keycloak v1.1.0) View Source

A helper module for extracting claims from the %Joken.Token{}. In order to use these helpers, you must have the VerifyToken plug in your plug pipeline.

Example

Phoenix controller

def index(conn, _) do
  sub = Keycloak.Claims.get_claim(conn, "sub")

  conn
  |> put_session(:user, sub)
  |> render("index.html")
end

Link to this section Summary

Functions

Pulls given claim from the Joken token

Link to this section Functions

Link to this function

get_claim(claims, claim)

View Source

Specs

get_claim(Plug.Conn.t() | Joken.claims(), String.t()) :: String.t() | nil

Pulls given claim from the Joken token