Documentation ¶
Index ¶
- Constants
- func MakeAccountHandler(e endpoint.Endpoint, logger log.Logger) *http_transport.Server
- func MakeAuthorizationAccountComponentMW(logger log.Logger, configDBModule keycloakb.ConfigurationDBModule) func(Component) Component
- func MakeDeleteAccountEndpoint(component Component) cs.Endpoint
- func MakeDeleteCredentialEndpoint(component Component) cs.Endpoint
- func MakeGetAccountEndpoint(component Component) cs.Endpoint
- func MakeGetConfigurationEndpoint(component Component) cs.Endpoint
- func MakeGetCredentialRegistratorsEndpoint(component Component) cs.Endpoint
- func MakeGetCredentialsEndpoint(component Component) cs.Endpoint
- func MakeMoveCredentialEndpoint(component Component) cs.Endpoint
- func MakeSendVerifyEmailEndpoint(component Component) cs.Endpoint
- func MakeSendVerifyPhoneNumberEndpoint(component Component) cs.Endpoint
- func MakeUpdateAccountEndpoint(component Component) cs.Endpoint
- func MakeUpdateLabelCredentialEndpoint(component Component) cs.Endpoint
- func MakeUpdatePasswordEndpoint(component Component) cs.Endpoint
- type Component
- type Endpoints
- type KeycloakAccountClient
- type UpdatePasswordBody
- type UsersDetailsDBModule
Constants ¶
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
const ( ActionVerifyEmail = "VERIFY_EMAIL" ActionVerifyPhoneNumber = "mobilephone-validation" )
Constants
const ( ReqBody = "body" PrmCredentialID = "credentialID" PrmPrevCredentialID = "previousCredentialID" PrmQryRealmID = "realm_id" )
Parameter names
Variables ¶
This section is empty.
Functions ¶
func MakeAccountHandler ¶
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 ¶
MakeDeleteAccountEndpoint makes the DeleteAccount endpoint to delete connected user.
func MakeDeleteCredentialEndpoint ¶
MakeDeleteCredentialEndpoint make the DeleteCredential endpoint to delete a credential of the current user.
func MakeGetAccountEndpoint ¶
MakeGetAccountEndpoint makes the GetAccount endpoint to get connected user's info.
func MakeGetConfigurationEndpoint ¶
MakeGetConfigurationEndpoint makes the GetConfiguration endpoint to get the config for selfservice application.
func MakeGetCredentialRegistratorsEndpoint ¶
MakeGetCredentialRegistratorsEndpoint make the GetCredentialRegistrators endpoint to retrieve the list of possible kind of credentials.
func MakeGetCredentialsEndpoint ¶
MakeGetCredentialsEndpoint makes the GetCredentials endpoint to list credentials of the current user.
func MakeMoveCredentialEndpoint ¶
MakeMoveCredentialEndpoint make the MoveCredential endpoint to change the priority of a credential of the current user.
func MakeSendVerifyEmailEndpoint ¶
MakeSendVerifyEmailEndpoint makes the SendVerifyEmail endpoint
func MakeSendVerifyPhoneNumberEndpoint ¶
MakeSendVerifyPhoneNumberEndpoint makes the SendVerifyPhoneNumber endpoint
func MakeUpdateAccountEndpoint ¶
MakeUpdateAccountEndpoint makes the UpdateAccount endpoint to update connected user's own info.
func MakeUpdateLabelCredentialEndpoint ¶
MakeUpdateLabelCredentialEndpoint make the UpdateLabelCredential endpoint to set a new label for a credential.
func MakeUpdatePasswordEndpoint ¶
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 UsersDetailsDBModule, 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 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 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