Skip to main content

Module oauth

Module oauth 

Source
Expand description

Generic OAuth2 provider support.

Config-driven: no provider-specific code branches. Any OAuth2 provider (GitHub, GitLab, Gitea, OIDC-compatible) can be added via configuration.

This module contains only types, URL builders, and JSON parsing. No HTTP calls or DB access — those live in the backend adapters.

Structs§

AuthProvidersResponse
Available auth providers (returned by GET /api/auth/providers).
LinkedProvider
A linked OAuth provider shown in user settings.
OAuthFieldMap
Maps provider-specific JSON field names to our internal fields.
OAuthProviderConfig
OAuth2 provider configuration. Loaded from environment variables or config file.
OAuthProviderInfo
Public info about an OAuth provider.
OAuthUserInfo
Normalized user info extracted from any OAuth provider’s userinfo response.

Functions§

build_authorize_url
Build the OAuth authorize URL that the user’s browser should be redirected to.
build_token_request_body
Build the JSON body for the token exchange request.
extract_user_info
Extract normalized user info from a provider’s userinfo JSON response.
github_preset
Create a GitHub OAuth2 provider config. Only needs client credentials.
gitlab_preset
Create a GitLab OAuth2 provider config for a given instance URL.