management

package
v2.2.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2019 License: GPL-3.0 Imports: 21 Imported by: 2

Documentation

Index

Constants

View Source
const (
	GetRealms                      = "GetRealms"
	GetRealm                       = "GetRealm"
	GetClient                      = "GetClient"
	GetClients                     = "GetClients"
	DeleteUser                     = "DeleteUser"
	GetUser                        = "GetUser"
	UpdateUser                     = "UpdateUser"
	GetUsers                       = "GetUsers"
	CreateUser                     = "CreateUser"
	GetUserAccountStatus           = "GetUserAccountStatus"
	GetRolesOfUser                 = "GetRolesOfUser"
	GetGroupsOfUser                = "GetGroupsOfUser"
	GetClientRolesForUser          = "GetClientRolesForUser"
	AddClientRolesToUser           = "AddClientRolesToUser"
	ResetPassword                  = "ResetPassword"
	SendVerifyEmail                = "SendVerifyEmail"
	ExecuteActionsEmail            = "ExecuteActionsEmail"
	SendNewEnrolmentCode           = "SendNewEnrolmentCode"
	SendReminderEmail              = "SendReminderEmail"
	GetCredentialsForUser          = "GetCredentialsForUser"
	DeleteCredentialsForUser       = "DeleteCredentialsForUser"
	GetRoles                       = "GetRoles"
	GetRole                        = "GetRole"
	GetGroups                      = "GetGroups"
	GetClientRoles                 = "GetClientRoles"
	CreateClientRole               = "CreateClientRole"
	GetRealmCustomConfiguration    = "GetRealmCustomConfiguration"
	UpdateRealmCustomConfiguration = "UpdateRealmCustomConfiguration"
)

Creates constants for API method names

Variables

This section is empty.

Functions

func MakeAddClientRolesToUserEndpoint

func MakeAddClientRolesToUserEndpoint(managementComponent ManagementComponent) cs.Endpoint

MakeAddClientRolesToUserEndpoint creates an endpoint for AddClientRolesToUser

func MakeAuthorizationManagementComponentMW

func MakeAuthorizationManagementComponentMW(logger log.Logger, authorizationManager security.AuthorizationManager) func(Component) Component

MakeAuthorizationManagementComponentMW checks authorization and return an error if the action is not allowed.

func MakeConfigurationDBModuleLoggingMW

func MakeConfigurationDBModuleLoggingMW(log log.Logger) func(ConfigurationDBModule) ConfigurationDBModule

MakeConfigurationDBModuleLoggingMW makes a logging middleware for the statistic module.

func MakeConfigurationDBModuleTracingMW

func MakeConfigurationDBModuleTracingMW(tracer tracing.OpentracingClient) func(ConfigurationDBModule) ConfigurationDBModule

MakeConfigurationDBModuleTracingMW makes a tracing middleware at component level.

func MakeCreateClientRoleEndpoint

func MakeCreateClientRoleEndpoint(managementComponent ManagementComponent) cs.Endpoint

MakeCreateClientRoleEndpoint creates an endpoint for CreateClientRole

func MakeCreateUserEndpoint

func MakeCreateUserEndpoint(managementComponent ManagementComponent) cs.Endpoint

MakeCreateUserEndpoint makes the endpoint to create a user.

func MakeDeleteCredentialsForUserEndpoint

func MakeDeleteCredentialsForUserEndpoint(managementComponent ManagementComponent) cs.Endpoint

MakeDeleteCredentialsForUserEndpoint creates an endpoint for DeleteCredentialsForUser

func MakeDeleteUserEndpoint

func MakeDeleteUserEndpoint(managementComponent ManagementComponent) cs.Endpoint

MakeDeleteUserEndpoint creates an endpoint for DeleteUser

func MakeExecuteActionsEmailEndpoint

func MakeExecuteActionsEmailEndpoint(managementComponent ManagementComponent) cs.Endpoint

MakeExecuteActionsEmailEndpoint creates an endpoint for ExecuteActionsEmail

func MakeGetClientEndpoint

func MakeGetClientEndpoint(managementComponent ManagementComponent) cs.Endpoint

MakeGetClientEndpoint creates an endpoint for GetClient

func MakeGetClientRolesEndpoint

func MakeGetClientRolesEndpoint(managementComponent ManagementComponent) cs.Endpoint

MakeGetClientRolesEndpoint creates an endpoint for GetClientRoles

func MakeGetClientRolesForUserEndpoint

func MakeGetClientRolesForUserEndpoint(managementComponent ManagementComponent) cs.Endpoint

MakeGetClientRolesForUserEndpoint creates an endpoint for GetClientRolesForUser

func MakeGetClientsEndpoint

func MakeGetClientsEndpoint(managementComponent ManagementComponent) cs.Endpoint

MakeGetClientsEndpoint creates an endpoint for GetClients

func MakeGetCredentialsForUserEndpoint

func MakeGetCredentialsForUserEndpoint(managementComponent ManagementComponent) cs.Endpoint

MakeGetCredentialsForUserEndpoint creates an endpoint for GetCredentialsForUser

func MakeGetGroupsEndpoint

func MakeGetGroupsEndpoint(managementComponent ManagementComponent) cs.Endpoint

MakeGetGroupsEndpoint creates an endpoint for GetGroups

func MakeGetGroupsOfUserEndpoint

func MakeGetGroupsOfUserEndpoint(managementComponent ManagementComponent) cs.Endpoint

MakeGetGroupsOfUserEndpoint creates an endpoint for GetGroupsOfUser

func MakeGetRealmCustomConfigurationEndpoint

func MakeGetRealmCustomConfigurationEndpoint(managementComponent ManagementComponent) cs.Endpoint

MakeGetRealmCustomConfigurationEndpoint creates an endpoint for GetRealmCustomConfiguration

func MakeGetRealmEndpoint

func MakeGetRealmEndpoint(managementComponent ManagementComponent) cs.Endpoint

MakeGetRealmEndpoint makes the Realm endpoint to retrieve a realm.

func MakeGetRealmsEndpoint

func MakeGetRealmsEndpoint(managementComponent ManagementComponent) cs.Endpoint

MakeGetRealmsEndpoint makes the Realms endpoint to retrieve all available realms.

func MakeGetRoleEndpoint

func MakeGetRoleEndpoint(managementComponent ManagementComponent) cs.Endpoint

MakeGetRoleEndpoint creates an endpoint for GetRole

func MakeGetRolesEndpoint

func MakeGetRolesEndpoint(managementComponent ManagementComponent) cs.Endpoint

MakeGetRolesEndpoint creates an endpoint for GetRoles

func MakeGetRolesOfUserEndpoint

func MakeGetRolesOfUserEndpoint(managementComponent ManagementComponent) cs.Endpoint

MakeGetRolesOfUserEndpoint creates an endpoint for GetRolesOfUser

func MakeGetUserAccountStatusEndpoint

func MakeGetUserAccountStatusEndpoint(managementComponent ManagementComponent) cs.Endpoint

MakeGetUserAccountStatusEndpoint creates an endpoint for GetUserAccountStatus

func MakeGetUserEndpoint

func MakeGetUserEndpoint(managementComponent ManagementComponent) cs.Endpoint

MakeGetUserEndpoint creates an endpoint for GetUser

func MakeGetUsersEndpoint

func MakeGetUsersEndpoint(managementComponent ManagementComponent) cs.Endpoint

MakeGetUsersEndpoint creates an endpoint for GetUsers

func MakeManagementHandler

func MakeManagementHandler(e endpoint.Endpoint, logger log.Logger) *http_transport.Server

MakeManagementHandler make an HTTP handler for a Management endpoint.

func MakeResetPasswordEndpoint

func MakeResetPasswordEndpoint(managementComponent ManagementComponent) cs.Endpoint

MakeResetPasswordEndpoint creates an endpoint for ResetPassword

func MakeSendNewEnrolmentCodeEndpoint

func MakeSendNewEnrolmentCodeEndpoint(managementComponent ManagementComponent) cs.Endpoint

MakeSendNewEnrolmentCodeEndpoint creates an endpoint for SendNewEnrolmentCode

func MakeSendReminderEmailEndpoint

func MakeSendReminderEmailEndpoint(managementComponent ManagementComponent) cs.Endpoint

MakeSendReminderEmailEndpoint creates an endpoint for SendReminderEmail

func MakeSendVerifyEmailEndpoint

func MakeSendVerifyEmailEndpoint(managementComponent ManagementComponent) cs.Endpoint

MakeSendVerifyEmailEndpoint creates an endpoint for SendVerifyEmail

func MakeUpdateRealmCustomConfigurationEndpoint

func MakeUpdateRealmCustomConfigurationEndpoint(managementComponent ManagementComponent) cs.Endpoint

MakeUpdateRealmCustomConfigurationEndpoint creates an endpoint for UpdateRealmCustomConfiguration

func MakeUpdateUserEndpoint

func MakeUpdateUserEndpoint(managementComponent ManagementComponent) cs.Endpoint

MakeUpdateUserEndpoint creates an endpoint for UpdateUser

Types

type Component

type Component interface {
	GetRealms(ctx context.Context) ([]api.RealmRepresentation, error)
	GetRealm(ctx context.Context, realmName string) (api.RealmRepresentation, error)
	GetClient(ctx context.Context, realmName, idClient string) (api.ClientRepresentation, error)
	GetClients(ctx context.Context, realmName string) ([]api.ClientRepresentation, error)
	DeleteUser(ctx context.Context, realmName, userID string) error
	GetUser(ctx context.Context, realmName, userID string) (api.UserRepresentation, error)
	UpdateUser(ctx context.Context, realmName, userID string, user api.UserRepresentation) error
	GetUsers(ctx context.Context, realmName string, groupIDs []string, paramKV ...string) (api.UsersPageRepresentation, error)
	CreateUser(ctx context.Context, realmName string, user api.UserRepresentation) (string, error)
	GetUserAccountStatus(ctx context.Context, realmName, userID string) (map[string]bool, error)
	GetRolesOfUser(ctx context.Context, realmName, userID string) ([]api.RoleRepresentation, error)
	GetGroupsOfUser(ctx context.Context, realmName, userID string) ([]api.GroupRepresentation, error)
	GetClientRolesForUser(ctx context.Context, realmName, userID, clientID string) ([]api.RoleRepresentation, error)
	AddClientRolesToUser(ctx context.Context, realmName, userID, clientID string, roles []api.RoleRepresentation) error
	ResetPassword(ctx context.Context, realmName string, userID string, password api.PasswordRepresentation) (string, error)
	SendVerifyEmail(ctx context.Context, realmName string, userID string, paramKV ...string) error
	ExecuteActionsEmail(ctx context.Context, realmName string, userID string, actions []api.RequiredAction, paramKV ...string) error
	SendNewEnrolmentCode(ctx context.Context, realmName string, userID string) (string, error)
	SendReminderEmail(ctx context.Context, realmName string, userID string, paramKV ...string) error
	GetCredentialsForUser(ctx context.Context, realmName string, userID string) ([]api.CredentialRepresentation, error)
	DeleteCredentialsForUser(ctx context.Context, realmName string, userID string, credentialID string) error
	GetRoles(ctx context.Context, realmName string) ([]api.RoleRepresentation, error)
	GetRole(ctx context.Context, realmName string, roleID string) (api.RoleRepresentation, error)
	GetGroups(ctx context.Context, realmName string) ([]api.GroupRepresentation, error)
	GetClientRoles(ctx context.Context, realmName, idClient string) ([]api.RoleRepresentation, error)
	CreateClientRole(ctx context.Context, realmName, clientID string, role api.RoleRepresentation) (string, error)
	GetRealmCustomConfiguration(ctx context.Context, realmName string) (api.RealmCustomConfiguration, error)
	UpdateRealmCustomConfiguration(ctx context.Context, realmID string, customConfig api.RealmCustomConfiguration) error
}

Component is the management component interface.

func NewComponent

func NewComponent(keycloakClient KeycloakClient, eventDBModule database.EventsDBModule, configDBModule ConfigurationDBModule, logger internal.Logger) Component

NewComponent returns the management component.

type ConfigurationDBModule

type ConfigurationDBModule interface {
	StoreOrUpdate(context.Context, string, dto.RealmConfiguration) error
	GetConfiguration(context.Context, string) (dto.RealmConfiguration, error)
}

ConfigurationDBModule is the interface of the configuration module.

type ConvertLocationError

type ConvertLocationError struct {
	Location string
}

ConvertLocationError type

func (ConvertLocationError) Error

func (e ConvertLocationError) Error() string

type Endpoints

type Endpoints struct {
	GetRealms                      endpoint.Endpoint
	GetRealm                       endpoint.Endpoint
	GetClient                      endpoint.Endpoint
	GetClients                     endpoint.Endpoint
	DeleteUser                     endpoint.Endpoint
	GetUser                        endpoint.Endpoint
	UpdateUser                     endpoint.Endpoint
	GetUsers                       endpoint.Endpoint
	CreateUser                     endpoint.Endpoint
	GetRolesOfUser                 endpoint.Endpoint
	GetGroupsOfUser                endpoint.Endpoint
	GetUserAccountStatus           endpoint.Endpoint
	GetClientRoleForUser           endpoint.Endpoint
	AddClientRoleToUser            endpoint.Endpoint
	ResetPassword                  endpoint.Endpoint
	SendVerifyEmail                endpoint.Endpoint
	ExecuteActionsEmail            endpoint.Endpoint
	SendNewEnrolmentCode           endpoint.Endpoint
	SendReminderEmail              endpoint.Endpoint
	GetCredentialsForUser          endpoint.Endpoint
	DeleteCredentialsForUser       endpoint.Endpoint
	GetRoles                       endpoint.Endpoint
	GetRole                        endpoint.Endpoint
	GetGroups                      endpoint.Endpoint
	GetClientRoles                 endpoint.Endpoint
	CreateClientRole               endpoint.Endpoint
	GetRealmCustomConfiguration    endpoint.Endpoint
	UpdateRealmCustomConfiguration endpoint.Endpoint
}

Endpoints wraps a service behind a set of endpoints.

type KeycloakClient

type KeycloakClient interface {
	GetRealms(accessToken string) ([]kc.RealmRepresentation, error)
	GetRealm(accessToken string, realmName string) (kc.RealmRepresentation, error)
	GetClient(accessToken string, realmName, idClient string) (kc.ClientRepresentation, error)
	GetClients(accessToken string, realmName string, paramKV ...string) ([]kc.ClientRepresentation, error)
	DeleteUser(accessToken string, realmName, userID string) error
	GetUser(accessToken string, realmName, userID string) (kc.UserRepresentation, error)
	GetGroupsOfUser(accessToken string, realmName, userID string) ([]kc.GroupRepresentation, error)
	UpdateUser(accessToken string, realmName, userID string, user kc.UserRepresentation) error
	GetUsers(accessToken string, reqRealmName, targetRealmName string, paramKV ...string) (kc.UsersPageRepresentation, error)
	CreateUser(accessToken string, realmName string, targetRealmName string, user kc.UserRepresentation) (string, error)
	GetClientRoleMappings(accessToken string, realmName, userID, clientID string) ([]kc.RoleRepresentation, error)
	AddClientRolesToUserRoleMapping(accessToken string, realmName, userID, clientID string, roles []kc.RoleRepresentation) error
	GetRealmLevelRoleMappings(accessToken string, realmName, userID string) ([]kc.RoleRepresentation, error)
	ResetPassword(accessToken string, realmName string, userID string, cred kc.CredentialRepresentation) error
	SendVerifyEmail(accessToken string, realmName string, userID string, paramKV ...string) error
	ExecuteActionsEmail(accessToken string, realmName string, userID string, actions []string, paramKV ...string) error
	SendNewEnrolmentCode(accessToken string, realmName string, userID string) (kc.SmsCodeRepresentation, error)
	SendReminderEmail(accessToken string, realmName string, userID string, paramKV ...string) error
	GetRoles(accessToken string, realmName string) ([]kc.RoleRepresentation, error)
	GetRole(accessToken string, realmName string, roleID string) (kc.RoleRepresentation, error)
	GetGroups(accessToken string, realmName string) ([]kc.GroupRepresentation, error)
	GetClientRoles(accessToken string, realmName, idClient string) ([]kc.RoleRepresentation, error)
	CreateClientRole(accessToken string, realmName, clientID string, role kc.RoleRepresentation) (string, error)
	GetGroup(accessToken string, realmName, groupID string) (kc.GroupRepresentation, error)
	GetCredentials(accessToken string, realmName string, userID string) ([]kc.CredentialRepresentation, error)
	UpdateLabelCredential(accessToken string, realmName string, userID string, credentialID string, label string) error
	DeleteCredential(accessToken string, realmName string, userID string, credentialID string) error
}

KeycloakClient are methods from keycloak-client used by this component

type LocationHeader

type LocationHeader struct {
	URL string
}

LocationHeader type

type ManagementComponent

type ManagementComponent interface {
	GetRealms(ctx context.Context) ([]api.RealmRepresentation, error)
	GetRealm(ctx context.Context, realmName string) (api.RealmRepresentation, error)
	GetClient(ctx context.Context, realmName, idClient string) (api.ClientRepresentation, error)
	GetClients(ctx context.Context, realmName string) ([]api.ClientRepresentation, error)
	DeleteUser(ctx context.Context, realmName, userID string) error
	GetUser(ctx context.Context, realmName, userID string) (api.UserRepresentation, error)
	UpdateUser(ctx context.Context, realmName, userID string, user api.UserRepresentation) error
	GetUsers(ctx context.Context, realmName string, groupIDs []string, paramKV ...string) (api.UsersPageRepresentation, error)
	CreateUser(ctx context.Context, realmName string, user api.UserRepresentation) (string, error)
	GetUserAccountStatus(ctx context.Context, realmName, userID string) (map[string]bool, error)
	GetRolesOfUser(ctx context.Context, realmName, userID string) ([]api.RoleRepresentation, error)
	GetGroupsOfUser(ctx context.Context, realmName, userID string) ([]api.GroupRepresentation, error)
	GetClientRolesForUser(ctx context.Context, realmName, userID, clientID string) ([]api.RoleRepresentation, error)
	AddClientRolesToUser(ctx context.Context, realmName, userID, clientID string, roles []api.RoleRepresentation) error
	ResetPassword(ctx context.Context, realmName string, userID string, password api.PasswordRepresentation) (string, error)
	SendVerifyEmail(ctx context.Context, realmName string, userID string, paramKV ...string) error
	ExecuteActionsEmail(ctx context.Context, realmName string, userID string, actions []api.RequiredAction, paramKV ...string) error
	SendNewEnrolmentCode(ctx context.Context, realmName string, userID string) (string, error)
	SendReminderEmail(ctx context.Context, realmName string, userID string, paramKV ...string) error
	GetCredentialsForUser(ctx context.Context, realmName string, userID string) ([]api.CredentialRepresentation, error)
	DeleteCredentialsForUser(ctx context.Context, realmName string, userID string, credentialID string) error
	GetRoles(ctx context.Context, realmName string) ([]api.RoleRepresentation, error)
	GetRole(ctx context.Context, realmName string, roleID string) (api.RoleRepresentation, error)
	GetGroups(ctx context.Context, realmName string) ([]api.GroupRepresentation, error)
	GetClientRoles(ctx context.Context, realmName, idClient string) ([]api.RoleRepresentation, error)
	CreateClientRole(ctx context.Context, realmName, clientID string, role api.RoleRepresentation) (string, error)
	GetRealmCustomConfiguration(ctx context.Context, realmID string) (api.RealmCustomConfiguration, error)
	UpdateRealmCustomConfiguration(ctx context.Context, realmID string, customConfig api.RealmCustomConfiguration) error
}

ManagementComponent is the interface of the component to send a query to Keycloak.

Jump to

Keyboard shortcuts

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