account

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

Documentation

Index

Constants

View Source
const (
	UpdatePassword            = "UpdatePassword"
	GetCredentials            = "GetCredentials"
	GetCredentialRegistrators = "GetCredentialRegistrators"
	UpdateLabelCredential     = "UpdateLabelCredential"
	DeleteCredential          = "DeleteCredential"
	MoveCredential            = "MoveCredential"
	GetAccount                = "GetAccount"
	UpdateAccount             = "UpdateAccount"
	DeleteAccount             = "DeleteAccount"
	GetConfiguration          = "GetConfiguration"
)

Creates constants for API method names

View Source
const (
	ActionVerifyEmail       = "VERIFY_EMAIL"
	ActionVerifyPhoneNumber = "mobilephone-validation"
)

Constants

View Source
const (
	ReqBody = "body"

	PrmCredentialID     = "credentialID"
	PrmPrevCredentialID = "previousCredentialID"

	PrmQryRealmID = "realm_id"
)

Parameter names

Variables

This section is empty.

Functions

func MakeAccountHandler

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

MakeAccountHandler make an HTTP handler for an Account endpoint.

func MakeAuthorizationAccountComponentMW

func MakeAuthorizationAccountComponentMW(logger log.Logger, configDBModule keycloakb.ConfigurationDBModule) func(Component) Component

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

func MakeDeleteAccountEndpoint

func MakeDeleteAccountEndpoint(component Component) cs.Endpoint

MakeDeleteAccountEndpoint makes the DeleteAccount endpoint to delete connected user.

func MakeDeleteCredentialEndpoint

func MakeDeleteCredentialEndpoint(component Component) cs.Endpoint

MakeDeleteCredentialEndpoint make the DeleteCredential endpoint to delete a credential of the current user.

func MakeGetAccountEndpoint

func MakeGetAccountEndpoint(component Component) cs.Endpoint

MakeGetAccountEndpoint makes the GetAccount endpoint to get connected user's info.

func MakeGetConfigurationEndpoint

func MakeGetConfigurationEndpoint(component Component) cs.Endpoint

MakeGetConfigurationEndpoint makes the GetConfiguration endpoint to get the config for selfservice application.

func MakeGetCredentialRegistratorsEndpoint

func MakeGetCredentialRegistratorsEndpoint(component Component) cs.Endpoint

MakeGetCredentialRegistratorsEndpoint make the GetCredentialRegistrators endpoint to retrieve the list of possible kind of credentials.

func MakeGetCredentialsEndpoint

func MakeGetCredentialsEndpoint(component Component) cs.Endpoint

MakeGetCredentialsEndpoint makes the GetCredentials endpoint to list credentials of the current user.

func MakeMoveCredentialEndpoint

func MakeMoveCredentialEndpoint(component Component) cs.Endpoint

MakeMoveCredentialEndpoint make the MoveCredential endpoint to change the priority of a credential of the current user.

func MakeSendVerifyEmailEndpoint

func MakeSendVerifyEmailEndpoint(component Component) cs.Endpoint

MakeSendVerifyEmailEndpoint makes the SendVerifyEmail endpoint

func MakeSendVerifyPhoneNumberEndpoint

func MakeSendVerifyPhoneNumberEndpoint(component Component) cs.Endpoint

MakeSendVerifyPhoneNumberEndpoint makes the SendVerifyPhoneNumber endpoint

func MakeUpdateAccountEndpoint

func MakeUpdateAccountEndpoint(component Component) cs.Endpoint

MakeUpdateAccountEndpoint makes the UpdateAccount endpoint to update connected user's own info.

func MakeUpdateLabelCredentialEndpoint

func MakeUpdateLabelCredentialEndpoint(component Component) cs.Endpoint

MakeUpdateLabelCredentialEndpoint make the UpdateLabelCredential endpoint to set a new label for a credential.

func MakeUpdatePasswordEndpoint

func MakeUpdatePasswordEndpoint(component Component) cs.Endpoint

MakeUpdatePasswordEndpoint makes the UpdatePassword endpoint to update connected user's own password.

Types

type Component

type Component interface {
	UpdatePassword(ctx context.Context, currentPassword, newPassword, confirmPassword string) error
	GetCredentials(ctx context.Context) ([]api.CredentialRepresentation, error)
	GetCredentialRegistrators(ctx context.Context) ([]string, error)
	UpdateLabelCredential(ctx context.Context, credentialID string, label string) error
	DeleteCredential(ctx context.Context, credentialID string) error
	MoveCredential(ctx context.Context, credentialID string, previousCredentialID string) error
	GetAccount(ctx context.Context) (api.AccountRepresentation, error)
	UpdateAccount(context.Context, api.UpdatableAccountRepresentation) error
	DeleteAccount(context.Context) error
	GetConfiguration(context.Context, string) (api.Configuration, error)
	SendVerifyEmail(ctx context.Context) error
	SendVerifyPhoneNumber(ctx context.Context) error
}

Component interface exposes methods used by the bridge API

func NewComponent

func NewComponent(keycloakAccountClient KeycloakAccountClient, keycloakTechClient KeycloakTechnicalClient, eventDBModule database.EventsDBModule, configDBModule keycloakb.ConfigurationDBModule, usersDBModule UsersDetailsDBModule, glnVerifier GlnVerifier, logger keycloakb.Logger) Component

NewComponent returns the self-service component.

type Endpoints

type Endpoints struct {
	UpdatePassword            endpoint.Endpoint
	GetCredentials            endpoint.Endpoint
	GetCredentialRegistrators endpoint.Endpoint
	UpdateLabelCredential     endpoint.Endpoint
	DeleteCredential          endpoint.Endpoint
	MoveCredential            endpoint.Endpoint
	GetAccount                endpoint.Endpoint
	UpdateAccount             endpoint.Endpoint
	DeleteAccount             endpoint.Endpoint
	GetConfiguration          endpoint.Endpoint
	SendVerifyEmail           endpoint.Endpoint
	SendVerifyPhoneNumber     endpoint.Endpoint
}

Endpoints wraps a service behind a set of endpoints.

type GlnVerifier

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

GlnVerifier interface allows to check validity of a GLN

type KeycloakAccountClient

type KeycloakAccountClient interface {
	UpdatePassword(accessToken, realm, currentPassword, newPassword, confirmPassword string) (string, error)
	GetCredentials(accessToken string, realmName string) ([]kc.CredentialRepresentation, error)
	GetCredentialRegistrators(accessToken string, realmName string) ([]string, error)
	UpdateLabelCredential(accessToken string, realmName string, credentialID string, label string) error
	DeleteCredential(accessToken string, realmName string, credentialID string) error
	MoveToFirst(accessToken string, realmName string, credentialID string) error
	MoveAfter(accessToken string, realmName string, credentialID string, previousCredentialID string) error
	UpdateAccount(accessToken, realm string, user kc.UserRepresentation) error
	GetAccount(accessToken, realm string) (kc.UserRepresentation, error)
	DeleteAccount(accessToken, realm string) error
	ExecuteActionsEmail(accessToken string, realmName string, actions []string) error
	SendEmail(accessToken, realmName, template, subject string, recipient *string, attributes map[string]string) error
}

KeycloakAccountClient interface exposes methods we need to call to send requests to Keycloak API of Account

type KeycloakTechnicalClient

type KeycloakTechnicalClient interface {
	GetRealm(ctx context.Context, realmName string) (kc.RealmRepresentation, error)
	LogoutAllSessions(ctx context.Context, realmName string, userID string) error
}

KeycloakTechnicalClient interface exposes methods called by a technical account

type UpdatePasswordBody

type UpdatePasswordBody struct {
	CurrentPassword string `json:"currentPassword,omitempty"`
	NewPassword     string `json:"newPassword,omitempty"`
	ConfirmPassword string `json:"confirmPassword,omitempty"`
}

UpdatePasswordBody is the definition of the expected body content of UpdatePassword method

type UsersDetailsDBModule

type UsersDetailsDBModule interface {
	StoreOrUpdateUserDetails(ctx context.Context, realm string, user dto.DBUser) error
	GetUserDetails(ctx context.Context, realm string, userID string) (dto.DBUser, error)
}

UsersDetailsDBModule is the minimum required interface to access the users database

Jump to

Keyboard shortcuts

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