Documentation
¶
Index ¶
- func ClientContext(ctx context.Context, client *http.Client) context.Context
- func WithAdminPassword(password string) testcontainers.CustomizeRequestOption
- func WithAdminUsername(username string) testcontainers.CustomizeRequestOption
- func WithContextPath(contextPath string) testcontainers.CustomizeRequestOption
- func WithProviders(providerFiles ...string) testcontainers.CustomizeRequestOption
- func WithRealmImportFile(realmImportFile string) testcontainers.CustomizeRequestOption
- func WithTLS(certFile, keyFile string) testcontainers.CustomizeRequestOption
- type AdminClient
- type Client
- type KeycloakContainer
- type Token
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClientContext ¶
ClientContext returns a new context with the given HTTP client Used to pass a custom HTTP client to the AdminClient
func WithAdminPassword ¶
func WithAdminPassword(password string) testcontainers.CustomizeRequestOption
WithAdminPassword is option to set the admin password for KeycloakContainer.
func WithAdminUsername ¶
func WithAdminUsername(username string) testcontainers.CustomizeRequestOption
WithAdminUsername is option to set the admin username for KeycloakContainer.
func WithContextPath ¶
func WithContextPath(contextPath string) testcontainers.CustomizeRequestOption
WithContextPath is option to set the context path for KeycloakContainer.
func WithProviders ¶ added in v0.1.1
func WithProviders(providerFiles ...string) testcontainers.CustomizeRequestOption
WithProviders is option to set the providers for KeycloakContainer. Providers should be packaged ina Java Archive (JAR) file. See https://www.keycloak.org/server/configuration-provider
func WithRealmImportFile ¶
func WithRealmImportFile(realmImportFile string) testcontainers.CustomizeRequestOption
WithRealmImportFile is option to import a realm file into KeycloakContainer.
func WithTLS ¶ added in v0.1.1
func WithTLS(certFile, keyFile string) testcontainers.CustomizeRequestOption
WithTLS is option to enable TLS for KeycloakContainer.
Types ¶
type AdminClient ¶
type AdminClient struct {
ServerURL string
Realm string
Username string
Password string
ClientID string
UseTLS bool
// contains filtered or unexported fields
}
AdminClient is a Keycloak admin client.
func NewAdminClient ¶
func NewAdminClient(ctx *context.Context, serverURL, username, password string) (*AdminClient, error)
NewAdminClient creates a new Keycloak admin client.
type Client ¶
type Client struct {
Access *map[string]interface{} `json:"access,omitempty"`
AdminURL *string `json:"adminUrl,omitempty"`
Attributes *map[string]string `json:"attributes,omitempty"`
AuthenticationFlowBindingOverrides *map[string]string `json:"authenticationFlowBindingOverrides,omitempty"`
AuthorizationServicesEnabled *bool `json:"authorizationServicesEnabled,omitempty"`
BaseURL *string `json:"baseUrl,omitempty"`
BearerOnly *bool `json:"bearerOnly,omitempty"`
ClientAuthenticatorType *string `json:"clientAuthenticatorType,omitempty"`
ClientID *string `json:"clientId,omitempty"`
ConsentRequired *bool `json:"consentRequired,omitempty"`
DefaultClientScopes *[]string `json:"defaultClientScopes,omitempty"`
DefaultRoles *[]string `json:"defaultRoles,omitempty"`
Description *string `json:"description,omitempty"`
DirectAccessGrantsEnabled *bool `json:"directAccessGrantsEnabled,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
FrontChannelLogout *bool `json:"frontchannelLogout,omitempty"`
FullScopeAllowed *bool `json:"fullScopeAllowed,omitempty"`
ID *string `json:"id,omitempty"`
ImplicitFlowEnabled *bool `json:"implicitFlowEnabled,omitempty"`
Name *string `json:"name,omitempty"`
NodeReRegistrationTimeout *int32 `json:"nodeReRegistrationTimeout,omitempty"`
NotBefore *int32 `json:"notBefore,omitempty"`
OptionalClientScopes *[]string `json:"optionalClientScopes,omitempty"`
Origin *string `json:"origin,omitempty"`
Protocol *string `json:"protocol,omitempty"`
PublicClient *bool `json:"publicClient,omitempty"`
RedirectURIs *[]string `json:"redirectUris,omitempty"`
RegisteredNodes *map[string]int `json:"registeredNodes,omitempty"`
RegistrationAccessToken *string `json:"registrationAccessToken,omitempty"`
RootURL *string `json:"rootUrl,omitempty"`
Secret *string `json:"secret,omitempty"`
ServiceAccountsEnabled *bool `json:"serviceAccountsEnabled,omitempty"`
StandardFlowEnabled *bool `json:"standardFlowEnabled,omitempty"`
SurrogateAuthRequired *bool `json:"surrogateAuthRequired,omitempty"`
WebOrigins *[]string `json:"webOrigins,omitempty"`
}
Client represents a Keycloak client(https://www.keycloak.org/docs-api/19.0.3/javadocs/org/keycloak/representations/idm/ClientRepresentation.html).
type KeycloakContainer ¶
type KeycloakContainer struct {
testcontainers.Container
// contains filtered or unexported fields
}
KeycloakContainer is a wrapper around testcontainers.Container that provides some convenience methods for working with Keycloak.
func Run ¶ added in v0.3.0
func Run(ctx context.Context, img string, opts ...testcontainers.ContainerCustomizer) (*KeycloakContainer, error)
Run starts a new KeycloakContainer with the given options.
func (*KeycloakContainer) GetAdminClient ¶
func (k *KeycloakContainer) GetAdminClient(ctx context.Context) (*AdminClient, error)
GetAdminClient returns an AdminClient for the KeycloakContainer.
func (*KeycloakContainer) GetAuthServerURL ¶
func (k *KeycloakContainer) GetAuthServerURL(ctx context.Context) (string, error)
GetAuthServerURL returns the URL of the KeycloakContainer.
type Token ¶
type Token struct {
AccessToken string `json:"access_token"`
IDToken string `json:"id_token"`
ExpiresIn int `json:"expires_in"`
RefreshExpiresIn int `json:"refresh_expires_in"`
RefreshToken string `json:"refresh_token"`
TokenType string `json:"token_type"`
NotBeforePolicy int `json:"not-before-policy"`
SessionState string `json:"session_state"`
Scope string `json:"scope"`
}
Token represents a Keycloak token.