library

package
v0.0.3-0...-cb20eca Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2025 License: Apache-2.0 Imports: 52 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddGitlabIDP

func AddGitlabIDP(
	t *testing.T,
	kubeconfig *rest.Config,
) (idpURL, idpName string, cleanups []func())

func CAOE2ETestLabels

func CAOE2ETestLabels() map[string]string

labels for listing/deleting stuff by hand, e.g. NS or simple openshift-config NS CMs and Secrets cleanup

func CleanIDPConfigByName

func CleanIDPConfigByName(t *testing.T, configClient configv1client.OAuthInterface, idpName string)

func GenerateOAuthTokenPair

func GenerateOAuthTokenPair() (privToken, pubToken string)

GenerateOAuthTokenPair returns two tokens to use with OpenShift OAuth-based authentication. The first token is a private token meant to be used as a Bearer token to send queries to the API, the second token is a hashed token meant to be stored in the database.

func GetIDPByName

func GetIDPByName(config *osinv1.OsinServerConfig, name string) *osinv1.IdentityProvider

GetIDPByName returns a pointer to a copy of the identity provider of a name from the config.

func GitLabClientFor

func GitLabClientFor(t *testing.T, transport http.RoundTripper, gitlabURL string) *gitlabClient

func GrabOAuthServerConfig

func GrabOAuthServerConfig(cmClient corev1client.ConfigMapsGetter) (*osinv1.OsinServerConfig, error)

GrabOAuthServerConfig grabs the oauth-server configuration from the openshift-authenticat/v4-0-config-system-cliconfig configmap

func IDPCleanupWrapper

func IDPCleanupWrapper(cleanup func()) func()

func NewClientConfigForTest

func NewClientConfigForTest(t *testing.T) *rest.Config

NewClientConfigForTest returns a config configured to connect to the api server

func NewTestNamespaceBuilder

func NewTestNamespaceBuilder(namePrefix string) *testNamespaceBuilder

func SyncDefaultIngressCAToConfig

func SyncDefaultIngressCAToConfig(t *testing.T, cmClient corev1client.ConfigMapsGetter, name string) func()

SyncDefaultIngressCAToConfig synchronizes the openshift-config-managed/default-ingress-cert to the openshift-config NS as a CA suited for an IdP configuration. Useful when deploying an IDP behind a reencrypt/edge-termination route. Returns a cleanup function for the CM.

func WaitForClusterOperatorAvailableNotProgressingNotDegraded

func WaitForClusterOperatorAvailableNotProgressingNotDegraded(t *testing.T, client configv1client.ConfigV1Interface, name string) error

func WaitForClusterOperatorDegraded

func WaitForClusterOperatorDegraded(t *testing.T, client configv1client.ConfigV1Interface, name string) error

func WaitForClusterOperatorProgressing

func WaitForClusterOperatorProgressing(t *testing.T, client configv1client.ConfigV1Interface, name string) error

func WaitForClusterOperatorStatus

func WaitForClusterOperatorStatus(t *testing.T, client configv1client.ConfigV1Interface, name string, requiredConditions ...configv1.ClusterOperatorStatusCondition) error

func WaitForClusterOperatorStatusAlwaysAvailable

func WaitForClusterOperatorStatusAlwaysAvailable(t *testing.T, ctx context.Context, client configv1client.ConfigV1Interface, name string) error

func WaitForClusterOperatorStatusStable

func WaitForClusterOperatorStatusStable(t *testing.T, ctx context.Context, client configv1client.ConfigV1Interface, name string, requiredConditions ...configv1.ClusterOperatorStatusCondition) error

WaitForClusterOperatorStatusStable checks that the specified cluster operator's status does not diverge from the conditions specified for 10 minutes. It returns nil if all conditions were matching expectations for that period, and an error otherwise.

func WaitForHTTPStatus

func WaitForHTTPStatus(t *testing.T, waitDuration time.Duration, client *http.Client, targetURL string, expectedStatus int) error

func WaitForNewKASRollout

func WaitForNewKASRollout(t *testing.T, ctx context.Context, kasClient operatorv1client.KubeAPIServerInterface, origRevision int32) error

func WaitForOperatorToPickUpChanges

func WaitForOperatorToPickUpChanges(t *testing.T, configClient configv1client.ConfigV1Interface, name string) error

func WaitForRouteAdmitted

func WaitForRouteAdmitted(t *testing.T, client routev1client.RouteV1Interface, name, ns string) (string, error)

Types

type CryptoMaterials

type CryptoMaterials struct {
	PrivateKey  *rsa.PrivateKey
	Certificate *x509.Certificate
}

func NewCertificateAuthorityCertificate

func NewCertificateAuthorityCertificate(t *testing.T, parent *CryptoMaterials) *CryptoMaterials

NewCertificateAuthorityCertificate returns crypto materials for a certificate authority. If no parent certificate is specified, the generated certificate will be self-signed.

func NewServerCertificate

func NewServerCertificate(t *testing.T, signer *CryptoMaterials, hosts ...string) *CryptoMaterials

NewServerCertificate returns crypto materials suitable for use by a server. The hosts specified will be added as subject alternate names.

type KeycloakClient

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

func AddKeycloakIDP

func AddKeycloakIDP(
	t *testing.T,
	kubeconfig *rest.Config,
	directOIDC bool,
) (kcClient *KeycloakClient, idpName string, cleanups []func())

func KeycloakClientFor

func KeycloakClientFor(t *testing.T, transport http.RoundTripper, keycloakURL, keycloakRealm string) *KeycloakClient

KeycloakClientFor creates a Keycloak REST client for the default (master) realm using the supplied transport

func (*KeycloakClient) AdminURL

func (kc *KeycloakClient) AdminURL() string

func (*KeycloakClient) AuthenticatePassword

func (kc *KeycloakClient) AuthenticatePassword(clientID, clientSecret, name, password string) error

func (*KeycloakClient) CreateClientGroupMapper

func (kc *KeycloakClient) CreateClientGroupMapper(clientId, mapperName, groupsClaimName string) error

func (*KeycloakClient) CreateGroup

func (kc *KeycloakClient) CreateGroup(groupName string) error

func (*KeycloakClient) CreateUser

func (kc *KeycloakClient) CreateUser(username, email, password string, groups []string, extraFields map[string]string) error

func (*KeycloakClient) DeleteUserFromGroups

func (kc *KeycloakClient) DeleteUserFromGroups(userId string, groupIds ...string) error

func (*KeycloakClient) GetClient

func (kc *KeycloakClient) GetClient(id string) (map[string]interface{}, error)

GetClient retrieves a client based on its id (NOTE: id != clientID)

func (*KeycloakClient) GetClientByClientID

func (kc *KeycloakClient) GetClientByClientID(clientID string) (map[string]interface{}, error)

func (*KeycloakClient) GetUser

func (kc *KeycloakClient) GetUser(id string) (map[string]interface{}, error)

func (*KeycloakClient) IssuerURL

func (kc *KeycloakClient) IssuerURL() string

func (*KeycloakClient) ListClients

func (kc *KeycloakClient) ListClients() ([]map[string]interface{}, error)

GetClient retrieves a client based on its id (NOTE: id != name)

func (*KeycloakClient) ListUserGroups

func (kc *KeycloakClient) ListUserGroups(id string) ([]map[string]interface{}, error)

func (*KeycloakClient) ListUsers

func (kc *KeycloakClient) ListUsers() ([]map[string]interface{}, error)

func (*KeycloakClient) RegenerateClientSecret

func (kc *KeycloakClient) RegenerateClientSecret(id string) (string, error)

func (*KeycloakClient) TokenURL

func (kc *KeycloakClient) TokenURL() string

func (*KeycloakClient) Tokens

func (kc *KeycloakClient) Tokens() (accessToken, idToken string)

func (*KeycloakClient) UpdateClient

func (kc *KeycloakClient) UpdateClient(id string, changedFields map[string]interface{}) error

func (*KeycloakClient) UpdateClientAccessTokenTimeout

func (kc *KeycloakClient) UpdateClientAccessTokenTimeout(id string, timeout int32) error

UpdateClientAccessTokenTimeout updates the timeout for a client of the given id timeout is a timeout in seconds

func (*KeycloakClient) UpdateClientDirectAccessGrantsEnabled

func (kc *KeycloakClient) UpdateClientDirectAccessGrantsEnabled(id string, allow bool) error

UpdateClientDirectAccessGrantsEnabled updates the `directAccessGrantsEnabled` attribute of the client which influences whether the password grant is allowed via the client or not

func (*KeycloakClient) UpdateUser

func (kc *KeycloakClient) UpdateUser(id string, changes map[string]interface{}) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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