register

package
v3.22.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2021 License: GPL-3.0 Imports: 25 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeAuthorizationRegisterComponentMW

func MakeAuthorizationRegisterComponentMW(logger log.Logger) func(Component) Component

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

func MakeGetConfigurationEndpoint

func MakeGetConfigurationEndpoint(component Component) cs.Endpoint

MakeGetConfigurationEndpoint endpoint creation

func MakeHTTPRecaptchaValidationMW

func MakeHTTPRecaptchaValidationMW(recaptchaURL string, recaptchaSecret string, logger log.Logger) func(http.Handler) http.Handler

MakeHTTPRecaptchaValidationMW retrieves the recaptcha code and checks its validity

func MakeRegisterCorpUserEndpoint

func MakeRegisterCorpUserEndpoint(component Component) cs.Endpoint

MakeRegisterCorpUserEndpoint endpoint creation

func MakeRegisterHandler

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

MakeRegisterHandler make an HTTP handler for the self-register endpoint.

func MakeRegisterUserEndpoint

func MakeRegisterUserEndpoint(component Component, socialRealm string) cs.Endpoint

MakeRegisterUserEndpoint endpoint creation

Types

type Component

type Component interface {
	RegisterUser(ctx context.Context, targetRealmName string, customerRealmName string, user apiregister.UserRepresentation) error
	GetConfiguration(ctx context.Context, realmName string) (apiregister.ConfigurationRepresentation, error)
}

Component is the register component interface.

func NewComponent

func NewComponent(keycloakClient KeycloakClient, tokenProvider toolbox.OidcTokenProvider, usersDBModule keycloakb.UsersDetailsDBModule,
	configDBModule ConfigurationDBModule, eventsDBModule database.EventsDBModule, onboardingModule OnboardingModule, glnVerifier GlnVerifier, logger keycloakb.Logger) Component

NewComponent returns component.

type ConfigurationDBModule

type ConfigurationDBModule interface {
	GetConfigurations(context.Context, string) (configuration.RealmConfiguration, configuration.RealmAdminConfiguration, error)
	GetConfiguration(context.Context, string) (configuration.RealmConfiguration, error)
}

ConfigurationDBModule is the interface of the configuration module.

type Endpoints

type Endpoints struct {
	RegisterUser     endpoint.Endpoint
	RegisterCorpUser endpoint.Endpoint
	GetConfiguration endpoint.Endpoint
}

Endpoints for self service

type GlnVerifier

type GlnVerifier interface {
	ValidateGLN(firstName, lastName, gln string) error
}

GlnVerifier interface allows to check validity of a GLN

type KeycloakClient

type KeycloakClient interface {
	GetRealm(accessToken string, realmName string) (kc.RealmRepresentation, error)
	CreateUser(accessToken string, realmName string, targetRealmName string, user kc.UserRepresentation) (string, error)
	UpdateUser(accessToken string, realmName, userID string, user kc.UserRepresentation) error
	DeleteUser(accessToken string, realmName, userID string) error
	GetUsers(accessToken string, reqRealmName, targetRealmName string, paramKV ...string) (kc.UsersPageRepresentation, error)
	GetGroups(accessToken string, realmName string) ([]kc.GroupRepresentation, error)
	SendEmail(accessToken string, reqRealmName string, realmName string, emailRep kc.EmailRepresentation) error
}

KeycloakClient are methods from keycloak-client used by this component

type OnboardingModule

type OnboardingModule interface {
	OnboardingAlreadyCompleted(kc.UserRepresentation) (bool, error)
	SendOnboardingEmail(ctx context.Context, accessToken string, realmName string, userID string, username string,
		onboardingClientID string, onboardingRedirectURI string, themeRealmName string, reminder bool, lifespan *int) error
	CreateUser(ctx context.Context, accessToken, realmName, targetRealmName string, kcUser *kc.UserRepresentation) (string, error)
}

OnboardingModule is the interface for the onboarding process

Jump to

Keyboard shortcuts

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