Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MockOpenIDTestUserInteraction ¶
func MockOpenIDTestUserInteraction(ctx context.Context, pro OpenIDClientAppParams, username, password string) (string, string, string, error)
MockOpenIDTestUserInteraction - tries to login to dex using provided credentials. It performs the user's browser interaction to login and retrieves the auth code from dex and exchanges it for a JWT.
func ParseSignedCredentials ¶ added in v3.4.1
func ParseSignedCredentials(tokenString, reqID string) (credentials.Value, error)
ParseSignedCredentials parses a base64-encoded JWT token string and returns the credentials Value if valid.
Types ¶
type CLILoginClaims ¶ added in v3.4.1
type CLILoginClaims struct {
// contains filtered or unexported fields
}
CLILoginClaims holds the claims for CLI login tokens.
func NewCLILoginClaims ¶ added in v3.4.1
func NewCLILoginClaims(port int, reqID string) *CLILoginClaims
NewCLILoginClaims creates a new CLILoginClaims with the given port and request ID.
func ParseCLILoginClaims ¶ added in v3.4.1
func ParseCLILoginClaims(tokenString, secret string) (*CLILoginClaims, error)
ParseCLILoginClaims parses a base64-encoded JWT token string and returns the CLILoginClaims if valid.
func (*CLILoginClaims) Port ¶ added in v3.4.1
func (c *CLILoginClaims) Port() int
Port returns the port from the CLI login claims.
func (*CLILoginClaims) SignCredentials ¶ added in v3.4.1
func (c *CLILoginClaims) SignCredentials(creds credentials.Value) (string, error)
SignCredentials signs the given credentials using the request ID as the secret and returns a base64-encoded JWT token string.
func (*CLILoginClaims) ToTokenString ¶ added in v3.4.1
func (c *CLILoginClaims) ToTokenString(secret string) (string, error)
ToTokenString serializes the CLILoginClaims to a base64-encoded JWT token string signed with the given secret.
type CallbackServer ¶ added in v3.4.2
type CallbackServer struct {
// contains filtered or unexported fields
}
CallbackServer represents a local HTTP server that handles OAuth callback redirects.
func NewCallbackServer ¶ added in v3.4.2
func NewCallbackServer(ctx context.Context) (*CallbackServer, error)
NewCallbackServer creates and starts a new callback server on a random available port. The server will be automatically shut down when the provided context is canceled.
func (*CallbackServer) GetLoginURL ¶ added in v3.4.2
func (cs *CallbackServer) GetLoginURL(ctx context.Context, client reqClient, configName string) (string, error)
GetLoginURL retrieves the OpenID login URL from the server using the anonymous client.
func (*CallbackServer) WaitForCredentials ¶ added in v3.4.2
func (cs *CallbackServer) WaitForCredentials(ctx context.Context) (credentials.Value, error)
WaitForCredentials waits for credentials to be received via the callback or for an error/timeout.
type OpenIDClientAppParams ¶
type OpenIDClientAppParams struct {
ClientID, ClientSecret, ProviderURL, RedirectURL string
Transport http.RoundTripper
Debug bool
}
OpenIDClientAppParams - contains openID client application params, used in testing.