Documentation ¶
Overview ¶
ge-accounts/pkg/clientlib/accountslib/activation.go
ge-accounts/pkg/clientlib/accountslib/client.go
ge-accounts/pkg/clientlib/accountslib/user_metadata.go
ge-accounts/pkg/clientlib/accountslib/metadata_keys.go
ge-accounts/pkg/clientlib/accountslib/password-reset.go
ge-accounts/pkg/clientlib/accountslib/permissions.go
ge-accounts/pkg/clientlib/accountslib/roles.go
ge-accounts/pkg/clientlib/accountslib/sanctioned_countries.go
ge-accounts/pkg/clientlib/accountslib/service_accounts.go
ge-accounts/pkg/clientlib/accountslib/tokens.go
ge-accounts/pkg/clientlib/accountslib/users.go
Index ¶
- type ActivateUserInput
- type ActivationToken
- type AddSanctionedCountryInput
- type AssignPermissionToRoleEvent
- type AssignPermissionToRoleInput
- type AssignRoleData
- type AssignRoleInput
- type CheckPasswordHashData
- type CheckUserAuthorizationError
- type Client
- func (c *Client) ActivateUser(ctx context.Context, input ActivateUserInput) error
- func (c *Client) AddSanctionedCountry(input AddSanctionedCountryInput) error
- func (c *Client) AssignPermissionToRole(input AssignPermissionToRoleInput) error
- func (c *Client) AssignRoleToServiceAccount(input AssignRoleInput) error
- func (c *Client) AssignRoleToUser(data *AssignRoleData) error
- func (c *Client) CheckPasswordHash(data *CheckPasswordHashData) (bool, error)
- func (c *Client) CheckUserAuthorization(ctx context.Context, token, permission string) (bool, error)
- func (c *Client) CreateActivationToken(ctx context.Context, input CreateActivationTokenInput) (*ActivationToken, error)
- func (c *Client) CreateMetadataKey(input CreateMetadataKeyInput) (*MetadataKey, error)
- func (c *Client) CreatePasswordResetToken(ctx context.Context, input CreatePasswordResetTokenInput) (*PasswordResetToken, error)
- func (c *Client) CreatePermission(input CreatePermissionInput) (*Permission, error)
- func (c *Client) CreateRole(input *CreateRoleInput) (*Role, error)
- func (c *Client) CreateToken(input CreateTokenInput) (*Token, error)
- func (c *Client) CreateUser(data *User) error
- func (c *Client) CreateUserMetadata(metadata *UserMetadata) error
- func (c *Client) DeleteActivationToken(ctx context.Context, input DeleteActivationTokenInput) error
- func (c *Client) DeleteActivationTokenByUserID(ctx context.Context, input DeleteActivationTokenByUserIDInput) error
- func (c *Client) DeleteExpiredActivationTokens(ctx context.Context) error
- func (c *Client) DeleteExpiredPasswordResetTokens(ctx context.Context, input DeleteExpiredPasswordResetTokensInput) error
- func (c *Client) DeleteExpiredTokens() error
- func (c *Client) DeleteMetadataKey(input DeleteMetadataKeyInput) error
- func (c *Client) DeletePasswordResetToken(ctx context.Context, input DeletePasswordResetTokenInput) error
- func (c *Client) DeletePasswordResetTokenByUserID(ctx context.Context, input DeletePasswordResetTokenByUserIDInput) error
- func (c *Client) DeletePermission(input DeletePermissionInput) error
- func (c *Client) DeleteRole(input *DeleteRoleInput) error
- func (c *Client) DeleteServiceAccount(serviceAccountID uuid.UUID) error
- func (c *Client) DeleteToken(input DeleteTokenInput) error
- func (c *Client) DeleteTokensByUserID(input DeleteTokensByUserIDInput) error
- func (c *Client) DeleteUser(userID uuid.UUID) error
- func (c *Client) DeleteUserMetadataByID(id uuid.UUID) error
- func (c *Client) DeleteUserMetadataByKey(userID uuid.UUID, key string) error
- func (c *Client) DeleteUserMetadataByUserID(userID uuid.UUID) error
- func (c *Client) DisableTwoFactorAuthentication(data DisableTwoFactorAuthenticationInput) error
- func (c *Client) DoesPermissionExist(input *DoesPermissionExistInput) (bool, error)
- func (c *Client) DoesRoleExist(input DoesRoleExistInput) (bool, error)
- func (c *Client) EnableTwoFactorAuthentication(data EnableTwoFactorAuthenticationInput) error
- func (c *Client) GetActivationTokenByPlaintext(ctx context.Context, input GetActivationTokenByPlaintextInput) (*ActivationToken, error)
- func (c *Client) GetActivationTokensByUserID(ctx context.Context, input GetActivationTokensByUserIDInput) ([]ActivationToken, error)
- func (c *Client) GetMetadataKeyByID(input GetMetadataKeyByIDInput) (*UserMetadata, error)
- func (c *Client) GetMetadataKeyByKeyName(input GetMetadataKeyByKeyNameInput) (*MetadataKey, error)
- func (c *Client) GetPasswordResetTokenByPlaintext(ctx context.Context, input GetPasswordResetTokenByPlaintextInput) (*PasswordResetToken, error)
- func (c *Client) GetPasswordResetTokensByUserID(ctx context.Context, input GetPasswordResetTokensByUserIDInput) ([]PasswordResetToken, error)
- func (c *Client) GetPermissionByID(input GetPermissionByIDInput) (*Permission, error)
- func (c *Client) GetPermissionByName(input GetPermissionByNameInput) (*Permission, error)
- func (c *Client) GetPermissionsByRoleID(input *GetPermissionsByRoleIDInput) ([]Permission, error)
- func (c *Client) GetPermissionsByUserID(input *GetPermissionsByUserIDInput) ([]Permission, error)
- func (c *Client) GetRoleByID(roleID uuid.UUID) (*Role, error)
- func (c *Client) GetRoleByName(roleName string) (*Role, error)
- func (c *Client) GetRolesByPermissionID(input GetRolesByPermissionIDInput) ([]Role, error)
- func (c *Client) GetRolesByServiceAccountID(input GetRolesInput) ([]Role, error)
- func (c *Client) GetRolesByUserID(input GetRolesByUserIDInput) ([]Role, error)
- func (c *Client) GetRolesForUser(userID uuid.UUID) ([]Role, error)
- func (c *Client) GetServiceAccountByID(id uuid.UUID) (*ServiceAccount, error)
- func (c *Client) GetServiceAccountByName(serviceName string) (*ServiceAccount, error)
- func (c *Client) GetServiceAccountsByRoleID(input GetServiceAccountsInput) ([]ServiceAccount, error)
- func (c *Client) GetTokenByPlaintext(input GetTokenByPlaintextInput) (*Token, error)
- func (c *Client) GetTokensByScope(input GetTokensByScopeInput) ([]Token, error)
- func (c *Client) GetTokensByUserID(input GetTokensByUserIDInput) ([]Token, error)
- func (c *Client) GetUserByEmail(email string) (*User, error)
- func (c *Client) GetUserByID(id uuid.UUID) (*User, error)
- func (c *Client) GetUserMetadataByID(metadataID uuid.UUID) (*UserMetadata, error)
- func (c *Client) GetUserMetadataByKey(userID, key string) (*UserMetadata, error)
- func (c *Client) GetUserMetadataByUserID(userID uuid.UUID) (*[]UserMetadata, error)
- func (c *Client) IsCountrySanctioned(input IsCountrySanctionedInput) (bool, error)
- func (c *Client) IsPermissionAssignedToRole(input IsPermissionAssignedToRoleInput) (bool, error)
- func (c *Client) IsRoleAssignedToServiceAccount(input RoleAssignmentInput) (bool, error)
- func (c *Client) IsUserInRole(data *UserInRoleCheckData) (bool, error)
- func (c *Client) ListAllMetadataKeys() ([]MetadataKey, error)
- func (c *Client) ListAllUsers() ([]User, error)
- func (c *Client) ListPermissions() (*ListPermissionsResponse, error)
- func (c *Client) ListRoles() ([]Role, error)
- func (c *Client) ListServiceAccounts() ([]ServiceAccount, error)
- func (c *Client) MetadataKeyExists(keyName string) (bool, error)
- func (c *Client) ProcessPasswordReset(ctx context.Context, input ProcessPasswordResetInput) (*PasswordResetResponse, error)
- func (c *Client) RegisterServiceAccount(ctx context.Context, input RegisterServiceAccountInput) (*ServiceAccount, error)
- func (c *Client) RegisterUser(data *UserRegistrationData) error
- func (c *Client) RemovePermissionFromRole(input RemovePermissionFromRoleInput) error
- func (c *Client) RemoveRoleFromServiceAccount(input RemoveRoleInput) error
- func (c *Client) RemoveSanctionedCountry(input RemoveSanctionedCountryInput) error
- func (c *Client) SetUserActiveStatus(event *SetUserActiveStatusEvent) error
- func (c *Client) UnassignRoleFromUser(input *UserUnassignRoleInput) error
- func (c *Client) UpdateMetadataKey(input UpdateMetadataKeyInput) (*MetadataKey, error)
- func (c *Client) UpdatePermission(input UpdatePermissionInput) error
- func (c *Client) UpdateRole(input *UpdateRoleInput) error
- func (c *Client) UpdateServiceAccount(input UpdateServiceAccountInput) error
- func (c *Client) UpdateUser(userID uuid.UUID, payload *UpdateUserPayload) error
- func (c *Client) UpdateUserMetadata(userMetadata *UserMetadataUpdate) error
- func (c *Client) Validate() error
- func (c *Client) ValidatePasswordResetToken(ctx context.Context, input ValidatePasswordResetTokenInput) (*PasswordResetToken, error)
- func (c *Client) VerifyActivationToken(ctx context.Context, token string) (*ActivationToken, error)
- func (c *Client) VerifyEmail(event *VerifyEmailEvent) error
- func (c *Client) VerifyPasswordResetToken(ctx context.Context, input VerifyPasswordResetTokenInput) (*PasswordResetToken, error)
- func (c *Client) VerifyPhoneNumber(user *User) error
- func (c *Client) VerifyToken(token string) (*Token, error)
- type CreateActivationTokenInput
- type CreateMetadataKeyInput
- type CreatePasswordResetTokenInput
- type CreatePermissionInput
- type CreateRoleInput
- type CreateTokenInput
- type DeleteActivationTokenByUserIDInput
- type DeleteActivationTokenInput
- type DeleteExpiredPasswordResetTokensInput
- type DeleteMetadataKeyInput
- type DeletePasswordResetTokenByUserIDInput
- type DeletePasswordResetTokenInput
- type DeletePermissionInput
- type DeleteRoleInput
- type DeleteTokenInput
- type DeleteTokensByUserIDInput
- type DisableTwoFactorAuthenticationInput
- type DoesPermissionExistInput
- type DoesRoleExistInput
- type EnableTwoFactorAuthenticationInput
- type GetActivationTokenByPlaintextInput
- type GetActivationTokensByUserIDInput
- type GetMetadataKeyByIDInput
- type GetMetadataKeyByKeyNameInput
- type GetPasswordResetTokenByPlaintextInput
- type GetPasswordResetTokensByUserIDInput
- type GetPermissionByIDInput
- type GetPermissionByNameInput
- type GetPermissionsByRoleIDInput
- type GetPermissionsByUserIDInput
- type GetRolesByPermissionIDInput
- type GetRolesByUserIDInput
- type GetRolesInput
- type GetServiceAccountsInput
- type GetTokenByPlaintextInput
- type GetTokensByScopeInput
- type GetTokensByUserIDInput
- type IsCountrySanctionedInput
- type IsPermissionAssignedToRoleInput
- type ListPermissionsResponse
- type MetadataKey
- type MetadataKeyExistsInput
- type PasswordResetResponse
- type PasswordResetToken
- type Permission
- type PermissionRequest
- type PermissionResponse
- type ProcessPasswordResetInput
- type RegisterServiceAccountInput
- type RemovePermissionFromRoleEvent
- type RemovePermissionFromRoleInput
- type RemoveRoleInput
- type RemoveSanctionedCountryInput
- type Role
- type RoleAssignmentInput
- type RoleData
- type RolesForUserResponse
- type SanctionedCountry
- type ServiceAccount
- type SetUserActiveStatusEvent
- type Token
- type UpdateMetadataKeyInput
- type UpdatePermissionInput
- type UpdateRoleInput
- type UpdateServiceAccountInput
- type UpdateUserPayload
- type User
- type UserInRoleCheckData
- type UserMetadata
- type UserMetadataUpdate
- type UserRegistrationData
- type UserRemoveRoleEvent
- type UserRoleData
- type UserUnassignRoleInput
- type ValidatePasswordResetTokenInput
- type VerifyEmailEvent
- type VerifyPasswordResetTokenInput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActivateUserInput ¶
type ActivateUserInput struct {
Token string `json:"token"`
}
ActivateUserInput represents the input required to activate a user
type ActivationToken ¶
type ActivationToken struct { Token string `json:"token"` UserID uuid.UUID `json:"user_id"` Expiry string `json:"expiry"` }
ActivationToken represents an activation token record in the database
type AssignPermissionToRoleInput ¶
func (*AssignPermissionToRoleInput) Validate ¶
func (input *AssignPermissionToRoleInput) Validate() error
You would also need to define the Validate method for AssignPermissionToRoleEvent
type AssignRoleData ¶
AssignRoleData represents the input data to assign a role to a user.
func (*AssignRoleData) Validate ¶
func (d *AssignRoleData) Validate() error
Validate checks if the AssignRoleData structure is valid.
type AssignRoleInput ¶
type AssignRoleInput struct { ServiceAccountID uuid.UUID `json:"service_account_id"` RoleID uuid.UUID `json:"role_id"` }
AssignRoleInput represents the input data for assigning a role to a service account.
type CheckPasswordHashData ¶
type CheckPasswordHashData struct { UserID uuid.UUID `json:"userId"` Password string `json:"password"` }
func (*CheckPasswordHashData) Validate ¶
func (d *CheckPasswordHashData) Validate() error
type CheckUserAuthorizationError ¶
This is a custom error type
func (*CheckUserAuthorizationError) Error ¶
func (e *CheckUserAuthorizationError) Error() string
type Client ¶
Client represents an HTTP client that interacts with the API.
func (*Client) ActivateUser ¶
func (c *Client) ActivateUser(ctx context.Context, input ActivateUserInput) error
ActivateUser sends a request to activate a user with the given token
func (*Client) AddSanctionedCountry ¶
func (c *Client) AddSanctionedCountry(input AddSanctionedCountryInput) error
func (*Client) AssignPermissionToRole ¶
func (c *Client) AssignPermissionToRole(input AssignPermissionToRoleInput) error
func (*Client) AssignRoleToServiceAccount ¶
func (c *Client) AssignRoleToServiceAccount(input AssignRoleInput) error
func (*Client) AssignRoleToUser ¶
func (c *Client) AssignRoleToUser(data *AssignRoleData) error
AssignRoleToUser assigns a role to a user
func (*Client) CheckPasswordHash ¶
func (c *Client) CheckPasswordHash(data *CheckPasswordHashData) (bool, error)
func (*Client) CheckUserAuthorization ¶
func (c *Client) CheckUserAuthorization(ctx context.Context, token, permission string) (bool, error)
CheckUserAuthorization verifies a user's authorization to perform a certain action.
func (*Client) CreateActivationToken ¶
func (c *Client) CreateActivationToken(ctx context.Context, input CreateActivationTokenInput) (*ActivationToken, error)
func (*Client) CreateMetadataKey ¶
func (c *Client) CreateMetadataKey(input CreateMetadataKeyInput) (*MetadataKey, error)
func (*Client) CreatePasswordResetToken ¶
func (c *Client) CreatePasswordResetToken(ctx context.Context, input CreatePasswordResetTokenInput) (*PasswordResetToken, error)
CreatePasswordResetToken creates a password reset token for the user.
func (*Client) CreatePermission ¶
func (c *Client) CreatePermission(input CreatePermissionInput) (*Permission, error)
func (*Client) CreateRole ¶
func (c *Client) CreateRole(input *CreateRoleInput) (*Role, error)
func (*Client) CreateToken ¶
func (c *Client) CreateToken(input CreateTokenInput) (*Token, error)
CreateToken creates a new token for a user and returns it.
func (*Client) CreateUser ¶
func (*Client) CreateUserMetadata ¶
func (c *Client) CreateUserMetadata(metadata *UserMetadata) error
func (*Client) DeleteActivationToken ¶
func (c *Client) DeleteActivationToken(ctx context.Context, input DeleteActivationTokenInput) error
func (*Client) DeleteActivationTokenByUserID ¶
func (c *Client) DeleteActivationTokenByUserID(ctx context.Context, input DeleteActivationTokenByUserIDInput) error
func (*Client) DeleteExpiredActivationTokens ¶
DeleteExpiredActivationTokens deletes expired activation tokens
func (*Client) DeleteExpiredPasswordResetTokens ¶
func (c *Client) DeleteExpiredPasswordResetTokens(ctx context.Context, input DeleteExpiredPasswordResetTokensInput) error
DeleteExpiredPasswordResetTokens deletes expired password reset tokens
func (*Client) DeleteExpiredTokens ¶
func (*Client) DeleteMetadataKey ¶
func (c *Client) DeleteMetadataKey(input DeleteMetadataKeyInput) error
DeleteMetadataKey deletes a metadata key by its id.
func (*Client) DeletePasswordResetToken ¶
func (c *Client) DeletePasswordResetToken(ctx context.Context, input DeletePasswordResetTokenInput) error
DeletePasswordResetToken deletes a password reset token
func (*Client) DeletePasswordResetTokenByUserID ¶
func (c *Client) DeletePasswordResetTokenByUserID(ctx context.Context, input DeletePasswordResetTokenByUserIDInput) error
DeletePasswordResetTokenByUserID deletes password reset tokens for a specific user ID
func (*Client) DeletePermission ¶
func (c *Client) DeletePermission(input DeletePermissionInput) error
func (*Client) DeleteRole ¶
func (c *Client) DeleteRole(input *DeleteRoleInput) error
DeleteRole deletes a role using the API.
func (*Client) DeleteServiceAccount ¶
DeleteServiceAccount deletes a service account by its ID
func (*Client) DeleteToken ¶
func (c *Client) DeleteToken(input DeleteTokenInput) error
DeleteToken deletes a token associated with a user.
func (*Client) DeleteTokensByUserID ¶
func (c *Client) DeleteTokensByUserID(input DeleteTokensByUserIDInput) error
DeleteTokensByUserID sends a request to the server to delete all tokens for the given user ID.
func (*Client) DeleteUserMetadataByID ¶
DeleteUserMetadataByID deletes user metadata by its ID.
func (*Client) DeleteUserMetadataByKey ¶
func (*Client) DeleteUserMetadataByUserID ¶
func (*Client) DisableTwoFactorAuthentication ¶
func (c *Client) DisableTwoFactorAuthentication(data DisableTwoFactorAuthenticationInput) error
func (*Client) DoesPermissionExist ¶
func (c *Client) DoesPermissionExist(input *DoesPermissionExistInput) (bool, error)
func (*Client) DoesRoleExist ¶
func (c *Client) DoesRoleExist(input DoesRoleExistInput) (bool, error)
func (*Client) EnableTwoFactorAuthentication ¶
func (c *Client) EnableTwoFactorAuthentication(data EnableTwoFactorAuthenticationInput) error
func (*Client) GetActivationTokenByPlaintext ¶
func (c *Client) GetActivationTokenByPlaintext(ctx context.Context, input GetActivationTokenByPlaintextInput) (*ActivationToken, error)
GetActivationTokenByPlaintext retrieves an activation token by its plaintext value
func (*Client) GetActivationTokensByUserID ¶
func (c *Client) GetActivationTokensByUserID(ctx context.Context, input GetActivationTokensByUserIDInput) ([]ActivationToken, error)
GetActivationTokensByUserID fetches all activation tokens for a given user ID
func (*Client) GetMetadataKeyByID ¶
func (c *Client) GetMetadataKeyByID(input GetMetadataKeyByIDInput) (*UserMetadata, error)
func (*Client) GetMetadataKeyByKeyName ¶
func (c *Client) GetMetadataKeyByKeyName(input GetMetadataKeyByKeyNameInput) (*MetadataKey, error)
GetMetadataKeyByKeyName sends a GET request to the /metadata-keys/{keyName} endpoint of the account service to retrieve the metadata key by its key name.
func (*Client) GetPasswordResetTokenByPlaintext ¶
func (c *Client) GetPasswordResetTokenByPlaintext(ctx context.Context, input GetPasswordResetTokenByPlaintextInput) (*PasswordResetToken, error)
GetPasswordResetTokenByPlaintext retrieves a password reset token by its plaintext.
func (*Client) GetPasswordResetTokensByUserID ¶
func (c *Client) GetPasswordResetTokensByUserID(ctx context.Context, input GetPasswordResetTokensByUserIDInput) ([]PasswordResetToken, error)
GetPasswordResetTokensByUserID retrieves password reset tokens for the user by their user ID.
func (*Client) GetPermissionByID ¶
func (c *Client) GetPermissionByID(input GetPermissionByIDInput) (*Permission, error)
func (*Client) GetPermissionByName ¶
func (c *Client) GetPermissionByName(input GetPermissionByNameInput) (*Permission, error)
func (*Client) GetPermissionsByRoleID ¶
func (c *Client) GetPermissionsByRoleID(input *GetPermissionsByRoleIDInput) ([]Permission, error)
GetPermissionsByRoleID fetches the permissions associated with the provided role ID.
func (*Client) GetPermissionsByUserID ¶
func (c *Client) GetPermissionsByUserID(input *GetPermissionsByUserIDInput) ([]Permission, error)
func (*Client) GetRolesByPermissionID ¶
func (c *Client) GetRolesByPermissionID(input GetRolesByPermissionIDInput) ([]Role, error)
GetRolesByPermissionID retrieves all roles associated with a permission identified by its ID.
func (*Client) GetRolesByServiceAccountID ¶
func (c *Client) GetRolesByServiceAccountID(input GetRolesInput) ([]Role, error)
GetRolesByServiceAccountID retrieves roles associated with a specific service account ID
func (*Client) GetRolesByUserID ¶
func (c *Client) GetRolesByUserID(input GetRolesByUserIDInput) ([]Role, error)
func (*Client) GetServiceAccountByID ¶
func (c *Client) GetServiceAccountByID(id uuid.UUID) (*ServiceAccount, error)
GetServiceAccountByID sends a GET request to the server to retrieve a service account by its ID
func (*Client) GetServiceAccountByName ¶
func (c *Client) GetServiceAccountByName(serviceName string) (*ServiceAccount, error)
func (*Client) GetServiceAccountsByRoleID ¶
func (c *Client) GetServiceAccountsByRoleID(input GetServiceAccountsInput) ([]ServiceAccount, error)
func (*Client) GetTokenByPlaintext ¶
func (c *Client) GetTokenByPlaintext(input GetTokenByPlaintextInput) (*Token, error)
func (*Client) GetTokensByScope ¶
func (c *Client) GetTokensByScope(input GetTokensByScopeInput) ([]Token, error)
GetTokensByScope gets all tokens associated with a scope.
func (*Client) GetTokensByUserID ¶
func (c *Client) GetTokensByUserID(input GetTokensByUserIDInput) ([]Token, error)
GetTokensByUserID gets all tokens associated with a user ID.
func (*Client) GetUserByID ¶
GetUserByID fetches a user using the user's ID
func (*Client) GetUserMetadataByID ¶
func (c *Client) GetUserMetadataByID(metadataID uuid.UUID) (*UserMetadata, error)
GetUserMetadataByID retrieves user metadata by ID
func (*Client) GetUserMetadataByKey ¶
func (c *Client) GetUserMetadataByKey(userID, key string) (*UserMetadata, error)
func (*Client) GetUserMetadataByUserID ¶
func (c *Client) GetUserMetadataByUserID(userID uuid.UUID) (*[]UserMetadata, error)
GetUserMetadataByUserID fetches a user's metadata from the server.
func (*Client) IsCountrySanctioned ¶
func (c *Client) IsCountrySanctioned(input IsCountrySanctionedInput) (bool, error)
func (*Client) IsPermissionAssignedToRole ¶
func (c *Client) IsPermissionAssignedToRole(input IsPermissionAssignedToRoleInput) (bool, error)
IsPermissionAssignedToRole checks if a permission is assigned to a role.
func (*Client) IsRoleAssignedToServiceAccount ¶
func (c *Client) IsRoleAssignedToServiceAccount(input RoleAssignmentInput) (bool, error)
func (*Client) IsUserInRole ¶
func (c *Client) IsUserInRole(data *UserInRoleCheckData) (bool, error)
func (*Client) ListAllMetadataKeys ¶
func (c *Client) ListAllMetadataKeys() ([]MetadataKey, error)
ListAllMetadataKeys retrieves all metadata keys.
func (*Client) ListAllUsers ¶
ListAllUsers sends a GET request to the accounts server to get a list of all users.
func (*Client) ListPermissions ¶
func (c *Client) ListPermissions() (*ListPermissionsResponse, error)
func (*Client) ListServiceAccounts ¶
func (c *Client) ListServiceAccounts() ([]ServiceAccount, error)
func (*Client) MetadataKeyExists ¶
MetadataKeyExists sends a GET request to the service to determine if a metadata key exists. It returns true if it exists, false if not, and any error that occurred.
func (*Client) ProcessPasswordReset ¶
func (c *Client) ProcessPasswordReset(ctx context.Context, input ProcessPasswordResetInput) (*PasswordResetResponse, error)
ProcessPasswordReset processes a password reset using the provided token and new password.
func (*Client) RegisterServiceAccount ¶
func (c *Client) RegisterServiceAccount(ctx context.Context, input RegisterServiceAccountInput) (*ServiceAccount, error)
RegisterServiceAccount registers a new service account with the provided name and roles.
func (*Client) RegisterUser ¶
func (c *Client) RegisterUser(data *UserRegistrationData) error
func (*Client) RemovePermissionFromRole ¶
func (c *Client) RemovePermissionFromRole(input RemovePermissionFromRoleInput) error
func (*Client) RemoveRoleFromServiceAccount ¶
func (c *Client) RemoveRoleFromServiceAccount(input RemoveRoleInput) error
RemoveRoleFromServiceAccount removes a role from a service account.
func (*Client) RemoveSanctionedCountry ¶
func (c *Client) RemoveSanctionedCountry(input RemoveSanctionedCountryInput) error
func (*Client) SetUserActiveStatus ¶
func (c *Client) SetUserActiveStatus(event *SetUserActiveStatusEvent) error
func (*Client) UnassignRoleFromUser ¶
func (c *Client) UnassignRoleFromUser(input *UserUnassignRoleInput) error
UnassignRoleFromUser removes a role from a user.
func (*Client) UpdateMetadataKey ¶
func (c *Client) UpdateMetadataKey(input UpdateMetadataKeyInput) (*MetadataKey, error)
func (*Client) UpdatePermission ¶
func (c *Client) UpdatePermission(input UpdatePermissionInput) error
func (*Client) UpdateRole ¶
func (c *Client) UpdateRole(input *UpdateRoleInput) error
func (*Client) UpdateServiceAccount ¶
func (c *Client) UpdateServiceAccount(input UpdateServiceAccountInput) error
UpdateServiceAccount sends a request to update a service account.
func (*Client) UpdateUser ¶
func (c *Client) UpdateUser(userID uuid.UUID, payload *UpdateUserPayload) error
func (*Client) UpdateUserMetadata ¶
func (c *Client) UpdateUserMetadata(userMetadata *UserMetadataUpdate) error
UpdateUserMetadata sends an HTTP request to update user metadata.
func (*Client) ValidatePasswordResetToken ¶
func (c *Client) ValidatePasswordResetToken(ctx context.Context, input ValidatePasswordResetTokenInput) (*PasswordResetToken, error)
ValidatePasswordResetToken validates a password reset token
func (*Client) VerifyActivationToken ¶
VerifyActivationToken verifies the provided activation token
func (*Client) VerifyEmail ¶
func (c *Client) VerifyEmail(event *VerifyEmailEvent) error
func (*Client) VerifyPasswordResetToken ¶
func (c *Client) VerifyPasswordResetToken(ctx context.Context, input VerifyPasswordResetTokenInput) (*PasswordResetToken, error)
VerifyPasswordResetToken verifies a password reset token
func (*Client) VerifyPhoneNumber ¶
type CreateActivationTokenInput ¶
CreateActivationTokenInput represents the input required to create an activation token
type CreateMetadataKeyInput ¶
type CreateMetadataKeyInput struct {
KeyName string `json:"key_name"`
}
type CreatePasswordResetTokenInput ¶
CreatePasswordResetTokenInput represents the input required to create a password reset token.
type CreatePermissionInput ¶
type CreateRoleInput ¶
type CreateRoleInput struct { Name string Description string CompanyDomainOnly bool IsInternal bool UserID uuid.UUID }
func (*CreateRoleInput) Validate ¶
func (input *CreateRoleInput) Validate() error
type CreateTokenInput ¶
CreateTokenInput represents the input data for creating a new token.
type DeleteActivationTokenByUserIDInput ¶
DeleteActivationTokenByUserIDInput represents the input required to delete activation tokens by user ID
type DeleteActivationTokenInput ¶
DeleteActivationTokenInput represents the input required to delete an activation token
type DeleteExpiredPasswordResetTokensInput ¶
type DeleteExpiredPasswordResetTokensInput struct{}
DeleteExpiredPasswordResetTokensInput represents the input required to delete expired password reset tokens
type DeleteMetadataKeyInput ¶
type DeletePasswordResetTokenByUserIDInput ¶
DeletePasswordResetTokenByUserIDInput represents the input required to delete password reset tokens by user ID
type DeletePasswordResetTokenInput ¶
DeletePasswordResetTokenInput represents the input required to delete a password reset token
type DeletePermissionInput ¶
type DeleteTokenInput ¶
type DeleteTokenInput struct { UserID uuid.UUID `json:"userId"` TokenID uuid.UUID `json:"tokenId"` }
DeleteTokenInput represents the input data for deleting a token.
type DeleteTokensByUserIDInput ¶
DeleteTokensByUserIDInput represents the input for deleting all tokens of a user.
type DoesRoleExistInput ¶
type GetActivationTokenByPlaintextInput ¶
type GetActivationTokenByPlaintextInput struct {
Plaintext string `json:"plaintext"`
}
GetActivationTokenByPlaintextInput represents the input required to get an activation token by plaintext
type GetActivationTokensByUserIDInput ¶
GetActivationTokensByUserIDInput represents the input required to get activation tokens by user ID
type GetMetadataKeyByIDInput ¶
type GetMetadataKeyByKeyNameInput ¶
type GetMetadataKeyByKeyNameInput struct {
KeyName string `json:"key_name"`
}
type GetPasswordResetTokenByPlaintextInput ¶
type GetPasswordResetTokenByPlaintextInput struct {
Plaintext string `json:"plaintext"`
}
GetPasswordResetTokenByPlaintextInput represents the input required to get a password reset token by plaintext
type GetPasswordResetTokensByUserIDInput ¶
GetPasswordResetTokensByUserIDInput represents the input required to get password reset tokens by user ID
type GetPermissionByIDInput ¶
type GetPermissionByNameInput ¶
type GetPermissionByNameInput struct {
PermissionName string
}
type GetRolesByUserIDInput ¶
type GetRolesInput ¶
GetRolesInput represents the input data for retrieving roles of a service account.
type GetServiceAccountsInput ¶
GetServiceAccountsInput represents the input data for retrieving service accounts by a role ID.
type GetTokenByPlaintextInput ¶
type GetTokenByPlaintextInput struct {
Plaintext string `json:"plaintext"`
}
GetTokenByPlaintextInput represents the input data for retrieving a token by plaintext.
type GetTokensByScopeInput ¶
type GetTokensByScopeInput struct {
Scope string `json:"scope"`
}
GetTokensByScopeInput represents the input data for retrieving a token by scope.
type GetTokensByUserIDInput ¶
GetTokensByUserIDInput represents the input data for retrieving a token by user ID.
type IsCountrySanctionedInput ¶
type IsCountrySanctionedInput struct {
CountryCode string
}
type ListPermissionsResponse ¶
type ListPermissionsResponse struct {
Permissions []Permission `json:"permissions"`
}
type MetadataKey ¶
MetadataKey represents a metadata key record in the database
type MetadataKeyExistsInput ¶
type MetadataKeyExistsInput struct {
KeyName string
}
type PasswordResetResponse ¶
type PasswordResetResponse struct { Message string `json:"message"` UserID uuid.UUID `json:"user_id"` }
PasswordResetResponse represents the response from the password reset processing endpoint.
type PasswordResetToken ¶
type PasswordResetToken struct { Token string `json:"token"` UserID uuid.UUID `json:"user_id"` CreatedAt string `json:"created_at"` Expiry string `json:"expiry"` }
PasswordResetToken represents a password reset token record in the database
type Permission ¶
type Permission struct { ID uuid.UUID `json:"id"` Name string `json:"name"` Description string `json:"description"` }
Permission represents the structure of a permission.
type PermissionRequest ¶
type PermissionRequest struct { Token string `json:"token"` Permissions string `json:"permissions"` }
PermissionRequest represents the JSON request body sent to the authentication server to check a service account's permissions.
type PermissionResponse ¶
type PermissionResponse struct {
HasPermission bool `json:"has_permission"`
}
PermissionResponse represents the JSON response returned from the authentication server when checking a service account's permissions.
type ProcessPasswordResetInput ¶
type ProcessPasswordResetInput struct { Token string `json:"token"` NewPassword string `json:"new_password"` }
ProcessPasswordResetInput represents the input required to process a password reset.
type RemovePermissionFromRoleInput ¶
func (*RemovePermissionFromRoleInput) Validate ¶
func (input *RemovePermissionFromRoleInput) Validate() error
type RemoveRoleInput ¶
type RemoveRoleInput struct { ServiceAccountID uuid.UUID `json:"service_account_id"` RoleID uuid.UUID `json:"role_id"` }
RemoveRoleInput represents the input data for removing a role from a service account.
type RemoveSanctionedCountryInput ¶
type RemoveSanctionedCountryInput struct {
CountryCode string
}
type Role ¶
type Role struct { ID uuid.UUID `json:"id"` Name string `json:"name"` Description string `json:"description"` CompanyDomainOnly bool `json:"company_domain_only"` IsInternal bool `json:"is_internal"` }
Role represents the structure of a role.
type RoleAssignmentInput ¶
type RoleAssignmentInput struct { ServiceAccountID uuid.UUID `json:"service_account_id"` RoleID uuid.UUID `json:"role_id"` }
RoleAssignmentInput represents the input data for checking a role assignment.
type RoleData ¶
type RoleData struct { Name string `json:"name"` Description string `json:"description"` CompanyDomainOnly bool `json:"company_domain_only"` IsInternal bool `json:"is_internal"` }
RoleData represents the input data for a new role.
type RolesForUserResponse ¶
type RolesForUserResponse struct {
Roles []Role `json:"roles"`
}
type SanctionedCountry ¶
type SanctionedCountry struct { ID uuid.UUID `json:"id"` CountryCode string `json:"country_code"` CountryName string `json:"country_name"` AddedAt time.Time `json:"added_at"` }
SanctionedCountry represents the structure of a sanctioned country.
type ServiceAccount ¶
type ServiceAccount struct { ID uuid.UUID `db:"id" json:"id"` Secret string `db:"secret" json:"secret"` ServiceName string `db:"service_name" json:"service_name"` Roles []string `json:"roles"` CreatedAt time.Time `db:"created_at" json:"created_at"` ExpiresAt *time.Time `db:"expires_at" json:"expires_at,omitempty"` }
ServiceAccount represents the structure of a service account.
type SetUserActiveStatusEvent ¶
type SetUserActiveStatusEvent struct { UserID string `json:"user_id"` IsActive bool `json:"is_active"` }
SetUserActiveStatusEvent represents the event of a user's active status change.
func (*SetUserActiveStatusEvent) Validate ¶
func (e *SetUserActiveStatusEvent) Validate() error
Validate validates the SetUserActiveStatusEvent data.
type Token ¶
type Token struct { Plaintext string Hash []byte UserID uuid.UUID Expiry time.Time Scope string Error error }
Token represents the structure of a token.
type UpdateMetadataKeyInput ¶
type UpdatePermissionInput ¶
type UpdatePermissionInput struct { ID uuid.UUID `json:"id"` Name string `json:"name"` Description string `json:"description"` }
func (*UpdatePermissionInput) Validate ¶
func (input *UpdatePermissionInput) Validate() error
type UpdateRoleInput ¶
type UpdateServiceAccountInput ¶
type UpdateServiceAccountInput struct { ID uuid.UUID `json:"id"` ServiceName string `json:"service_name"` Roles []string `json:"roles"` ExpiresAt *time.Time `json:"expires_at,omitempty"` }
UpdateServiceAccountInput represents the input data for updating a service account.
type UpdateUserPayload ¶
type UpdateUserPayload struct { Email *string `json:"email,omitempty"` Userhandle *string `json:"userhandle,omitempty"` FirstName *string `json:"first_name,omitempty"` LastName *string `json:"last_name,omitempty"` DisplayName *string `json:"display_name,omitempty"` IsActive *bool `json:"is_active,omitempty"` IsEmailVerified *bool `json:"is_email_verified,omitempty"` IsPhoneVerified *bool `json:"is_phone_verified,omitempty"` TwoFactorEnabled *bool `json:"two_factor_enabled,omitempty"` }
func (*UpdateUserPayload) Validate ¶
func (u *UpdateUserPayload) Validate() error
type User ¶
type User struct { ID uuid.UUID `json:"id"` Email string `json:"email"` Userhandle string `json:"userhandle,omitempty"` PasswordHash []byte `json:"-"` FirstName string `json:"first_name,omitempty"` LastName string `json:"last_name,omitempty"` DisplayName string `json:"display_name,omitempty"` AvatarURL string `json:"avatar_url,omitempty"` PhoneNumber string `json:"phone_number,omitempty"` IsActive bool `json:"is_active"` IsEmailVerified bool `json:"is_email_verified"` IsPhoneVerified bool `json:"is_phone_verified"` TwoFactorEnabled bool `json:"two_factor_enabled"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at,omitempty"` }
User represents the structure of a user.
type UserInRoleCheckData ¶
type UserInRoleCheckData struct { UserID uuid.UUID `json:"user_id"` RoleID uuid.UUID `json:"role_id"` }
UserInRoleCheckData represents the input data for a user role check.
type UserMetadata ¶
type UserMetadata struct { ID uuid.UUID `json:"id"` UserID uuid.UUID `json:"user_id"` KeyID uuid.UUID `json:"key"` Value string `json:"value"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at,omitempty"` }
UserMetadata represents the structure of a user metadata.
func (*UserMetadata) Validate ¶
func (u *UserMetadata) Validate() error
type UserMetadataUpdate ¶
type UserMetadataUpdate struct { ID uuid.UUID `json:"id"` UserID uuid.UUID `json:"user_id"` Key string `json:"key"` Value string `json:"value"` }
UserMetadataUpdate represents the input data for updating user metadata.
func (*UserMetadataUpdate) Validate ¶
func (u *UserMetadataUpdate) Validate() error
Validate validates the UserMetadataUpdate fields.
type UserRegistrationData ¶
UserRegistrationData represents the input data for a new user registration.
func (*UserRegistrationData) Validate ¶
func (d *UserRegistrationData) Validate() error
Validate validates the UserRegistrationData fields.
type UserRemoveRoleEvent ¶
type UserRemoveRoleEvent struct { UserID uuid.UUID `json:"user_id"` RoleID uuid.UUID `json:"role_id"` }
UserRemoveRoleEvent represents the payload structure for the RemoveRoleFromUser event.
type UserRoleData ¶
type UserUnassignRoleInput ¶
type ValidatePasswordResetTokenInput ¶
type ValidatePasswordResetTokenInput struct {
Token string `json:"token"`
}
ValidatePasswordResetTokenInput represents the input required to validate a password reset token
type VerifyEmailEvent ¶
func (*VerifyEmailEvent) Validate ¶
func (e *VerifyEmailEvent) Validate() error
type VerifyPasswordResetTokenInput ¶
type VerifyPasswordResetTokenInput struct {
Token string `json:"token"`
}
VerifyPasswordResetTokenInput represents the input required to verify a password reset token