Documentation ¶
Index ¶
- Constants
- func MakeAccountHandler(e endpoint.Endpoint, logger log.Logger) *http_transport.Server
- func MakeAuthorizationAccountComponentMW(logger log.Logger, configDBModule ConfigurationDBModule) func(Component) Component
- func MakeDeleteAccountEndpoint(component AccountComponent) cs.Endpoint
- func MakeDeleteCredentialEndpoint(component AccountComponent) cs.Endpoint
- func MakeGetAccountEndpoint(component AccountComponent) cs.Endpoint
- func MakeGetConfigurationEndpoint(component AccountComponent) cs.Endpoint
- func MakeGetCredentialRegistratorsEndpoint(component AccountComponent) cs.Endpoint
- func MakeGetCredentialsEndpoint(component AccountComponent) cs.Endpoint
- func MakeMoveCredentialEndpoint(component AccountComponent) cs.Endpoint
- func MakeUpdateAccountEndpoint(component AccountComponent) cs.Endpoint
- func MakeUpdateLabelCredentialEndpoint(component AccountComponent) cs.Endpoint
- func MakeUpdatePasswordEndpoint(component AccountComponent) cs.Endpoint
- type AccountComponent
- type Component
- type ConfigurationDBModule
- type Endpoints
- type KeycloakAccountClient
- type UpdatePasswordBody
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
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 ConfigurationDBModule) func(Component) Component
MakeAuthorizationAccountComponentMW checks authorization and return an error if the action is not allowed.
func MakeDeleteAccountEndpoint ¶
func MakeDeleteAccountEndpoint(component AccountComponent) cs.Endpoint
MakeDeleteAccountEndpoint makes the DeleteAccount endpoint to delete connected user.
func MakeDeleteCredentialEndpoint ¶
func MakeDeleteCredentialEndpoint(component AccountComponent) cs.Endpoint
MakeDeleteCredentialEndpoint make the DeleteCredential endpoint to delete a credential of the current user.
func MakeGetAccountEndpoint ¶
func MakeGetAccountEndpoint(component AccountComponent) cs.Endpoint
MakeGetAccountEndpoint makes the GetAccount endpoint to get connected user's info.
func MakeGetConfigurationEndpoint ¶
func MakeGetConfigurationEndpoint(component AccountComponent) cs.Endpoint
MakeGetConfigurationEndpoint makes the GetConfiguration endpoint to get the config for selfservice application.
func MakeGetCredentialRegistratorsEndpoint ¶
func MakeGetCredentialRegistratorsEndpoint(component AccountComponent) cs.Endpoint
MakeGetCredentialRegistratorsEndpoint make the GetCredentialRegistrators endpoint to retrieve the list of possible kind of credentials.
func MakeGetCredentialsEndpoint ¶
func MakeGetCredentialsEndpoint(component AccountComponent) cs.Endpoint
MakeGetCredentialsEndpoint makes the GetCredentials endpoint to list credentials of the current user.
func MakeMoveCredentialEndpoint ¶
func MakeMoveCredentialEndpoint(component AccountComponent) cs.Endpoint
MakeMoveCredentialEndpoint make the MoveCredential endpoint to change the priority of a credential of the current user.
func MakeUpdateAccountEndpoint ¶
func MakeUpdateAccountEndpoint(component AccountComponent) cs.Endpoint
MakeUpdateAccountEndpoint makes the UpdateAccount endpoint to update connected user's own info.
func MakeUpdateLabelCredentialEndpoint ¶
func MakeUpdateLabelCredentialEndpoint(component AccountComponent) cs.Endpoint
MakeUpdateLabelCredentialEndpoint make the UpdateLabelCredential endpoint to set a new label for a credential.
func MakeUpdatePasswordEndpoint ¶
func MakeUpdatePasswordEndpoint(component AccountComponent) cs.Endpoint
MakeUpdatePasswordEndpoint makes the UpdatePassword endpoint to update connected user's own password.
Types ¶
type AccountComponent ¶
type AccountComponent 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(ctx context.Context, account api.AccountRepresentation) error DeleteAccount(ctx context.Context) error GetConfiguration(ctx context.Context) (api.Configuration, error) }
AccountComponent describes methods of the Account API
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) (api.Configuration, error) }
Component interface exposes methods used by the bridge API
func NewComponent ¶
func NewComponent(keycloakAccountClient KeycloakAccountClient, eventDBModule database.EventsDBModule, configDBModule ConfigurationDBModule, logger internal.Logger) Component
NewComponent returns the self-service component.
type ConfigurationDBModule ¶
type ConfigurationDBModule interface { NewTransaction(context context.Context) (database.Transaction, error) StoreOrUpdate(context.Context, string, dto.RealmConfiguration) error GetConfiguration(context.Context, string) (dto.RealmConfiguration, error) GetAuthorizations(context context.Context, realmID string, groupID string) ([]dto.Authorization, error) CreateAuthorization(context context.Context, authz dto.Authorization) error DeleteAuthorizations(context context.Context, realmID string, groupID string) error DeleteAllAuthorizationsWithGroup(context context.Context, realmID, groupName string) error }
ConfigurationDBModule is the interface of the configuration module.
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 }
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 }
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