common

package
v0.0.0-...-a301da7 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2020 License: Apache-2.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RouteKind                 = "Route"
	JobKind                   = "Job"
	CronJobKind               = "CronJob"
	SecretKind                = "Secret"
	StatefulSetKind           = "StatefulSet"
	ServiceKind               = "Service"
	IngressKind               = "Ingress"
	DeploymentKind            = "Deployment"
	PersistentVolumeClaimKind = "PersistentVolumeClaim"
	PodDisruptionBudgetKind   = "PodDisruptionBudget"
)

These kinds are not provided by the openshift api

View Source
const (
	ConditionStatusSuccess = "True"
)
View Source
const (
	RHSSOProfile = "RHSSO"
)
View Source
const (
	RealmLabelSelectorsKey = "realmLabelSelectors"
)

Variables

This section is empty.

Functions

func GetMatchingKeycloaks

func GetMatchingKeycloaks(ctx context.Context, c client.Client, labelSelector *v1.LabelSelector) (v1alpha1.KeycloakList, error)

Try to get a list of keycloak instances that match the selector specified on the realm

func GetMatchingRealms

func GetMatchingRealms(ctx context.Context, c client.Client, labelSelector *v1.LabelSelector) (v1alpha1.KeycloakRealmList, error)

Try to get a list of keycloak instances that match the selector specified on the realm

func GetStateFieldName

func GetStateFieldName(controllerName string, kind string) string

func IsDeploymentReady

func IsDeploymentReady(deployment *v12.Deployment) (bool, error)

func IsJobReady

func IsJobReady(job *v13.Job) (bool, error)

func IsRouteReady

func IsRouteReady(route *v1.Route) bool

func IsStatefulSetReady

func IsStatefulSetReady(statefulSet *v12.StatefulSet) (bool, error)

func WatchSecondaryResource

func WatchSecondaryResource(c controller.Controller, controllerName string, resourceKind string, objectTypetoWatch runtime.Object, cr runtime.Object) error

Types

type ActionRunner

type ActionRunner interface {
	RunAll(desiredState DesiredClusterState) error
	Create(obj runtime.Object) error
	Update(obj runtime.Object) error
	CreateRealm(obj *v1alpha1.KeycloakRealm) error
	DeleteRealm(obj *v1alpha1.KeycloakRealm) error
	CreateClient(keycloakClient *v1alpha1.KeycloakClient, Realm string) error
	DeleteClient(keycloakClient *v1alpha1.KeycloakClient, Realm string) error
	UpdateClient(keycloakClient *v1alpha1.KeycloakClient, Realm string) error
	CreateUser(obj *v1alpha1.KeycloakUser, realm string) error
	UpdateUser(obj *v1alpha1.KeycloakUser, realm string) error
	DeleteUser(id, realm string) error
	AssignRealmRole(obj *v1alpha1.KeycloakUserRole, userID, realm string) error
	RemoveRealmRole(obj *v1alpha1.KeycloakUserRole, userID, realm string) error
	AssignClientRole(obj *v1alpha1.KeycloakUserRole, clientID, userID, realm string) error
	RemoveClientRole(obj *v1alpha1.KeycloakUserRole, clientID, userID, realm string) error
	ApplyOverrides(obj *v1alpha1.KeycloakRealm) error
	Ping() error
}

func NewClusterActionRunner

func NewClusterActionRunner(context context.Context, client client.Client, scheme *runtime.Scheme, cr runtime.Object) ActionRunner

Create an action runner to run kubernetes actions

func NewClusterAndKeycloakActionRunner

func NewClusterAndKeycloakActionRunner(context context.Context, client client.Client, scheme *runtime.Scheme, cr runtime.Object, keycloakClient KeycloakInterface) ActionRunner

Create an action runner to run kubernetes and keycloak api actions

type AssignClientRoleAction

type AssignClientRoleAction struct {
	UserID   string
	ClientID string
	Ref      *v1alpha1.KeycloakUserRole
	Realm    string
	Msg      string
}

func (AssignClientRoleAction) Run

type AssignRealmRoleAction

type AssignRealmRoleAction struct {
	UserID string
	Ref    *v1alpha1.KeycloakUserRole
	Realm  string
	Msg    string
}

func (AssignRealmRoleAction) Run

type Background

type Background struct {
	SubscriptionChannel chan schema.GroupVersionKind
	// contains filtered or unexported fields
}

Background represents a procedure that runs in the background, periodically auto-detecting features

func NewAutoDetect

func NewAutoDetect(mgr manager.Manager) (*Background, error)

New creates a new auto-detect runner

func (*Background) Start

func (b *Background) Start()

Start initializes the auto-detection process that runs in the background

func (*Background) Stop

func (b *Background) Stop()

Stop causes the background process to stop auto detecting capabilities

type BackupState

type BackupState struct {
	LocalPersistentVolumeJob   *v12.Job
	LocalPersistentVolumeClaim *v1.PersistentVolumeClaim
	AwsJob                     *v12.Job
	AwsPeriodicJob             *v1beta1.CronJob
	Keycloak                   *kc.Keycloak
}

func NewBackupState

func NewBackupState(keycloak kc.Keycloak) *BackupState

func (*BackupState) IsResourcesReady

func (i *BackupState) IsResourcesReady() (bool, error)

func (*BackupState) Read

func (i *BackupState) Read(context context.Context, cr *kc.KeycloakBackup, controllerClient client.Client) error

type Client

type Client struct {
	URL string
	// contains filtered or unexported fields
}

func (*Client) CreateAuthenticatorConfig

func (c *Client) CreateAuthenticatorConfig(authenticatorConfig *v1alpha1.AuthenticatorConfig, realmName, executionID string) (string, error)

func (*Client) CreateClient

func (c *Client) CreateClient(client *v1alpha1.KeycloakAPIClient, realmName string) (string, error)

func (*Client) CreateFederatedIdentity

func (c *Client) CreateFederatedIdentity(fid v1alpha1.FederatedIdentity, userID string, realmName string) (string, error)

func (*Client) CreateIdentityProvider

func (c *Client) CreateIdentityProvider(identityProvider *v1alpha1.KeycloakIdentityProvider, realmName string) (string, error)

func (*Client) CreateRealm

func (c *Client) CreateRealm(realm *v1alpha1.KeycloakRealm) (string, error)

func (*Client) CreateUser

func (c *Client) CreateUser(user *v1alpha1.KeycloakAPIUser, realmName string) (string, error)

func (*Client) CreateUserClientRole

func (c *Client) CreateUserClientRole(role *v1alpha1.KeycloakUserRole, realmName, clientID, userID string) (string, error)

func (*Client) CreateUserRealmRole

func (c *Client) CreateUserRealmRole(role *v1alpha1.KeycloakUserRole, realmName, userID string) (string, error)

func (*Client) DeleteAuthenticatorConfig

func (c *Client) DeleteAuthenticatorConfig(configID, realmName string) error

func (*Client) DeleteClient

func (c *Client) DeleteClient(clientID, realmName string) error

func (*Client) DeleteIdentityProvider

func (c *Client) DeleteIdentityProvider(alias string, realmName string) error

func (*Client) DeleteRealm

func (c *Client) DeleteRealm(realmName string) error

func (*Client) DeleteUser

func (c *Client) DeleteUser(userID, realmName string) error

func (*Client) DeleteUserClientRole

func (c *Client) DeleteUserClientRole(role *v1alpha1.KeycloakUserRole, realmName, clientID, userID string) error

func (*Client) DeleteUserRealmRole

func (c *Client) DeleteUserRealmRole(role *v1alpha1.KeycloakUserRole, realmName, userID string) error

func (*Client) FindUserByEmail

func (c *Client) FindUserByEmail(email, realm string) (*v1alpha1.KeycloakAPIUser, error)

func (*Client) FindUserByUsername

func (c *Client) FindUserByUsername(name, realm string) (*v1alpha1.KeycloakAPIUser, error)

func (*Client) GetAuthenticatorConfig

func (c *Client) GetAuthenticatorConfig(configID, realmName string) (*v1alpha1.AuthenticatorConfig, error)

func (*Client) GetClient

func (c *Client) GetClient(clientID, realmName string) (*v1alpha1.KeycloakAPIClient, error)

func (*Client) GetClientInstall

func (c *Client) GetClientInstall(clientID, realmName string) ([]byte, error)

func (*Client) GetClientSecret

func (c *Client) GetClientSecret(clientID, realmName string) (string, error)

func (*Client) GetIdentityProvider

func (c *Client) GetIdentityProvider(alias string, realmName string) (*v1alpha1.KeycloakIdentityProvider, error)

func (*Client) GetRealm

func (c *Client) GetRealm(realmName string) (*v1alpha1.KeycloakRealm, error)

func (*Client) GetUser

func (c *Client) GetUser(userID, realmName string) (*v1alpha1.KeycloakAPIUser, error)

func (*Client) GetUserFederatedIdentities

func (c *Client) GetUserFederatedIdentities(userID string, realmName string) ([]v1alpha1.FederatedIdentity, error)

func (*Client) ListAuthenticationExecutionsForFlow

func (c *Client) ListAuthenticationExecutionsForFlow(flowAlias, realmName string) ([]*v1alpha1.AuthenticationExecutionInfo, error)

func (*Client) ListAvailableUserClientRoles

func (c *Client) ListAvailableUserClientRoles(realmName, clientID, userID string) ([]*v1alpha1.KeycloakUserRole, error)

func (*Client) ListAvailableUserRealmRoles

func (c *Client) ListAvailableUserRealmRoles(realmName, userID string) ([]*v1alpha1.KeycloakUserRole, error)

func (*Client) ListClients

func (c *Client) ListClients(realmName string) ([]*v1alpha1.KeycloakAPIClient, error)

func (*Client) ListIdentityProviders

func (c *Client) ListIdentityProviders(realmName string) ([]*v1alpha1.KeycloakIdentityProvider, error)

func (*Client) ListRealms

func (c *Client) ListRealms() ([]*v1alpha1.KeycloakRealm, error)

func (*Client) ListUserClientRoles

func (c *Client) ListUserClientRoles(realmName, clientID, userID string) ([]*v1alpha1.KeycloakUserRole, error)

func (*Client) ListUserRealmRoles

func (c *Client) ListUserRealmRoles(realmName, userID string) ([]*v1alpha1.KeycloakUserRole, error)

func (*Client) ListUsers

func (c *Client) ListUsers(realmName string) ([]*v1alpha1.KeycloakAPIUser, error)

func (*Client) Ping

func (c *Client) Ping() error

func (*Client) RemoveFederatedIdentity

func (c *Client) RemoveFederatedIdentity(fid v1alpha1.FederatedIdentity, userID string, realmName string) error

func (*Client) UpdateAuthenticatorConfig

func (c *Client) UpdateAuthenticatorConfig(authenticatorConfig *v1alpha1.AuthenticatorConfig, realmName string) error

func (*Client) UpdateClient

func (c *Client) UpdateClient(specClient *v1alpha1.KeycloakAPIClient, realmName string) error

func (*Client) UpdateIdentityProvider

func (c *Client) UpdateIdentityProvider(specIdentityProvider *v1alpha1.KeycloakIdentityProvider, realmName string) error

func (*Client) UpdatePassword

func (c *Client) UpdatePassword(user *v1alpha1.KeycloakAPIUser, realmName, newPass string) error

func (*Client) UpdateRealm

func (c *Client) UpdateRealm(realm *v1alpha1.KeycloakRealm) error

func (*Client) UpdateUser

func (c *Client) UpdateUser(specUser *v1alpha1.KeycloakAPIUser, realmName string) error

type ClientState

type ClientState struct {
	Client       *kc.KeycloakAPIClient
	ClientSecret *v1.Secret
	Context      context.Context
	Realm        *kc.KeycloakRealm
}

func NewClientState

func NewClientState(context context.Context, realm *kc.KeycloakRealm) *ClientState

func (*ClientState) Read

func (i *ClientState) Read(context context.Context, cr *kc.KeycloakClient, realmClient KeycloakInterface, controllerClient client.Client) error

type ClusterAction

type ClusterAction interface {
	Run(runner ActionRunner) (string, error)
}

type ClusterActionRunner

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

func (*ClusterActionRunner) ApplyOverrides

func (i *ClusterActionRunner) ApplyOverrides(obj *v1alpha1.KeycloakRealm) error

Delete a realm using the keycloak api

func (*ClusterActionRunner) AssignClientRole

func (i *ClusterActionRunner) AssignClientRole(obj *v1alpha1.KeycloakUserRole, clientID, userID, realm string) error

func (*ClusterActionRunner) AssignRealmRole

func (i *ClusterActionRunner) AssignRealmRole(obj *v1alpha1.KeycloakUserRole, userID, realm string) error

func (*ClusterActionRunner) Create

func (i *ClusterActionRunner) Create(obj runtime.Object) error

func (*ClusterActionRunner) CreateClient

func (i *ClusterActionRunner) CreateClient(obj *v1alpha1.KeycloakClient, realm string) error

func (*ClusterActionRunner) CreateRealm

func (i *ClusterActionRunner) CreateRealm(obj *v1alpha1.KeycloakRealm) error

Create a new realm using the keycloak api

func (*ClusterActionRunner) CreateUser

func (i *ClusterActionRunner) CreateUser(obj *v1alpha1.KeycloakUser, realm string) error

func (*ClusterActionRunner) DeleteClient

func (i *ClusterActionRunner) DeleteClient(obj *v1alpha1.KeycloakClient, realm string) error

func (*ClusterActionRunner) DeleteRealm

func (i *ClusterActionRunner) DeleteRealm(obj *v1alpha1.KeycloakRealm) error

Delete a realm using the keycloak api

func (*ClusterActionRunner) DeleteUser

func (i *ClusterActionRunner) DeleteUser(id, realm string) error

func (*ClusterActionRunner) Ping

func (i *ClusterActionRunner) Ping() error

Check if Keycloak is available

func (*ClusterActionRunner) RemoveClientRole

func (i *ClusterActionRunner) RemoveClientRole(obj *v1alpha1.KeycloakUserRole, clientID, userID, realm string) error

func (*ClusterActionRunner) RemoveRealmRole

func (i *ClusterActionRunner) RemoveRealmRole(obj *v1alpha1.KeycloakUserRole, userID, realm string) error

func (*ClusterActionRunner) RunAll

func (i *ClusterActionRunner) RunAll(desiredState DesiredClusterState) error

func (*ClusterActionRunner) Update

func (i *ClusterActionRunner) Update(obj runtime.Object) error

func (*ClusterActionRunner) UpdateClient

func (i *ClusterActionRunner) UpdateClient(obj *v1alpha1.KeycloakClient, realm string) error

func (*ClusterActionRunner) UpdateUser

func (i *ClusterActionRunner) UpdateUser(obj *v1alpha1.KeycloakUser, realm string) error

type ClusterState

type ClusterState struct {
	KeycloakServiceMonitor          *monitoringv1.ServiceMonitor
	KeycloakPodMonitor              *monitoringv1.PodMonitor
	KeycloakPrometheusRule          *monitoringv1.PrometheusRule
	KeycloakGrafanaDashboard        *grafanav1alpha1.GrafanaDashboard
	DatabaseSecret                  *v1.Secret
	PostgresqlPersistentVolumeClaim *v1.PersistentVolumeClaim
	PostgresqlService               *v1.Service
	PostgresqlDeployment            *v12.Deployment
	KeycloakService                 *v1.Service
	KeycloakDiscoveryService        *v1.Service
	KeycloakDeployment              *v12.StatefulSet
	KeycloakAdminSecret             *v1.Secret
	KeycloakIngress                 *v1beta1.Ingress
	KeycloakRoute                   *v13.Route
	PostgresqlServiceEndpoints      *v1.Endpoints
	PodDisruptionBudget             *v1beta12.PodDisruptionBudget
	KeycloakProbes                  *v1.ConfigMap
}

func NewClusterState

func NewClusterState() *ClusterState

func (*ClusterState) IsResourcesReady

func (i *ClusterState) IsResourcesReady() (bool, error)

func (*ClusterState) Read

func (i *ClusterState) Read(context context.Context, cr *kc.Keycloak, controllerClient client.Client) error

type ConfigureRealmAction

type ConfigureRealmAction struct {
	Ref *v1alpha1.KeycloakRealm
	Msg string
}

func (ConfigureRealmAction) Run

func (i ConfigureRealmAction) Run(runner ActionRunner) (string, error)

type CreateClientAction

type CreateClientAction struct {
	Ref   *v1alpha1.KeycloakClient
	Msg   string
	Realm string
}

func (CreateClientAction) Run

func (i CreateClientAction) Run(runner ActionRunner) (string, error)

type CreateRealmAction

type CreateRealmAction struct {
	Ref *v1alpha1.KeycloakRealm
	Msg string
}

func (CreateRealmAction) Run

func (i CreateRealmAction) Run(runner ActionRunner) (string, error)

type CreateUserAction

type CreateUserAction struct {
	Ref   *v1alpha1.KeycloakUser
	Realm string
	Msg   string
}

func (CreateUserAction) Run

func (i CreateUserAction) Run(runner ActionRunner) (string, error)

type DeleteClientAction

type DeleteClientAction struct {
	Ref   *v1alpha1.KeycloakClient
	Realm string
	Msg   string
}

func (DeleteClientAction) Run

func (i DeleteClientAction) Run(runner ActionRunner) (string, error)

type DeleteRealmAction

type DeleteRealmAction struct {
	Ref *v1alpha1.KeycloakRealm
	Msg string
}

func (DeleteRealmAction) Run

func (i DeleteRealmAction) Run(runner ActionRunner) (string, error)

type DeleteUserAction

type DeleteUserAction struct {
	ID    string
	Realm string
	Msg   string
}

func (DeleteUserAction) Run

func (i DeleteUserAction) Run(runner ActionRunner) (string, error)

type DesiredClusterState

type DesiredClusterState []ClusterAction

The desired cluster state is defined by a list of actions that have to be run to get from the current state to the desired state

func (*DesiredClusterState) AddAction

func (*DesiredClusterState) AddActions

func (d *DesiredClusterState) AddActions(actions []ClusterAction) DesiredClusterState

type GenericCreateAction

type GenericCreateAction struct {
	Ref runtime.Object
	Msg string
}

An action to create generic kubernetes resources (resources that don't require special treatment)

func (GenericCreateAction) Run

func (i GenericCreateAction) Run(runner ActionRunner) (string, error)

type GenericUpdateAction

type GenericUpdateAction struct {
	Ref runtime.Object
	Msg string
}

An action to update generic kubernetes resources (resources that don't require special treatment)

func (GenericUpdateAction) Run

func (i GenericUpdateAction) Run(runner ActionRunner) (string, error)

type KeycloakClientFactory

type KeycloakClientFactory interface {
	AuthenticatedClient(kc v1alpha1.Keycloak) (KeycloakInterface, error)
}

KeycloakClientFactory interface

type KeycloakInterface

type KeycloakInterface interface {
	Ping() error

	CreateRealm(realm *v1alpha1.KeycloakRealm) (string, error)
	GetRealm(realmName string) (*v1alpha1.KeycloakRealm, error)
	UpdateRealm(specRealm *v1alpha1.KeycloakRealm) error
	DeleteRealm(realmName string) error
	ListRealms() ([]*v1alpha1.KeycloakRealm, error)

	CreateClient(client *v1alpha1.KeycloakAPIClient, realmName string) (string, error)
	GetClient(clientID, realmName string) (*v1alpha1.KeycloakAPIClient, error)
	GetClientSecret(clientID, realmName string) (string, error)
	GetClientInstall(clientID, realmName string) ([]byte, error)
	UpdateClient(specClient *v1alpha1.KeycloakAPIClient, realmName string) error
	DeleteClient(clientID, realmName string) error
	ListClients(realmName string) ([]*v1alpha1.KeycloakAPIClient, error)

	CreateUser(user *v1alpha1.KeycloakAPIUser, realmName string) (string, error)
	CreateFederatedIdentity(fid v1alpha1.FederatedIdentity, userID string, realmName string) (string, error)
	RemoveFederatedIdentity(fid v1alpha1.FederatedIdentity, userID string, realmName string) error
	GetUserFederatedIdentities(userName string, realmName string) ([]v1alpha1.FederatedIdentity, error)
	UpdatePassword(user *v1alpha1.KeycloakAPIUser, realmName, newPass string) error
	FindUserByEmail(email, realm string) (*v1alpha1.KeycloakAPIUser, error)
	FindUserByUsername(name, realm string) (*v1alpha1.KeycloakAPIUser, error)
	GetUser(userID, realmName string) (*v1alpha1.KeycloakAPIUser, error)
	UpdateUser(specUser *v1alpha1.KeycloakAPIUser, realmName string) error
	DeleteUser(userID, realmName string) error
	ListUsers(realmName string) ([]*v1alpha1.KeycloakAPIUser, error)

	CreateIdentityProvider(identityProvider *v1alpha1.KeycloakIdentityProvider, realmName string) (string, error)
	GetIdentityProvider(alias, realmName string) (*v1alpha1.KeycloakIdentityProvider, error)
	UpdateIdentityProvider(specIdentityProvider *v1alpha1.KeycloakIdentityProvider, realmName string) error
	DeleteIdentityProvider(alias, realmName string) error
	ListIdentityProviders(realmName string) ([]*v1alpha1.KeycloakIdentityProvider, error)

	CreateUserClientRole(role *v1alpha1.KeycloakUserRole, realmName, clientID, userID string) (string, error)
	ListUserClientRoles(realmName, clientID, userID string) ([]*v1alpha1.KeycloakUserRole, error)
	ListAvailableUserClientRoles(realmName, clientID, userID string) ([]*v1alpha1.KeycloakUserRole, error)
	DeleteUserClientRole(role *v1alpha1.KeycloakUserRole, realmName, clientID, userID string) error

	CreateUserRealmRole(role *v1alpha1.KeycloakUserRole, realmName, userID string) (string, error)
	ListUserRealmRoles(realmName, userID string) ([]*v1alpha1.KeycloakUserRole, error)
	ListAvailableUserRealmRoles(realmName, userID string) ([]*v1alpha1.KeycloakUserRole, error)
	DeleteUserRealmRole(role *v1alpha1.KeycloakUserRole, realmName, userID string) error

	ListAuthenticationExecutionsForFlow(flowAlias, realmName string) ([]*v1alpha1.AuthenticationExecutionInfo, error)

	CreateAuthenticatorConfig(authenticatorConfig *v1alpha1.AuthenticatorConfig, realmName, executionID string) (string, error)
	GetAuthenticatorConfig(configID, realmName string) (*v1alpha1.AuthenticatorConfig, error)
	UpdateAuthenticatorConfig(authenticatorConfig *v1alpha1.AuthenticatorConfig, realmName string) error
	DeleteAuthenticatorConfig(configID, realmName string) error
}

type LocalConfigKeycloakFactory

type LocalConfigKeycloakFactory struct {
}

func (*LocalConfigKeycloakFactory) AuthenticatedClient

func (i *LocalConfigKeycloakFactory) AuthenticatedClient(kc v1alpha1.Keycloak) (KeycloakInterface, error)

AuthenticatedClient returns an authenticated client for requesting endpoints from the Keycloak api

type PingAction

type PingAction struct {
	Msg string
}

func (PingAction) Run

func (i PingAction) Run(runner ActionRunner) (string, error)

type RealmState

type RealmState struct {
	Realm            *kc.KeycloakRealm
	RealmUserSecrets map[string]*v1.Secret
	Context          context.Context
	Keycloak         *kc.Keycloak
}

func NewRealmState

func NewRealmState(context context.Context, keycloak kc.Keycloak) *RealmState

func (*RealmState) Read

func (i *RealmState) Read(cr *kc.KeycloakRealm, realmClient KeycloakInterface, controllerClient client.Client) error

type RemoveClientRoleAction

type RemoveClientRoleAction struct {
	UserID   string
	ClientID string
	Ref      *v1alpha1.KeycloakUserRole
	Realm    string
	Msg      string
}

func (RemoveClientRoleAction) Run

type RemoveRealmRoleAction

type RemoveRealmRoleAction struct {
	UserID string
	Ref    *v1alpha1.KeycloakUserRole
	Realm  string
	Msg    string
}

func (RemoveRealmRoleAction) Run

type Requester

type Requester interface {
	Do(req *http.Request) (*http.Response, error)
}

type StateManager

type StateManager struct {
	*sync.Mutex
	// contains filtered or unexported fields
}

func GetStateManager

func GetStateManager() *StateManager

func (*StateManager) Clear

func (sm *StateManager) Clear()

func (*StateManager) GetState

func (sm *StateManager) GetState(key string) interface{}

func (*StateManager) SetState

func (sm *StateManager) SetState(key string, value interface{})

type T

type T interface{}

T is a generic type for keycloak spec resources

type UpdateClientAction

type UpdateClientAction struct {
	Ref   *v1alpha1.KeycloakClient
	Msg   string
	Realm string
}

func (UpdateClientAction) Run

func (i UpdateClientAction) Run(runner ActionRunner) (string, error)

type UpdateUserAction

type UpdateUserAction struct {
	Ref   *v1alpha1.KeycloakUser
	Realm string
	Msg   string
}

func (UpdateUserAction) Run

func (i UpdateUserAction) Run(runner ActionRunner) (string, error)

type UserState

type UserState struct {
	User                 *v1alpha1.KeycloakAPIUser
	ClientRoles          map[string][]*v1alpha1.KeycloakUserRole
	RealmRoles           []*v1alpha1.KeycloakUserRole
	AvailableClientRoles map[string][]*v1alpha1.KeycloakUserRole
	AvailableRealmRoles  []*v1alpha1.KeycloakUserRole
	Clients              []*v1alpha1.KeycloakAPIClient
	Secret               *v1.Secret
	Keycloak             v1alpha1.Keycloak
	Context              context.Context
}

func NewUserState

func NewUserState(keycloak v1alpha1.Keycloak) *UserState

func (*UserState) GetAvailableClientRole

func (i *UserState) GetAvailableClientRole(name, clientID string) *v1alpha1.KeycloakUserRole

Check if a client role is part of the available roles for this user Don't allow to assign unavailable roles

func (*UserState) GetAvailableRealmRole

func (i *UserState) GetAvailableRealmRole(name string) *v1alpha1.KeycloakUserRole

Check if a realm role is part of the available roles for this user Don't allow to assign unavailable roles

func (*UserState) GetClientByID

func (i *UserState) GetClientByID(clientID string) *v1alpha1.KeycloakAPIClient

Keycloak clients have `ID` and `ClientID` properties and depending on the action we need one or the other. This function translates between the two

func (*UserState) Read

func (i *UserState) Read(keycloakClient KeycloakInterface, userClient client.Client, user *v1alpha1.KeycloakUser, realm v1alpha1.KeycloakRealm) error

Jump to

Keyboard shortcuts

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