validation

package
v2.6.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2020 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReqBody = "body"

	PrmUserID = "userID"
)

Parameter names

Variables

This section is empty.

Functions

func MakeCreateCheckEndpoint

func MakeCreateCheckEndpoint(component Component) cs.Endpoint

MakeCreateCheckEndpoint endpoint creation

func MakeGetUserEndpoint

func MakeGetUserEndpoint(component Component) cs.Endpoint

MakeGetUserEndpoint endpoint creation

func MakeUpdateUserEndpoint

func MakeUpdateUserEndpoint(component Component) cs.Endpoint

MakeUpdateUserEndpoint endpoint creation

func MakeValidationHandler

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

MakeValidationHandler make an HTTP handler for a Validation endpoint.

Types

type Component

type Component interface {
	GetUser(ctx context.Context, userID string) (api.UserRepresentation, error)
	UpdateUser(ctx context.Context, userID string, user api.UserRepresentation) error
	CreateCheck(ctx context.Context, userID string, check api.CheckRepresentation) error
}

Component is the register component interface.

func NewComponent

func NewComponent(socialRealmName string, keycloakClient KeycloakClient, tokenProvider TokenProvider, usersDBModule UsersDBModule, eventsDBModule database.EventsDBModule, accredsModule keycloakb.AccreditationsModule, logger internal.Logger) Component

NewComponent returns the management component.

type Endpoints

type Endpoints struct {
	GetUser     endpoint.Endpoint
	UpdateUser  endpoint.Endpoint
	CreateCheck 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)
	GetRealm(accessToken string, realmName string) (kc.RealmRepresentation, error)
}

KeycloakClient are methods from keycloak-client used by this component

type TokenProvider

type TokenProvider interface {
	ProvideToken(ctx context.Context) (string, error)
}

TokenProvider is the interface to retrieve accessToken to access KC

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