Discover Packages
github.com/fromforgesoftware/forge/go/kit
auth
oidc
package
Version:
v0.6.0
Opens a new window with list of versions in this module.
Published: Jun 1, 2026
License: MIT
Opens a new window with license information.
Imports: 14
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
Documentation
¶
Package oidc is a minimal OIDC *client*: discovery, an authorization-code +
PKCE redirect, code→token exchange, and ID-token verification. It is the
shared client used when a forge service signs users in via an external IdP
(or another forge service acting as the IdP).
func Challenge(verifier string) string
func NewVerifier() (string, error)
func RandomState() (string, error)
type Claims
type Client
func (c *Client) AuthCodeURL(ctx context.Context, redirectURI, state, codeChallenge string) (string, error)
func (c *Client) Exchange(ctx context.Context, redirectURI, code, codeVerifier string) (Tokens, error)
func (c *Client) VerifyIDToken(ctx context.Context, rawIDToken string) (Claims, error)
type HTTPDoer
type Provider
type Tokens
Challenge is the S256 code_challenge for a verifier.
NewVerifier returns a high-entropy PKCE code_verifier.
RandomState returns an opaque CSRF state value.
Claims is the identity extracted from a verified ID token.
Client is an OIDC relying-party for one Provider, caching discovery + JWKS.
AuthCodeURL builds the authorization-code + PKCE redirect to the IdP.
Exchange swaps an authorization code for tokens (PKCE; public or confidential).
VerifyIDToken validates the ID token's signature against the IdP's JWKS and
its issuer/audience, returning the identity claims.
HTTPDoer is the request surface (so tests can stub it).
Provider is the static config for one IdP.
type Tokens struct {
AccessToken string `json:"access_token"`
IDToken string `json:"id_token"`
RefreshToken string `json:"refresh_token"`
TokenType string `json:"token_type"`
}
Tokens is the token endpoint response we care about.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.