View Source oidcc_token_introspection (Oidcc v3.0.0-alpha.4)

OAuth Token Introspection

See https://datatracker.ietf.org/doc/html/rfc7662

records

Records

To use the records, import the definition:

  -include_lib(["oidcc/include/oidcc_token_introspection.hrl"]).

telemetry

Telemetry

See 'Elixir.Oidcc.TokenIntrospection'

Link to this section Summary

Types

t/0

Introspection Result

Functions

Introspect the given access token

Link to this section Types

-type error() :: client_id_mismatch | introspection_not_supported | oidcc_http_util:error().
-type opts() :: #{request_opts => oidcc_http_util:request_opts()}.
-type t() ::
    #oidcc_token_introspection{active :: boolean(),
                               client_id :: binary(),
                               exp :: pos_integer(),
                               scope :: oidcc_scope:scopes(),
                               username :: binary()}.

Introspection Result

See https://datatracker.ietf.org/doc/html/rfc7662#section-2.2

Link to this section Functions

Link to this function

introspect(Token, ClientContext, Opts)

View Source
-spec introspect(Token, ClientContext, Opts) -> {ok, t()} | {error, error()}
              when
                  Token :: oidcc_token:t() | binary(),
                  ClientContext :: oidcc_client_context:t(),
                  Opts :: opts().

Introspect the given access token

For a high level interface using oidcc_provider_configuration_worker see oidcc:introspect_token/5.

examples

Examples

  {ok, ClientContext} =
    oidcc_client_context:from_configuration_worker(provider_name,
                                                   <<"client_id">>,
                                                   <<"client_secret">>),
 
  %% Get AccessToken
 
  {ok, #oidcc_token_introspection{active = True}} =
    oidcc_token_introspection:introspect(AccessToken, ClientContext, #{}).