testutils

package
v2.0.0-...-0ca6ac5 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddHandler

func AddHandler(pathMatcher func(string) bool, handler func(http.ResponseWriter, *http.Request))

func AddMockCertsEndpointHandler

func AddMockCertsEndpointHandler()

func AuthHeaderValue

func AuthHeaderValue(token string) string

func ClearHandlers

func ClearHandlers()

func Contains

func Contains(submatch string) func(string) bool

func GetMainSigningKey

func GetMainSigningKey() rsa.PrivateKey

func GetMockServerClient

func GetMockServerClient() *fasthttp.Client

func GetMockServerUrl

func GetMockServerUrl() string

func GetSignedToken

func GetSignedToken(principal string, roles []string) string

func GetSignedTokenWithClaims

func GetSignedTokenWithClaims(principal string, roles []string, claims map[string]interface{}) string

func GetTestToken

func GetTestToken(principal string, roles []string) *jwt.Token

func GetTestTokenWithClaims

func GetTestTokenWithClaims(principal string, roles []string, claims map[string]interface{}) *jwt.Token

func SignToken

func SignToken(token *jwt.Token, kid string) (string, error)

func StartMockServer

func StartMockServer()

func StopMockServer

func StopMockServer()

Types

type CertResponse

type CertResponse struct {
	Keys []CertResponseKey `json:"keys"`
}

type CertResponseKey

type CertResponseKey struct {
	Kid string `json:"kid"`
	Kty string `json:"kty"`
	Alg string `json:"alg"`
	Use string `json:"use"`
	N   string `json:"n"`
	E   string `json:"e"`
}

CertResponseKey is returned by the certs endpoint

type OidcResponse

type OidcResponse struct {
	JwksUri string `json:"jwks_uri"`
}

Jump to

Keyboard shortcuts

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