Help us shape the future of Go! Take the 2026 Go Developer Survey

oidc

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 21, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthorizationCodeFlow

type AuthorizationCodeFlow struct {
	Client

	RedirectURI xurl.URL
	// contains filtered or unexported fields
}

AuthorizationCodeFlow is one run of the authorization code flow with PKCE.

func (AuthorizationCodeFlow) BrowserUrl

func (a AuthorizationCodeFlow) BrowserUrl() xurl.URL

func (AuthorizationCodeFlow) CheckState

func (a AuthorizationCodeFlow) CheckState(state string) error

func (AuthorizationCodeFlow) Exchange

func (a AuthorizationCodeFlow) Exchange(ctx context.Context, code string) (Token, error)

type Client

type Client struct {
	http.Client

	ClientConfig

	Id string
}

func NewClient

func NewClient(ctx context.Context, httpClient http.Client, issuer xurl.URL, clientId string) (Client, error)

func (Client) EndSession

func (c Client) EndSession(ctx context.Context, refreshToken string) error

func (Client) ExchangeAuthCode

func (c Client) ExchangeAuthCode(ctx context.Context, code string, redirectUri xurl.URL, verifier string) (resp Token, err error)

ExchangeAuthCode ends the authorization code flow, see AuthorizationCodeFlow.Exchange.

func (Client) NewAuthorizationCode

func (c Client) NewAuthorizationCode(redirectURI xurl.URL) AuthorizationCodeFlow

func (Client) Refresh

func (c Client) Refresh(ctx context.Context, refreshToken string, scopes scope.Scopes) (resp Token, err error)

type ClientConfig

type ClientConfig struct {
	Issuer                xurl.URL `json:"issuer"`
	AuthorizationEndpoint xurl.URL `json:"authorization_endpoint"`
	TokenEndpoint         xurl.URL `json:"token_endpoint"`
	// Both are optional in the discovery document, and either one ends a session.
	EndSessionEndpoint *xurl.URL `json:"end_session_endpoint"`
	RevocationEndpoint *xurl.URL `json:"revocation_endpoint"`
}

type Token

type Token struct {
	AccessToken  jwt.JWT `json:"access_token"`
	RefreshToken string  `json:"refresh_token"`
	Scope        string  `json:"scope"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL