kyc

package
v2.4.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2020 License: GPL-3.0 Imports: 18 Imported by: 2

Documentation

Index

Constants

View Source
const (
	RegExpUserName = constants.RegExpUsername
	RegExpUserID   = constants.RegExpID
	RegExpGroupIds = constants.RegExpGroupIds
)

Regular expressions

View Source
const (
	// RegistrationOfficer is the name of the Keycloak group required for KYC API methods
	RegistrationOfficer = "registration_officer"
)

Variables

View Source
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

func MakeGetActionsEndpoint(component Component) cs.Endpoint

MakeGetActionsEndpoint creates an endpoint for GetActions

func MakeGetUserByUsernameEndpoint

func MakeGetUserByUsernameEndpoint(component Component) cs.Endpoint

MakeGetUserByUsernameEndpoint endpoint creation

func MakeGetUserEndpoint

func MakeGetUserEndpoint(component Component) cs.Endpoint

MakeGetUserEndpoint endpoint creation

func MakeKYCHandler

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

MakeKYCHandler make an HTTP handler for the KYC endpoint.

func MakeValidateUserEndpoint

func MakeValidateUserEndpoint(component Component) cs.Endpoint

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, accredsModule keycloakb.AccreditationsModule, 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

Jump to

Keyboard shortcuts

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