account

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: 18 Imported by: 0

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.AccountRepresentation) 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, eventDBModule database.EventsDBModule, configDBModule keycloakb.ConfigurationDBModule, usersDBModule UsersDBModule, logger internal.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 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
}

KeycloakAccountClient interface exposes methods we need to call to send requests to Keycloak API of 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 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)
}

UsersDBModule 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