fixtures

package module
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2026 License: BSD-3-Clause-Clear Imports: 12 Imported by: 2

README

Internal Module

These modules are used by other http://github.com/opentdf/ projects, and are not intended for use elsewhere.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetupCustomKeycloak added in v0.2.0

func SetupCustomKeycloak(ctx context.Context, kcParams KeycloakConnectParams, keycloakData KeycloakData) error

func SetupCustomKeycloakWithConfig added in v0.5.0

func SetupCustomKeycloakWithConfig(ctx context.Context, kcParams KeycloakConnectParams, keycloakData KeycloakData, tmConfig *TokenManagerConfig) error

func SetupKeycloak

func SetupKeycloak(ctx context.Context, kcConnectParams KeycloakConnectParams) error

func SetupKeycloakWithConfig added in v0.5.0

func SetupKeycloakWithConfig(ctx context.Context, kcConnectParams KeycloakConnectParams, tmConfig *TokenManagerConfig) error

Types

type Client added in v0.2.0

type Client struct {
	Client        gocloak.Client      `yaml:"client" json:"client"`
	SaRealmRoles  []string            `yaml:"sa_realm_roles,omitempty" json:"sa_realm_roles,omitempty"`
	SaClientRoles map[string][]string `yaml:"sa_client_roles,omitempty" json:"sa_client_roles,omitempty"`
	Copies        int                 `yaml:"copies,omitempty" json:"copies,omitempty"`
}

type KeycloakConnectParams

type KeycloakConnectParams struct {
	BasePath         string
	Username         string
	Password         string
	Realm            string
	Audience         string
	AllowInsecureTLS bool
}

type KeycloakData added in v0.2.0

type KeycloakData struct {
	Realms []RealmToCreate `yaml:"realms" json:"realms"`
}

type RealmToCreate added in v0.2.0

type RealmToCreate struct {
	RealmRepresentation gocloak.RealmRepresentation `yaml:"realm_repepresentation" json:"realm_repepresentation"`
	Clients             []Client                    `yaml:"clients,omitempty" json:"clients,omitempty"`
	Users               []User                      `yaml:"users,omitempty" json:"users,omitempty"`
	CustomRealmRoles    []gocloak.Role              `yaml:"custom_realm_roles,omitempty" json:"custom_realm_roles,omitempty"`
	CustomClientRoles   map[string][]gocloak.Role   `yaml:"custom_client_roles,omitempty" json:"custom_client_roles,omitempty"`
	CustomGroups        []gocloak.Group             `yaml:"custom_groups,omitempty" json:"custom_groups,omitempty"`
	TokenExchanges      []TokenExchange             `yaml:"token_exchanges,omitempty" json:"token_exchanges,omitempty"`
}

type TokenExchange added in v0.2.0

type TokenExchange struct {
	StartClientID  string `yaml:"start_client" json:"start_client"`
	TargetClientID string `yaml:"target_client" json:"target_client"`
}

type TokenManager added in v0.5.0

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

TokenManager manages automatic token refresh for Keycloak operations

func NewTokenManager added in v0.5.0

func NewTokenManager(ctx context.Context, connectParams *KeycloakConnectParams, config *TokenManagerConfig) (*TokenManager, error)

NewTokenManager creates a new TokenManager with initial login

func (*TokenManager) GetClient added in v0.5.0

func (tm *TokenManager) GetClient() *gocloak.GoCloak

GetClient returns the GoCloak client

func (*TokenManager) GetToken added in v0.5.0

func (tm *TokenManager) GetToken(ctx context.Context) (*gocloak.JWT, error)

GetToken returns a valid token, refreshing if necessary

type TokenManagerConfig added in v0.5.0

type TokenManagerConfig struct {
	// TokenBuffer is duration before expiration to trigger preemptive refresh
	// Default: 120s (2 minutes)
	TokenBuffer time.Duration
}

TokenManagerConfig allows configuring token refresh behavior

type User added in v0.3.0

type User struct {
	gocloak.User
	Copies int `yaml:"copies,omitempty" json:"copies,omitempty"`
}

Jump to

Keyboard shortcuts

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