oauth2

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Base64urlSha256

func Base64urlSha256(value string) string

Base64urlSha256 creates a base64url encoded sha256 hash of the given input string.

Types

type AuthCodeClient

type AuthCodeClient struct {
	*Client
	// contains filtered or unexported fields
}

AuthCodeClient represents an OAuth2 client using the (plain) authorization code flow.

func NewAuthCodeClient

func NewAuthCodeClient(evalCtx *hcl.EvalContext, acClientConf config.OAuth2AcClient, oauth2AsConf config.OAuth2AS, backend http.RoundTripper, name string) (*AuthCodeClient, error)

NewAuthCodeClient creates a new OAuth2 Authorization Code client.

func (*AuthCodeClient) ExchangeCodeAndGetTokenResponse

func (a *AuthCodeClient) ExchangeCodeAndGetTokenResponse(req *http.Request, callbackURL *url.URL) (map[string]interface{}, error)

ExchangeCodeAndGetTokenResponse exchanges the authorization code and retrieves the response from the token endpoint.

type AuthCodeFlowClient

type AuthCodeFlowClient interface {
	// ExchangeCodeAndGetTokenResponse exchanges the authorization code and retrieves the response from the token endpoint.
	ExchangeCodeAndGetTokenResponse(req *http.Request, callbackURL *url.URL) (map[string]interface{}, error)
}

AuthCodeFlowClient represents an OAuth2 client using the authorization code flow.

type Client

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

Client represents an OAuth2 client.

func NewClient

func NewClient(evalCtx *hcl.EvalContext, grantType string, asConfig config.OAuth2AS, clientConfig config.OAuth2Client, backend http.RoundTripper, name string) (*Client, error)

func (*Client) GetTokenResponse

func (c *Client) GetTokenResponse(ctx context.Context, formParams url.Values) (map[string]interface{}, string, error)

type ClientAuthenticator added in v1.14.0

type ClientAuthenticator interface {
	Authenticate(formParams *url.Values, req *http.Request) error
}

ClientAuthenticator is a component that authenticates OAuth2 token or introspection requests,

func NewClientAuthenticator added in v1.14.0

func NewClientAuthenticator(evalCtx *hcl.EvalContext, authMethod *string, endpointAttrName, clientID, clientSecret, aud string, jwtSigningProfile *config.JWTSigningProfile) (ClientAuthenticator, error)

NewClientAuthenticator creates a new ClientAuthenticator.

type CsbClientAuthenticator added in v1.14.0

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

func (*CsbClientAuthenticator) Authenticate added in v1.14.0

func (ca *CsbClientAuthenticator) Authenticate(formParams *url.Values, req *http.Request) error

type CspClientAuthenticator added in v1.14.0

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

func (*CspClientAuthenticator) Authenticate added in v1.14.0

func (ca *CspClientAuthenticator) Authenticate(formParams *url.Values, req *http.Request) error

type JwtClientAuthenticator added in v1.14.0

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

func (*JwtClientAuthenticator) Authenticate added in v1.14.0

func (ca *JwtClientAuthenticator) Authenticate(formParams *url.Values, req *http.Request) error

type OidcClient

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

OidcClient represents an OpenID Connect client using the authorization code flow.

func NewOidcClient

func NewOidcClient(evalCtx *hcl.EvalContext, oidcConfig *oidc.Config) (*OidcClient, error)

NewOidcClient creates a new OIDC client.

func (*OidcClient) ExchangeCodeAndGetTokenResponse

func (o *OidcClient) ExchangeCodeAndGetTokenResponse(req *http.Request, callbackURL *url.URL) (map[string]interface{}, error)

ExchangeCodeAndGetTokenResponse exchanges the authorization code and retrieves the response from the token endpoint if the ID token is valid.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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