oauth2

package
v1.13.2 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2025 License: MIT Imports: 21 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) (*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) (*Client, error)

func (*Client) GetTokenResponse

func (c *Client) GetTokenResponse(ctx context.Context, formParams url.Values) (map[string]interface{}, string, 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