oidc

package
v0.0.0-pre.4 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2025 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrOIDCExpired = fmt.Errorf("OIDC token expired, please re-try the request")

ErrOIDCExpired is returned when the token is expired and we can't retry the request ourselves.

Functions

This section is empty.

Types

type OidcClient

type OidcClient struct {
	// contains filtered or unexported fields
}

OidcClient is a structure encapsulating an HTTP client, OIDC transport, and a token for OpenID Connect (OIDC) operations.

func NewOIDCClient

func NewOIDCClient(tokensFile string, serverCert *x509.Certificate) *OidcClient

NewOIDCClient constructs a new OidcClient, ensuring the token field is non-nil to prevent panics during authentication.

func (*OidcClient) Do

func (o *OidcClient) Do(req *http.Request) (*http.Response, error)

Do function executes an HTTP request using the OidcClient's http client, and manages authorization by refreshing or authenticating as needed. If the request fails with an HTTP Unauthorized status, it attempts to refresh the access token, or perform an OIDC authentication if refresh fails.

func (*OidcClient) FetchNewIncusTokenURL

func (o *OidcClient) FetchNewIncusTokenURL(req *http.Request) (string, *oidc.DeviceAuthorizationResponse, rp.RelyingParty, error)

func (*OidcClient) GetAccessToken

func (o *OidcClient) GetAccessToken() string

GetAccessToken returns the Access Token from the OidcClient's tokens, or an empty string if no tokens are present.

func (*OidcClient) GetOIDCTokens

func (o *OidcClient) GetOIDCTokens() *oidc.Tokens[*oidc.IDTokenClaims]

GetOIDCTokens returns the current OIDC tokens, if any.

func (*OidcClient) WaitForToken

func (o *OidcClient) WaitForToken(resp *oidc.DeviceAuthorizationResponse, provider rp.RelyingParty) error

Jump to

Keyboard shortcuts

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