register

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: 28 Imported by: 2

Documentation

Index

Constants

View Source
const (
	RegExpRealmName = `^[a-zA-Z0-9_-]{1,36}$`

	ReqBody = "body"

	PrmRealm = "realm"
)

Regular expressions and parameters

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 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) cs.Endpoint

MakeRegisterUserEndpoint endpoint creation

Types

type Component

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

Component is the register component interface.

func NewComponent

func NewComponent(keycloakURL string, realm string, ssePublicURL string, registerEnduserClientID string, registerEndUserGroups []string, keycloakClient KeycloakClient,
	tokenProvider toolbox.OidcTokenProvider, usersDBModule keycloakb.UsersDBModule,
	configDBModule ConfigurationDBModule, eventsDBModule database.EventsDBModule, logger internal.Logger) (Component, error)

NewComponent returns the management component.

type ConfigurationDBModule

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

ConfigurationDBModule is the interface of the configuration module.

type Endpoints

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

Endpoints for self service

type KeycloakClient

type KeycloakClient interface {
	CreateUser(accessToken string, realmName string, targetRealmName string, user kc.UserRepresentation) (string, error)
	UpdateUser(accessToken string, realmName, userID string, user kc.UserRepresentation) error
	GetUsers(accessToken string, reqRealmName, targetRealmName string, paramKV ...string) (kc.UsersPageRepresentation, error)
	GetGroups(accessToken string, realmName string) ([]kc.GroupRepresentation, error)
	ExecuteActionsEmail(accessToken string, realmName string, userID string, actions []string, paramKV ...string) error
}

KeycloakClient are methods from keycloak-client used by this component

type TrustIDAuthToken

type TrustIDAuthToken struct {
	Token     string `json:"token"`
	CreatedAt int64  `json:"created_at"`
}

TrustIDAuthToken struct

func (TrustIDAuthToken) ToJSON

func (t TrustIDAuthToken) ToJSON() string

ToJSON converts TrustIDAuthToken to its JSON representation

Jump to

Keyboard shortcuts

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