nova_auth_oidc_controller (nova_auth_oidc v0.1.3)

View Source

Nova controller for OpenID Connect authentication flows.

Handles login redirect and OAuth callback endpoints. After successful authentication, stores a mapped actor in the Nova session via nova_auth_actor, making it compatible with nova_auth_security.

Routes

#{prefix => ~"/auth", security => false,
  routes => [
      {~"/:provider/login", fun nova_auth_oidc_controller:login/1,
       #{auth_mod => my_oidc_config}},
      {~"/:provider/callback", fun nova_auth_oidc_controller:callback/1,
       #{auth_mod => my_oidc_config}}
  ]}

Summary

Functions

Handle the OAuth callback after the user authenticates with the provider.

Initiate OIDC login by redirecting to the provider's authorization endpoint.

Functions

callback/1

-spec callback(map()) -> term().

Handle the OAuth callback after the user authenticates with the provider.

Exchanges the authorization code for tokens, retrieves user info, applies claims mapping, stores the actor in the session, and redirects to the configured success URL.

login/1

-spec login(map()) -> term().

Initiate OIDC login by redirecting to the provider's authorization endpoint.

Generates nonce and PKCE verifier, stores them in the session, and redirects the user to the provider.