Documentation ¶
Index ¶
- Constants
- func GetMatchingKeycloaks(ctx context.Context, c client.Client, labelSelector *v1.LabelSelector) (v1alpha1.KeycloakList, error)
- func GetMatchingRealms(ctx context.Context, c client.Client, labelSelector *v1.LabelSelector) (v1alpha1.KeycloakRealmList, error)
- func GetStateFieldName(controllerName string, kind string) string
- func WatchSecondaryResource(c controller.Controller, controllerName string, resourceKind string, ...) error
- type ActionRunner
- type AddDefaultRolesAction
- type AssignClientRoleAction
- type AssignRealmRoleAction
- type Client
- func (c *Client) AddRealmRoleComposites(realmName, roleID string, roles *[]v1alpha1.RoleRepresentation) error
- func (c *Client) CreateClient(specClient *v1alpha1.KeycloakAPIClient, realmName string) (string, error)
- func (c *Client) CreateClientClientScopeMappings(specClient *v1alpha1.KeycloakAPIClient, ...) error
- func (c *Client) CreateClientRealmScopeMappings(specClient *v1alpha1.KeycloakAPIClient, ...) error
- func (c *Client) CreateClientRole(clientID string, role *v1alpha1.RoleRepresentation, realmName string) (string, error)
- func (c *Client) CreateFederatedIdentity(fid v1alpha1.FederatedIdentity, userID string, realmName string) (string, error)
- func (c *Client) CreateRealm(realm *v1alpha1.KeycloakRealm) (string, error)
- func (c *Client) CreateUserClientRole(role *v1alpha1.KeycloakUserRole, realmName, clientID, userID string) (string, error)
- func (c *Client) CreateUserRealmRole(role *v1alpha1.KeycloakUserRole, realmName, userID string) (string, error)
- func (c *Client) DeleteClient(clientID, realmName string) error
- func (c *Client) DeleteClientClientScopeMappings(specClient *v1alpha1.KeycloakAPIClient, ...) error
- func (c *Client) DeleteClientDefaultClientScope(specClient *v1alpha1.KeycloakAPIClient, ...) error
- func (c *Client) DeleteClientOptionalClientScope(specClient *v1alpha1.KeycloakAPIClient, ...) error
- func (c *Client) DeleteClientRealmScopeMappings(specClient *v1alpha1.KeycloakAPIClient, ...) error
- func (c *Client) DeleteClientRole(clientID, role, realmName string) error
- func (c *Client) DeleteRealm(realmName string) error
- func (c *Client) DeleteRealmRoleComposites(realmName, roleID string, roles *[]v1alpha1.RoleRepresentation) error
- func (c *Client) DeleteUserClientRole(role *v1alpha1.KeycloakUserRole, realmName, clientID, userID string) error
- func (c *Client) DeleteUserRealmRole(role *v1alpha1.KeycloakUserRole, realmName, userID string) error
- func (c *Client) Endpoint() string
- func (c *Client) GetClient(clientID, realmName string) (*v1alpha1.KeycloakAPIClient, error)
- func (c *Client) GetClientID(name, realmName string) (string, error)
- func (c *Client) GetClientInstall(clientID, realmName string) ([]byte, error)
- func (c *Client) GetClientSecret(clientID, realmName string) (string, error)
- func (c *Client) GetRealm(realmName string) (*v1alpha1.KeycloakRealm, error)
- func (c *Client) GetServiceAccountUser(realmName, clientID string) (*v1alpha1.KeycloakAPIUser, error)
- func (c *Client) GetUserFederatedIdentities(userID string, realmName string) ([]v1alpha1.FederatedIdentity, error)
- func (c *Client) ListAvailableClientScopes(realmName string) ([]v1alpha1.KeycloakClientScope, error)
- func (c *Client) ListAvailableUserClientRoles(realmName, clientID, userID string) ([]*v1alpha1.KeycloakUserRole, error)
- func (c *Client) ListAvailableUserRealmRoles(realmName, userID string) ([]*v1alpha1.KeycloakUserRole, error)
- func (c *Client) ListClientRoles(clientID, realmName string) ([]v1alpha1.RoleRepresentation, error)
- func (c *Client) ListClients(realmName string) ([]*v1alpha1.KeycloakAPIClient, error)
- func (c *Client) ListDefaultClientScopes(clientID, realmName string) ([]v1alpha1.KeycloakClientScope, error)
- func (c *Client) ListOptionalClientScopes(clientID, realmName string) ([]v1alpha1.KeycloakClientScope, error)
- func (c *Client) ListRealmRoleClientRoleComposites(realmName, roleID, clientID string) ([]v1alpha1.RoleRepresentation, error)
- func (c *Client) ListRealms() ([]*v1alpha1.KeycloakRealm, error)
- func (c *Client) ListScopeMappings(clientID, realmName string) (*v1alpha1.MappingsRepresentation, error)
- func (c *Client) ListUserClientRoles(realmName, clientID, userID string) ([]*v1alpha1.KeycloakUserRole, error)
- func (c *Client) ListUserRealmRoles(realmName, userID string) ([]*v1alpha1.KeycloakUserRole, error)
- func (c *Client) Ping() error
- func (c *Client) RemoveFederatedIdentity(fid v1alpha1.FederatedIdentity, userID string, realmName string) error
- func (c *Client) UpdateClient(specClient *v1alpha1.KeycloakAPIClient, realmName string) error
- func (c *Client) UpdateClientDefaultClientScope(specClient *v1alpha1.KeycloakAPIClient, ...) error
- func (c *Client) UpdateClientOptionalClientScope(specClient *v1alpha1.KeycloakAPIClient, ...) error
- func (c *Client) UpdateClientRole(clientID string, role, oldRole *v1alpha1.RoleRepresentation, realmName string) error
- func (c *Client) UpdateRealm(realm *v1alpha1.KeycloakRealm) error
- type ClientState
- type ClusterAction
- type ClusterActionRunner
- func (i *ClusterActionRunner) AddDefaultRoles(obj *[]v1alpha1.RoleRepresentation, defaultRealmRoleID, realm string) error
- func (i *ClusterActionRunner) AssignClientRole(obj *v1alpha1.KeycloakUserRole, clientID, userID, realm string) error
- func (i *ClusterActionRunner) AssignRealmRole(obj *v1alpha1.KeycloakUserRole, userID, realm string) error
- func (i *ClusterActionRunner) Create(obj client.Object) error
- func (i *ClusterActionRunner) CreateClient(obj *v1alpha1.KeycloakClient, realm string) error
- func (i *ClusterActionRunner) CreateClientClientScopeMappings(keycloakClient *v1alpha1.KeycloakClient, ...) error
- func (i *ClusterActionRunner) CreateClientRealmScopeMappings(keycloakClient *v1alpha1.KeycloakClient, ...) error
- func (i *ClusterActionRunner) CreateClientRole(obj *v1alpha1.KeycloakClient, role *v1alpha1.RoleRepresentation, realm string) error
- func (i *ClusterActionRunner) CreateRealm(obj *v1alpha1.KeycloakRealm) error
- func (i *ClusterActionRunner) Delete(obj client.Object) error
- func (i *ClusterActionRunner) DeleteClient(obj *v1alpha1.KeycloakClient, realm string) error
- func (i *ClusterActionRunner) DeleteClientClientScopeMappings(keycloakClient *v1alpha1.KeycloakClient, ...) error
- func (i *ClusterActionRunner) DeleteClientDefaultClientScope(keycloakClient *v1alpha1.KeycloakClient, ...) error
- func (i *ClusterActionRunner) DeleteClientOptionalClientScope(keycloakClient *v1alpha1.KeycloakClient, ...) error
- func (i *ClusterActionRunner) DeleteClientRealmScopeMappings(keycloakClient *v1alpha1.KeycloakClient, ...) error
- func (i *ClusterActionRunner) DeleteClientRole(obj *v1alpha1.KeycloakClient, role, realm string) error
- func (i *ClusterActionRunner) DeleteDefaultRoles(obj *[]v1alpha1.RoleRepresentation, defaultRealmRoleID, realm string) error
- func (i *ClusterActionRunner) DeleteRealm(obj *v1alpha1.KeycloakRealm) error
- func (i *ClusterActionRunner) Ping() error
- func (i *ClusterActionRunner) RemoveClientRole(obj *v1alpha1.KeycloakUserRole, clientID, userID, realm string) error
- func (i *ClusterActionRunner) RemoveRealmRole(obj *v1alpha1.KeycloakUserRole, userID, realm string) error
- func (i *ClusterActionRunner) RunAll(desiredState DesiredClusterState) error
- func (i *ClusterActionRunner) Update(obj client.Object) error
- func (i *ClusterActionRunner) UpdateClient(obj *v1alpha1.KeycloakClient, realm string) error
- func (i *ClusterActionRunner) UpdateClientDefaultClientScope(keycloakClient *v1alpha1.KeycloakClient, ...) error
- func (i *ClusterActionRunner) UpdateClientOptionalClientScope(keycloakClient *v1alpha1.KeycloakClient, ...) error
- func (i *ClusterActionRunner) UpdateClientRole(obj *v1alpha1.KeycloakClient, role, oldRole *v1alpha1.RoleRepresentation, ...) error
- type ClusterState
- type CreateClientAction
- type CreateClientClientScopeMappingsAction
- type CreateClientRealmScopeMappingsAction
- type CreateClientRoleAction
- type DeleteClientAction
- type DeleteClientClientScopeMappingsAction
- type DeleteClientDefaultClientScopeAction
- type DeleteClientOptionalClientScopeAction
- type DeleteClientRealmScopeMappingsAction
- type DeleteClientRoleAction
- type DeleteDefaultRolesAction
- type DesiredClusterState
- type GenericCreateAction
- type GenericDeleteAction
- type GenericUpdateAction
- type KeycloakClientFactory
- type KeycloakInterface
- type LocalConfigKeycloakFactory
- type PingAction
- type RealmState
- type RemoveClientRoleAction
- type RemoveRealmRoleAction
- type Requester
- type StateManager
- type T
- type UpdateClientAction
- type UpdateClientDefaultClientScopeAction
- type UpdateClientOptionalClientScopeAction
- type UpdateClientRoleAction
- type UserState
- func (i *UserState) GetAvailableClientRole(name, clientID string) *v1alpha1.KeycloakUserRole
- func (i *UserState) GetAvailableRealmRole(name string) *v1alpha1.KeycloakUserRole
- func (i *UserState) GetClientByID(clientID string) *v1alpha1.KeycloakAPIClient
- func (i *UserState) ReadWithExistingAPIUser(keycloakClient KeycloakInterface, userClient client.Client, ...) error
Constants ¶
const (
SecretKind = "Secret"
)
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 WatchSecondaryResource ¶
func WatchSecondaryResource(c controller.Controller, controllerName string, resourceKind string, objectTypetoWatch client.Object, cr runtime.Object) error
Types ¶
type ActionRunner ¶
type ActionRunner interface { RunAll(desiredState DesiredClusterState) error Create(obj client.Object) error Update(obj client.Object) error Delete(obj client.Object) error CreateClient(keycloakClient *v1alpha1.KeycloakClient, Realm string) error DeleteClient(keycloakClient *v1alpha1.KeycloakClient, Realm string) error UpdateClient(keycloakClient *v1alpha1.KeycloakClient, Realm string) error CreateClientRole(keycloakClient *v1alpha1.KeycloakClient, role *v1alpha1.RoleRepresentation, realm string) error UpdateClientRole(keycloakClient *v1alpha1.KeycloakClient, role, oldRole *v1alpha1.RoleRepresentation, realm string) error DeleteClientRole(keycloakClient *v1alpha1.KeycloakClient, role, Realm string) error CreateClientRealmScopeMappings(keycloakClient *v1alpha1.KeycloakClient, mappings *[]v1alpha1.RoleRepresentation, realm string) error DeleteClientRealmScopeMappings(keycloakClient *v1alpha1.KeycloakClient, mappings *[]v1alpha1.RoleRepresentation, realm string) error CreateClientClientScopeMappings(keycloakClient *v1alpha1.KeycloakClient, mappings *v1alpha1.ClientMappingsRepresentation, realm string) error DeleteClientClientScopeMappings(keycloakClient *v1alpha1.KeycloakClient, mappings *v1alpha1.ClientMappingsRepresentation, realm string) error UpdateClientDefaultClientScope(keycloakClient *v1alpha1.KeycloakClient, clientScope *v1alpha1.KeycloakClientScope, realm string) error DeleteClientDefaultClientScope(keycloakClient *v1alpha1.KeycloakClient, clientScope *v1alpha1.KeycloakClientScope, realm string) error UpdateClientOptionalClientScope(keycloakClient *v1alpha1.KeycloakClient, clientScope *v1alpha1.KeycloakClientScope, realm string) error DeleteClientOptionalClientScope(keycloakClient *v1alpha1.KeycloakClient, clientScope *v1alpha1.KeycloakClientScope, 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 AddDefaultRoles(obj *[]v1alpha1.RoleRepresentation, defaultRealmRoleID, realm string) error DeleteDefaultRoles(obj *[]v1alpha1.RoleRepresentation, defaultRealmRoleID, realm string) error Ping() error }
func NewClusterActionRunner ¶
func NewClusterActionRunner(context context.Context, client client.Client, scheme *runtime.Scheme, cr client.Object) ActionRunner
Create an action runner to run kubernetes actions
func NewClusterAndKeycloakActionRunner ¶
func NewClusterAndKeycloakActionRunner(context context.Context, client client.Client, scheme *runtime.Scheme, cr client.Object, keycloakClient KeycloakInterface) ActionRunner
Create an action runner to run kubernetes and keycloak api actions
type AddDefaultRolesAction ¶
type AddDefaultRolesAction struct { Roles *[]v1alpha1.RoleRepresentation DefaultRealmRoleID string Ref *v1alpha1.KeycloakClient Msg string Realm string }
func (AddDefaultRolesAction) Run ¶
func (i AddDefaultRolesAction) Run(runner ActionRunner) (string, error)
type AssignClientRoleAction ¶
type AssignClientRoleAction struct { UserID string ClientID string Ref *v1alpha1.KeycloakUserRole Realm string Msg string }
func (AssignClientRoleAction) Run ¶
func (i AssignClientRoleAction) Run(runner ActionRunner) (string, error)
type AssignRealmRoleAction ¶
type AssignRealmRoleAction struct { UserID string Ref *v1alpha1.KeycloakUserRole Realm string Msg string }
func (AssignRealmRoleAction) Run ¶
func (i AssignRealmRoleAction) Run(runner ActionRunner) (string, error)
type Client ¶
type Client struct { URL string // contains filtered or unexported fields }
func (*Client) AddRealmRoleComposites ¶
func (c *Client) AddRealmRoleComposites(realmName, roleID string, roles *[]v1alpha1.RoleRepresentation) error
func (*Client) CreateClient ¶
func (*Client) CreateClientClientScopeMappings ¶
func (c *Client) CreateClientClientScopeMappings(specClient *v1alpha1.KeycloakAPIClient, mappings *v1alpha1.ClientMappingsRepresentation, realmName string) error
func (*Client) CreateClientRealmScopeMappings ¶
func (c *Client) CreateClientRealmScopeMappings(specClient *v1alpha1.KeycloakAPIClient, mappings *[]v1alpha1.RoleRepresentation, realmName string) error
func (*Client) CreateClientRole ¶
func (*Client) CreateFederatedIdentity ¶
func (*Client) CreateRealm ¶
func (c *Client) CreateRealm(realm *v1alpha1.KeycloakRealm) (string, error)
func (*Client) CreateUserClientRole ¶
func (*Client) CreateUserRealmRole ¶
func (*Client) DeleteClient ¶
func (*Client) DeleteClientClientScopeMappings ¶
func (c *Client) DeleteClientClientScopeMappings(specClient *v1alpha1.KeycloakAPIClient, mappings *v1alpha1.ClientMappingsRepresentation, realmName string) error
func (*Client) DeleteClientDefaultClientScope ¶
func (c *Client) DeleteClientDefaultClientScope(specClient *v1alpha1.KeycloakAPIClient, clientScope *v1alpha1.KeycloakClientScope, realmName string) error
func (*Client) DeleteClientOptionalClientScope ¶
func (c *Client) DeleteClientOptionalClientScope(specClient *v1alpha1.KeycloakAPIClient, clientScope *v1alpha1.KeycloakClientScope, realmName string) error
func (*Client) DeleteClientRealmScopeMappings ¶
func (c *Client) DeleteClientRealmScopeMappings(specClient *v1alpha1.KeycloakAPIClient, mappings *[]v1alpha1.RoleRepresentation, realmName string) error
func (*Client) DeleteClientRole ¶
func (*Client) DeleteRealm ¶
func (*Client) DeleteRealmRoleComposites ¶
func (c *Client) DeleteRealmRoleComposites(realmName, roleID string, roles *[]v1alpha1.RoleRepresentation) 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) GetClient ¶
func (c *Client) GetClient(clientID, realmName string) (*v1alpha1.KeycloakAPIClient, error)
func (*Client) GetClientInstall ¶
func (*Client) GetClientSecret ¶
func (*Client) GetRealm ¶
func (c *Client) GetRealm(realmName string) (*v1alpha1.KeycloakRealm, error)
func (*Client) GetServiceAccountUser ¶
func (c *Client) GetServiceAccountUser(realmName, clientID string) (*v1alpha1.KeycloakAPIUser, error)
func (*Client) GetUserFederatedIdentities ¶
func (*Client) ListAvailableClientScopes ¶
func (c *Client) ListAvailableClientScopes(realmName string) ([]v1alpha1.KeycloakClientScope, 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) ListClientRoles ¶
func (c *Client) ListClientRoles(clientID, realmName string) ([]v1alpha1.RoleRepresentation, error)
func (*Client) ListClients ¶
func (c *Client) ListClients(realmName string) ([]*v1alpha1.KeycloakAPIClient, error)
func (*Client) ListDefaultClientScopes ¶
func (c *Client) ListDefaultClientScopes(clientID, realmName string) ([]v1alpha1.KeycloakClientScope, error)
func (*Client) ListOptionalClientScopes ¶
func (c *Client) ListOptionalClientScopes(clientID, realmName string) ([]v1alpha1.KeycloakClientScope, error)
func (*Client) ListRealmRoleClientRoleComposites ¶
func (c *Client) ListRealmRoleClientRoleComposites(realmName, roleID, clientID string) ([]v1alpha1.RoleRepresentation, error)
func (*Client) ListRealms ¶
func (c *Client) ListRealms() ([]*v1alpha1.KeycloakRealm, error)
func (*Client) ListScopeMappings ¶
func (c *Client) ListScopeMappings(clientID, realmName string) (*v1alpha1.MappingsRepresentation, 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) RemoveFederatedIdentity ¶
func (*Client) UpdateClient ¶
func (c *Client) UpdateClient(specClient *v1alpha1.KeycloakAPIClient, realmName string) error
func (*Client) UpdateClientDefaultClientScope ¶
func (c *Client) UpdateClientDefaultClientScope(specClient *v1alpha1.KeycloakAPIClient, clientScope *v1alpha1.KeycloakClientScope, realmName string) error
func (*Client) UpdateClientOptionalClientScope ¶
func (c *Client) UpdateClientOptionalClientScope(specClient *v1alpha1.KeycloakAPIClient, clientScope *v1alpha1.KeycloakClientScope, realmName string) error
func (*Client) UpdateClientRole ¶
func (*Client) UpdateRealm ¶
func (c *Client) UpdateRealm(realm *v1alpha1.KeycloakRealm) error
type ClientState ¶
type ClientState struct { Client *kc.KeycloakAPIClient ClientSecret *v1.Secret // keycloak-client-secret-<custom resource name> Context context.Context Realm *kc.KeycloakRealm Roles []kc.RoleRepresentation DefaultRoleID string DefaultRoles []kc.RoleRepresentation ScopeMappings *kc.MappingsRepresentation AvailableClientScopes []kc.KeycloakClientScope DefaultClientScopes []kc.KeycloakClientScope OptionalClientScopes []kc.KeycloakClientScope DeprecatedClientSecret *v1.Secret // keycloak-client-secret-<clientID> Keycloak kc.Keycloak ServiceAccountUserState *UserState }
func NewClientState ¶
func NewClientState(context context.Context, realm *kc.KeycloakRealm, keycloak kc.Keycloak) *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) AddDefaultRoles ¶
func (i *ClusterActionRunner) AddDefaultRoles(obj *[]v1alpha1.RoleRepresentation, defaultRealmRoleID, realm string) error
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) CreateClient ¶
func (i *ClusterActionRunner) CreateClient(obj *v1alpha1.KeycloakClient, realm string) error
func (*ClusterActionRunner) CreateClientClientScopeMappings ¶
func (i *ClusterActionRunner) CreateClientClientScopeMappings(keycloakClient *v1alpha1.KeycloakClient, mappings *v1alpha1.ClientMappingsRepresentation, realm string) error
func (*ClusterActionRunner) CreateClientRealmScopeMappings ¶
func (i *ClusterActionRunner) CreateClientRealmScopeMappings(keycloakClient *v1alpha1.KeycloakClient, mappings *[]v1alpha1.RoleRepresentation, realm string) error
func (*ClusterActionRunner) CreateClientRole ¶
func (i *ClusterActionRunner) CreateClientRole(obj *v1alpha1.KeycloakClient, role *v1alpha1.RoleRepresentation, realm string) error
func (*ClusterActionRunner) CreateRealm ¶
func (i *ClusterActionRunner) CreateRealm(obj *v1alpha1.KeycloakRealm) error
Create a new realm using the keycloak api
func (*ClusterActionRunner) DeleteClient ¶
func (i *ClusterActionRunner) DeleteClient(obj *v1alpha1.KeycloakClient, realm string) error
func (*ClusterActionRunner) DeleteClientClientScopeMappings ¶
func (i *ClusterActionRunner) DeleteClientClientScopeMappings(keycloakClient *v1alpha1.KeycloakClient, mappings *v1alpha1.ClientMappingsRepresentation, realm string) error
func (*ClusterActionRunner) DeleteClientDefaultClientScope ¶
func (i *ClusterActionRunner) DeleteClientDefaultClientScope(keycloakClient *v1alpha1.KeycloakClient, clientScope *v1alpha1.KeycloakClientScope, realm string) error
func (*ClusterActionRunner) DeleteClientOptionalClientScope ¶
func (i *ClusterActionRunner) DeleteClientOptionalClientScope(keycloakClient *v1alpha1.KeycloakClient, clientScope *v1alpha1.KeycloakClientScope, realm string) error
func (*ClusterActionRunner) DeleteClientRealmScopeMappings ¶
func (i *ClusterActionRunner) DeleteClientRealmScopeMappings(keycloakClient *v1alpha1.KeycloakClient, mappings *[]v1alpha1.RoleRepresentation, realm string) error
func (*ClusterActionRunner) DeleteClientRole ¶
func (i *ClusterActionRunner) DeleteClientRole(obj *v1alpha1.KeycloakClient, role, realm string) error
func (*ClusterActionRunner) DeleteDefaultRoles ¶
func (i *ClusterActionRunner) DeleteDefaultRoles(obj *[]v1alpha1.RoleRepresentation, defaultRealmRoleID, realm string) error
func (*ClusterActionRunner) DeleteRealm ¶
func (i *ClusterActionRunner) DeleteRealm(obj *v1alpha1.KeycloakRealm) error
Delete a realm using the keycloak api
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) UpdateClient ¶
func (i *ClusterActionRunner) UpdateClient(obj *v1alpha1.KeycloakClient, realm string) error
func (*ClusterActionRunner) UpdateClientDefaultClientScope ¶
func (i *ClusterActionRunner) UpdateClientDefaultClientScope(keycloakClient *v1alpha1.KeycloakClient, clientScope *v1alpha1.KeycloakClientScope, realm string) error
func (*ClusterActionRunner) UpdateClientOptionalClientScope ¶
func (i *ClusterActionRunner) UpdateClientOptionalClientScope(keycloakClient *v1alpha1.KeycloakClient, clientScope *v1alpha1.KeycloakClientScope, realm string) error
func (*ClusterActionRunner) UpdateClientRole ¶
func (i *ClusterActionRunner) UpdateClientRole(obj *v1alpha1.KeycloakClient, role, oldRole *v1alpha1.RoleRepresentation, realm string) error
type ClusterState ¶
type ClusterState struct { KeycloakDeployment *v12.StatefulSet KeycloakAdminSecret *v1.Secret }
func NewClusterState ¶
func NewClusterState() *ClusterState
func (*ClusterState) IsResourcesReady ¶
func (i *ClusterState) IsResourcesReady(cr *kc.Keycloak) (bool, 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 CreateClientClientScopeMappingsAction ¶
type CreateClientClientScopeMappingsAction struct { Mappings *v1alpha1.ClientMappingsRepresentation Ref *v1alpha1.KeycloakClient Msg string Realm string }
func (CreateClientClientScopeMappingsAction) Run ¶
func (i CreateClientClientScopeMappingsAction) Run(runner ActionRunner) (string, error)
type CreateClientRealmScopeMappingsAction ¶
type CreateClientRealmScopeMappingsAction struct { Mappings *[]v1alpha1.RoleRepresentation Ref *v1alpha1.KeycloakClient Msg string Realm string }
func (CreateClientRealmScopeMappingsAction) Run ¶
func (i CreateClientRealmScopeMappingsAction) Run(runner ActionRunner) (string, error)
type CreateClientRoleAction ¶
type CreateClientRoleAction struct { Role *v1alpha1.RoleRepresentation Ref *v1alpha1.KeycloakClient Msg string Realm string }
func (CreateClientRoleAction) Run ¶
func (i CreateClientRoleAction) 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 DeleteClientClientScopeMappingsAction ¶
type DeleteClientClientScopeMappingsAction struct { Mappings *v1alpha1.ClientMappingsRepresentation Ref *v1alpha1.KeycloakClient Msg string Realm string }
func (DeleteClientClientScopeMappingsAction) Run ¶
func (i DeleteClientClientScopeMappingsAction) Run(runner ActionRunner) (string, error)
type DeleteClientDefaultClientScopeAction ¶
type DeleteClientDefaultClientScopeAction struct { ClientScope *v1alpha1.KeycloakClientScope Ref *v1alpha1.KeycloakClient Msg string Realm string }
func (DeleteClientDefaultClientScopeAction) Run ¶
func (i DeleteClientDefaultClientScopeAction) Run(runner ActionRunner) (string, error)
type DeleteClientOptionalClientScopeAction ¶
type DeleteClientOptionalClientScopeAction struct { ClientScope *v1alpha1.KeycloakClientScope Ref *v1alpha1.KeycloakClient Msg string Realm string }
func (DeleteClientOptionalClientScopeAction) Run ¶
func (i DeleteClientOptionalClientScopeAction) Run(runner ActionRunner) (string, error)
type DeleteClientRealmScopeMappingsAction ¶
type DeleteClientRealmScopeMappingsAction struct { Mappings *[]v1alpha1.RoleRepresentation Ref *v1alpha1.KeycloakClient Msg string Realm string }
func (DeleteClientRealmScopeMappingsAction) Run ¶
func (i DeleteClientRealmScopeMappingsAction) Run(runner ActionRunner) (string, error)
type DeleteClientRoleAction ¶
type DeleteClientRoleAction struct { Role *v1alpha1.RoleRepresentation Ref *v1alpha1.KeycloakClient Msg string Realm string }
func (DeleteClientRoleAction) Run ¶
func (i DeleteClientRoleAction) Run(runner ActionRunner) (string, error)
type DeleteDefaultRolesAction ¶
type DeleteDefaultRolesAction struct { Roles *[]v1alpha1.RoleRepresentation DefaultRealmRoleID string Ref *v1alpha1.KeycloakClient Msg string Realm string }
func (DeleteDefaultRolesAction) Run ¶
func (i DeleteDefaultRolesAction) 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 (d *DesiredClusterState) AddAction(action ClusterAction) DesiredClusterState
func (*DesiredClusterState) AddActions ¶
func (d *DesiredClusterState) AddActions(actions []ClusterAction) DesiredClusterState
type GenericCreateAction ¶
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 GenericDeleteAction ¶
An action to delete generic kubernetes resources (resources that don't require special treatment)
func (GenericDeleteAction) Run ¶
func (i GenericDeleteAction) Run(runner ActionRunner) (string, error)
type GenericUpdateAction ¶
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 Endpoint() string 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) ListRealmRoleClientRoleComposites(realmName, roleID, clientID string) ([]v1alpha1.RoleRepresentation, error) AddRealmRoleComposites(realmName, roleID string, roles *[]v1alpha1.RoleRepresentation) error DeleteRealmRoleComposites(realmName, roleID string, roles *[]v1alpha1.RoleRepresentation) error CreateClient(client *v1alpha1.KeycloakAPIClient, realmName string) (string, error) GetClient(clientID, realmName string) (*v1alpha1.KeycloakAPIClient, error) GetClientID(clientID, realmName string) (string, 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) ListClientRoles(clientID, realmName string) ([]v1alpha1.RoleRepresentation, error) ListScopeMappings(clientID, realmName string) (*v1alpha1.MappingsRepresentation, error) ListAvailableClientScopes(realmName string) ([]v1alpha1.KeycloakClientScope, error) ListDefaultClientScopes(clientID, realmName string) ([]v1alpha1.KeycloakClientScope, error) ListOptionalClientScopes(clientID, realmName string) ([]v1alpha1.KeycloakClientScope, error) CreateClientRole(clientID string, role *v1alpha1.RoleRepresentation, realmName string) (string, error) UpdateClientRole(clientID string, role, oldRole *v1alpha1.RoleRepresentation, realmName string) error DeleteClientRole(clientID, role, realmName string) error CreateClientRealmScopeMappings(specClient *v1alpha1.KeycloakAPIClient, mappings *[]v1alpha1.RoleRepresentation, realmName string) error DeleteClientRealmScopeMappings(specClient *v1alpha1.KeycloakAPIClient, mappings *[]v1alpha1.RoleRepresentation, realmName string) error CreateClientClientScopeMappings(specClient *v1alpha1.KeycloakAPIClient, mappings *v1alpha1.ClientMappingsRepresentation, realmName string) error DeleteClientClientScopeMappings(specClient *v1alpha1.KeycloakAPIClient, mappings *v1alpha1.ClientMappingsRepresentation, realmName string) error UpdateClientDefaultClientScope(specClient *v1alpha1.KeycloakAPIClient, clientScope *v1alpha1.KeycloakClientScope, realmName string) error DeleteClientDefaultClientScope(specClient *v1alpha1.KeycloakAPIClient, clientScope *v1alpha1.KeycloakClientScope, realmName string) error UpdateClientOptionalClientScope(specClient *v1alpha1.KeycloakAPIClient, clientScope *v1alpha1.KeycloakClientScope, realmName string) error DeleteClientOptionalClientScope(specClient *v1alpha1.KeycloakAPIClient, clientScope *v1alpha1.KeycloakClientScope, realmName 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) 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 GetServiceAccountUser(realmName, clientID string) (*v1alpha1.KeycloakAPIUser, error) }
type LocalConfigKeycloakFactory ¶
type LocalConfigKeycloakFactory struct { }
func (*LocalConfigKeycloakFactory) AuthenticatedClient ¶
func (i *LocalConfigKeycloakFactory) AuthenticatedClient(kc v1alpha1.Keycloak, insecureSsl bool) (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 ¶
func (i RemoveClientRoleAction) Run(runner ActionRunner) (string, error)
type RemoveRealmRoleAction ¶
type RemoveRealmRoleAction struct { UserID string Ref *v1alpha1.KeycloakUserRole Realm string Msg string }
func (RemoveRealmRoleAction) Run ¶
func (i RemoveRealmRoleAction) Run(runner ActionRunner) (string, error)
type StateManager ¶
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 UpdateClientAction ¶
type UpdateClientAction struct { Ref *v1alpha1.KeycloakClient Msg string Realm string }
func (UpdateClientAction) Run ¶
func (i UpdateClientAction) Run(runner ActionRunner) (string, error)
type UpdateClientDefaultClientScopeAction ¶
type UpdateClientDefaultClientScopeAction struct { ClientScope *v1alpha1.KeycloakClientScope Ref *v1alpha1.KeycloakClient Msg string Realm string }
func (UpdateClientDefaultClientScopeAction) Run ¶
func (i UpdateClientDefaultClientScopeAction) Run(runner ActionRunner) (string, error)
type UpdateClientOptionalClientScopeAction ¶
type UpdateClientOptionalClientScopeAction struct { ClientScope *v1alpha1.KeycloakClientScope Ref *v1alpha1.KeycloakClient Msg string Realm string }
func (UpdateClientOptionalClientScopeAction) Run ¶
func (i UpdateClientOptionalClientScopeAction) Run(runner ActionRunner) (string, error)
type UpdateClientRoleAction ¶
type UpdateClientRoleAction struct { Role *v1alpha1.RoleRepresentation OldRole *v1alpha1.RoleRepresentation Ref *v1alpha1.KeycloakClient Msg string Realm string }
func (UpdateClientRoleAction) Run ¶
func (i UpdateClientRoleAction) 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 (*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) ReadWithExistingAPIUser ¶
func (i *UserState) ReadWithExistingAPIUser(keycloakClient KeycloakInterface, userClient client.Client, user *v1alpha1.KeycloakAPIUser, realm v1alpha1.KeycloakRealm) error