# `Backplane.Oauth.Openid.Application`
[🔗](https://github.com/gsmlg-opt/backplane/blob/v1.10.77/apps/backplane_oauth/lib/backplane/oauth/openid/application.ex#L1)

Implement this behaviour in the application layer of your OpenID Connect provider.
This behaviour gives all callbacks triggered invoking `Backplane.Oauth.Openid` module functions.

> __Note__: This behaviour is split into `Backplane.Oauth.Openid.JwksApplication` and `Backplane.Oauth.Openid.UserinfoApplication` providing utilities to implement the different OpenID Connect endpoints independently.

# `client_registered`

```elixir
@callback client_registered(conn :: Plug.Conn.t(), client :: Backplane.Oauth.Client.t()) ::
  any()
```

This function will be triggered when request is unauthorized invoking `Backplane.Oauth.Openid.register_client/3`

# `jwk_list`

```elixir
@callback jwk_list(
  conn :: Plug.Conn.t(),
  jwk_keys :: [%JOSE.JWK{fields: term(), keys: term(), kty: term()}]
) :: any()
```

This function will be triggered in case of success invoking `Backplane.Oauth.Openid.jwks/2`

# `registration_failure`

```elixir
@callback registration_failure(conn :: Plug.Conn.t(), changeset :: Ecto.Changeset.t()) ::
  any()
```

This function will be triggered when request is unauthorized invoking `Backplane.Oauth.Openid.register_client/3`

# `unauthorized`

```elixir
@callback unauthorized(conn :: Plug.Conn.t(), error :: Backplane.Oauth.Error.t()) :: any()
```

This function will be triggered when request is unauthorized invoking `Backplane.Oauth.Openid.userinfo/2`

# `userinfo_fetched`

```elixir
@callback userinfo_fetched(conn :: Plug.Conn.t(), userinfo :: map()) :: any()
```

This function will be triggered in case of success invoking `Backplane.Oauth.Openid.userinfo/2`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
