Documentation ¶
Index ¶
- Constants
- Variables
- func MakeAuthorizationRegisterComponentMW(realmName string, logger log.Logger, ...) func(Component) Component
- func MakeGetActionsEndpoint(component Component) cs.Endpoint
- func MakeGetUserByUsernameEndpoint(component Component) cs.Endpoint
- func MakeGetUserEndpoint(component Component) cs.Endpoint
- func MakeKYCHandler(e endpoint.Endpoint, logger log.Logger) *http_transport.Server
- func MakeValidateUserEndpoint(component Component) cs.Endpoint
- type Component
- type Endpoints
- type EventsDBModule
- type KeycloakClient
- type UsersDBModule
Constants ¶
const ( RegExpUserName = apimgmt.RegExpUsername RegExpUserID = apimgmt.RegExpID RegExpGroupIds = apimgmt.RegExpGroupIds )
Regular expressions
const (
// RegistrationOfficer is the name of the Keycloak group required for KYC API methods
RegistrationOfficer = "registration_officer"
)
Variables ¶
var ( KYCGetActions = newAction("KYC_GetActions", security.ScopeGlobal) KYCGetUser = newAction("KYC_GetUser", security.ScopeGroup) KYCGetUserByUsername = newAction("KYC_GetUserByUsername", security.ScopeGroup) KYCValidateUser = newAction("KYC_ValidateUser", security.ScopeGroup) )
Creates constants for API method names
Functions ¶
func MakeAuthorizationRegisterComponentMW ¶
func MakeAuthorizationRegisterComponentMW(realmName string, logger log.Logger, authorizationManager security.AuthorizationManager) func(Component) Component
MakeAuthorizationRegisterComponentMW checks authorization and return an error if the action is not allowed.
func MakeGetActionsEndpoint ¶
MakeGetActionsEndpoint creates an endpoint for GetActions
func MakeGetUserByUsernameEndpoint ¶
MakeGetUserByUsernameEndpoint endpoint creation
func MakeGetUserEndpoint ¶
MakeGetUserEndpoint endpoint creation
func MakeKYCHandler ¶
MakeKYCHandler make an HTTP handler for the KYC endpoint.
func MakeValidateUserEndpoint ¶
MakeValidateUserEndpoint endpoint creation
Types ¶
type Component ¶
type Component interface { GetActions(ctx context.Context) ([]apikyc.ActionRepresentation, error) GetUser(ctx context.Context, userID string) (apikyc.UserRepresentation, error) GetUserByUsername(ctx context.Context, username string, groupIDs []string) (apikyc.UserRepresentation, error) ValidateUser(ctx context.Context, userID string, user apikyc.UserRepresentation) error }
Component is the register component interface.
func NewComponent ¶
func NewComponent(socialRealmName string, keycloakClient KeycloakClient, usersDBModule UsersDBModule, eventsDBModule EventsDBModule, logger internal.Logger) Component
NewComponent returns the management component.
type Endpoints ¶
type Endpoints struct { GetActions endpoint.Endpoint GetUser endpoint.Endpoint GetUserByUsername endpoint.Endpoint ValidateUser endpoint.Endpoint }
Endpoints for self service
type EventsDBModule ¶
type EventsDBModule interface { Store(context.Context, map[string]string) error ReportEvent(ctx context.Context, apiCall string, origin string, values ...string) error }
EventsDBModule is the interface of the audit events module
type KeycloakClient ¶
type KeycloakClient interface { UpdateUser(accessToken string, realmName, userID string, user kc.UserRepresentation) error GetUser(accessToken string, realmName, userID string) (kc.UserRepresentation, error) GetUsers(accessToken string, reqRealmName, targetRealmName string, paramKV ...string) (kc.UsersPageRepresentation, error) }
KeycloakClient are methods from keycloak-client used by this component
type UsersDBModule ¶
type UsersDBModule interface { StoreOrUpdateUser(ctx context.Context, realm string, user dto.DBUser) error GetUser(ctx context.Context, realm string, userID string) (*dto.DBUser, error) CreateCheck(ctx context.Context, realm string, userID string, check dto.DBCheck) error }
UsersDBModule is the interface from the users module