Documentation ¶
Index ¶
- Constants
- Variables
- func MapCognitoErrorToLocalError(ctx context.Context, cognitoErr awserr.Error) string
- type AccessToken
- type ChangePassword
- func (p ChangePassword) BuildAuthChallengeResponseRequest(clientSecret string, clientId string, challengeName string) *cognitoidentityprovider.RespondToAuthChallengeInput
- func (p ChangePassword) BuildAuthChallengeSuccessfulJsonResponse(ctx context.Context, ...) ([]byte, error)
- func (p ChangePassword) BuildConfirmForgotPasswordRequest(clientSecret string, clientId string) *cognitoidentityprovider.ConfirmForgotPasswordInput
- func (p ChangePassword) ValidateForgottenPasswordRequest(ctx context.Context) []error
- func (p ChangePassword) ValidateNewPasswordRequiredRequest(ctx context.Context) []error
- type CreateGroup
- func (c *CreateGroup) BuildCreateGroupInput(userPoolId *string) *cognitoidentityprovider.CreateGroupInput
- func (c *CreateGroup) BuildSuccessfulJsonResponse(ctx context.Context) ([]byte, error)
- func (c *CreateGroup) GenerateGroupName()
- func (g *CreateGroup) ValidateCreateGroupRequest(ctx context.Context) []error
- type CreateUserInput
- type CreateUserOutput
- type Error
- type ErrorResponse
- type GlobalSignOut
- type Group
- func (g *Group) BuildAddUserToGroupRequest(userPoolId, userId string) *cognitoidentityprovider.AdminAddUserToGroupInput
- func (g *Group) BuildCreateGroupRequest(userPoolId string) *cognitoidentityprovider.CreateGroupInput
- func (g *Group) BuildGetGroupRequest(userPoolId string) *cognitoidentityprovider.GetGroupInput
- func (g *Group) BuildListUsersInGroupRequest(userPoolId string) *cognitoidentityprovider.ListUsersInGroupInput
- func (g *Group) BuildListUsersInGroupRequestWithNextToken(userPoolId string, nextToken string) *cognitoidentityprovider.ListUsersInGroupInput
- func (g *Group) BuildRemoveUserFromGroupRequest(userPoolId, userId string) *cognitoidentityprovider.AdminRemoveUserFromGroupInput
- func (g *Group) BuildSuccessfulJsonResponse(ctx context.Context) ([]byte, error)
- func (g *Group) MapCognitoDetails(groupDetails *cognitoidentityprovider.GroupType)
- func (g *Group) MapMembers(membersList *[]*cognitoidentityprovider.UserType)
- func (g *Group) ValidateAddRemoveUser(ctx context.Context, userId string) []error
- type IdClaims
- type IdToken
- type ListUserGroupType
- type ListUserGroups
- type ListUsersInput
- type ListUsersOutput
- type PasswordReset
- type RefreshToken
- func (t *RefreshToken) BuildSuccessfulJsonResponse(ctx context.Context, result *cognitoidentityprovider.InitiateAuthOutput) ([]byte, error)
- func (t *RefreshToken) GenerateRefreshRequest(clientSecret string, username string, clientId string) *cognitoidentityprovider.InitiateAuthInput
- func (t *RefreshToken) Validate(ctx context.Context) *Error
- type SuccessResponse
- type UserParams
- func (p UserParams) BuildAdminGetUserRequest(userPoolId string) *cognitoidentityprovider.AdminGetUserInput
- func (p UserParams) BuildCreateUserRequest(userId string, userPoolId string) *cognitoidentityprovider.AdminCreateUserInput
- func (p UserParams) BuildDisableUserRequest(userPoolId string) *cognitoidentityprovider.AdminDisableUserInput
- func (p UserParams) BuildEnableUserRequest(userPoolId string) *cognitoidentityprovider.AdminEnableUserInput
- func (p UserParams) BuildListUserGroupsRequest(userPoolId string, nextToken string) *cognitoidentityprovider.AdminListGroupsForUserInput
- func (p UserParams) BuildSuccessfulJsonResponse(ctx context.Context) ([]byte, error)
- func (p UserParams) BuildUpdateUserRequest(userPoolId string) *cognitoidentityprovider.AdminUpdateUserAttributesInput
- func (p UserParams) CheckForDuplicateEmail(ctx context.Context, listUserResp *cognitoidentityprovider.ListUsersOutput) error
- func (p *UserParams) GeneratePassword(ctx context.Context) error
- func (p UserParams) MapCognitoDetails(userDetails *cognitoidentityprovider.UserType) UserParams
- func (p *UserParams) MapCognitoGetResponse(userDetails *cognitoidentityprovider.AdminGetUserOutput)
- func (p UserParams) ValidateRegistration(ctx context.Context, allowedDomains []string) []error
- func (p UserParams) ValidateUpdate(ctx context.Context) []error
- type UserSignIn
- func (p *UserSignIn) BuildCognitoRequest(clientId string, clientSecret string, clientAuthFlow string) *cognitoidentityprovider.InitiateAuthInput
- func (p *UserSignIn) BuildSuccessfulJsonResponse(ctx context.Context, result *cognitoidentityprovider.InitiateAuthOutput, ...) ([]byte, error)
- func (p *UserSignIn) ValidateCredentials(ctx context.Context) *[]error
- type UsersList
- func (p UsersList) BuildListUserRequest(filterString string, requiredAttribute string, limit int64, ...) *cognitoidentityprovider.ListUsersInput
- func (p *UsersList) BuildSuccessfulJsonResponse(ctx context.Context) ([]byte, error)
- func (p *UsersList) MapCognitoUsers(cognitoResults *[]*cognitoidentityprovider.UserType)
- func (p *UsersList) SetUsers(usersList *[]UserParams)
Constants ¶
const ( BodyReadError = "RequestBodyReadError" JSONMarshalError = "JSONMarshalError" JSONUnmarshalError = "JSONUnmarshalError" WriteResponseError = "WriteResponseError" InvalidUserIdError = "InvalidUserId" InvalidGroupNameError = "InvalidGroupName" InvalidForenameError = "InvalidForename" InvalidSurnameError = "InvalidSurname" InvalidStatusNotesError = "InvalidStatusNotes" InvalidEmailError = "InvalidEmail" InvalidTokenError = "InvalidToken" InternalError = "InternalServerError" NotFoundError = "NotFound" UserNotFoundError = "UserNotFound" GroupExistsError = "GroupExists" GroupNotFoundError = "GroupNotFound" DeliveryFailureError = "DeliveryFailure" InvalidCodeError = "InvalidCode" ExpiredCodeError = "ExpiredCode" InvalidFieldError = "InvalidField" InvalidPasswordError = "InvalidPassword" LimitExceededError = "LimitExceeded" NotAuthorisedError = "NotAuthorised" PasswordResetRequiredError = "PasswordResetRequired" TooManyFailedAttemptsError = "TooManyFailedAttempts" TooManyRequestsError = "TooManyRequests" UserNotConfirmedError = "UserNotConfirmed" UsernameExistsError = "UsernameExists" MissingConfigError = "MissingConfig" UnknownRequestTypeError = "UnknownRequestType" NotImplementedError = "NotImplemented" InvalidChallengeSessionError = "InvalidChallengeSession" InvalidUserPoolError = "InvalidUserPool" BodyCloseError = "BodyCloseError" InvalidGroupDescription = "InvalidGroupDescription" InvalidGroupPrecedence = "InvalidGroupPrecedence" )
API error codes
const ( MissingAuthorizationTokenDescription = "no Authorization token was provided" MissingRefreshTokenDescription = "no Refresh token was provided" MissingIDTokenDescription = "no ID token was provided" MalformedIDTokenDescription = "the ID token could not be parsed" MalformedAuthorizationTokenDescription = "the authorization token does not meet the required format" ErrorMarshalFailedDescription = "failed to marshal the error" ErrorUnmarshalFailedDescription = "failed to unmarshal the request body" WriteResponseFailedDescription = "failed to write http response" CastingAWSErrorFailedDescription = "failed to cast error to AWS error" UnrecognisedCognitoResponseDescription = "unexpected response from cognito" BodyReadFailedDescription = "endpoint returned an error reading the request body" InvalidPasswordDescription = "the submitted password could not be validated" PasswordGenerationErrorDescription = "failed to generate a valid password" MissingGroupNameErrorDescription = "the group name was missing" MissingUserIdErrorDescription = "the user id was missing" InvalidForenameErrorDescription = "the submitted user's forename could not be validated" InvalidSurnameErrorDescription = "the submitted user's lastname could not be validated" InvalidEmailDescription = "the submitted email could not be validated" DuplicateEmailDescription = "account using email address found" SignInFailedDescription = "Incorrect username or password." SignInAttemptsExceededDescription = "Password attempts exceeded" MissingConfigDescription = "required configuration setting is missing" UnknownPasswordChangeTypeDescription = "unknown password change type received" NotImplementedDescription = "this feature has not been implemented yet" InvalidChallengeSessionDescription = "no valid auth challenge session was provided" InvalidTokenDescription = "the submitted token could not be validated" TooLongStatusNotesDescription = "the status notes are too long" InvalidUserPoolDescription = "dummy data load being run against non local userpool" BodyClosedFailedDescription = "the request body failed to close" MissingGroupDescription = "the group description was not found" MissingGroupPrecedence = "the group precedence was not found" GroupPrecedenceIncorrect = "the group precedence needs to be a minumum of 3" IncorrectPatternInGroupDescription = "a group description cannot start with 'role_' or 'ROLE_'" GroupAlreadyExistsDescription = "a group with the name already exists" )
API error descriptions
const ( AdminRoleGroup = "role-admin" PublisherRoleGroup = "role-publisher" )
const ( NewPasswordRequiredType = "NewPasswordRequired" ForgottenPasswordType = "ForgottenPassword" MaxStatusNotesLength = 512 SecondsInDay = 86400 )
Variables ¶
var CognitoErrorMapping = map[string]string{ cognitoidentityprovider.ErrCodeInternalErrorException: InternalError, cognitoidentityprovider.ErrCodeCodeDeliveryFailureException: DeliveryFailureError, cognitoidentityprovider.ErrCodeCodeMismatchException: InvalidCodeError, cognitoidentityprovider.ErrCodeConcurrentModificationException: InternalError, cognitoidentityprovider.ErrCodeExpiredCodeException: ExpiredCodeError, cognitoidentityprovider.ErrCodeGroupExistsException: GroupExistsError, cognitoidentityprovider.ErrCodeInvalidOAuthFlowException: InternalError, cognitoidentityprovider.ErrCodeInvalidParameterException: InvalidFieldError, cognitoidentityprovider.ErrCodeInvalidPasswordException: InvalidPasswordError, cognitoidentityprovider.ErrCodeLimitExceededException: LimitExceededError, cognitoidentityprovider.ErrCodeNotAuthorizedException: NotAuthorisedError, cognitoidentityprovider.ErrCodePasswordResetRequiredException: PasswordResetRequiredError, cognitoidentityprovider.ErrCodeResourceNotFoundException: NotFoundError, cognitoidentityprovider.ErrCodeTooManyFailedAttemptsException: TooManyFailedAttemptsError, cognitoidentityprovider.ErrCodeTooManyRequestsException: TooManyRequestsError, cognitoidentityprovider.ErrCodeUserNotConfirmedException: UserNotConfirmedError, cognitoidentityprovider.ErrCodeUserNotFoundException: UserNotFoundError, cognitoidentityprovider.ErrCodeUsernameExistsException: UsernameExistsError, request.ErrCodeSerialization: InternalError, request.ErrCodeRead: InternalError, request.ErrCodeResponseTimeout: InternalError, request.ErrCodeInvalidPresignExpire: InternalError, request.CanceledErrorCode: InternalError, request.ErrCodeRequestError: InternalError, }
Mapping Cognito error codes to API error codes
Functions ¶
Types ¶
type AccessToken ¶ added in v1.8.0
func (*AccessToken) GenerateSignOutRequest ¶ added in v1.8.0
func (t *AccessToken) GenerateSignOutRequest() *cognitoidentityprovider.GlobalSignOutInput
type ChangePassword ¶ added in v1.10.0
type ChangePassword struct { ChangeType string `json:"type"` Session string `json:"session"` Email string `json:"email"` NewPassword string `json:"password"` VerificationToken string `json:"verification_token"` }
func (ChangePassword) BuildAuthChallengeResponseRequest ¶ added in v1.10.0
func (p ChangePassword) BuildAuthChallengeResponseRequest(clientSecret string, clientId string, challengeName string) *cognitoidentityprovider.RespondToAuthChallengeInput
BuildAuthChallengeResponseRequest generates a RespondToAuthChallengeInput for Cognito
func (ChangePassword) BuildAuthChallengeSuccessfulJsonResponse ¶ added in v1.10.0
func (p ChangePassword) BuildAuthChallengeSuccessfulJsonResponse(ctx context.Context, result *cognitoidentityprovider.RespondToAuthChallengeOutput) ([]byte, error)
BuildAuthChallengeSuccessfulJsonResponse builds the ChangePassword response json for client responses to NewPasswordRequired changes
func (ChangePassword) BuildConfirmForgotPasswordRequest ¶ added in v1.14.0
func (p ChangePassword) BuildConfirmForgotPasswordRequest(clientSecret string, clientId string) *cognitoidentityprovider.ConfirmForgotPasswordInput
func (ChangePassword) ValidateForgottenPasswordRequest ¶ added in v1.22.0
func (p ChangePassword) ValidateForgottenPasswordRequest(ctx context.Context) []error
func (ChangePassword) ValidateNewPasswordRequiredRequest ¶ added in v1.10.0
func (p ChangePassword) ValidateNewPasswordRequiredRequest(ctx context.Context) []error
ValidateNewPasswordRequiredRequest validates the required fields have been submitted and meet the basic structure requirements
type CreateGroup ¶ added in v1.23.0
type CreateGroup struct { Description *string `json:"description"` Precedence *int64 `json:"precedence"` GroupName string }
func (*CreateGroup) BuildCreateGroupInput ¶ added in v1.23.0
func (c *CreateGroup) BuildCreateGroupInput(userPoolId *string) *cognitoidentityprovider.CreateGroupInput
func (*CreateGroup) BuildSuccessfulJsonResponse ¶ added in v1.23.0
func (c *CreateGroup) BuildSuccessfulJsonResponse(ctx context.Context) ([]byte, error)
func (*CreateGroup) GenerateGroupName ¶ added in v1.23.0
func (c *CreateGroup) GenerateGroupName()
GenerateGroupName - New group name to be created from group description
(minus special characters, trimmed and to lowercase)
func (*CreateGroup) ValidateCreateGroupRequest ¶ added in v1.23.0
func (g *CreateGroup) ValidateCreateGroupRequest(ctx context.Context) []error
type CreateUserInput ¶
type CreateUserInput struct {
UserInput *cognitoidentityprovider.AdminCreateUserInput
}
type CreateUserOutput ¶
type CreateUserOutput struct {
UserOutput *cognitoidentityprovider.AdminCreateUserOutput
}
type Error ¶ added in v1.8.0
type Error struct { Cause error `json:"-"` Code string `json:"code"` Description string `json:"description"` }
func NewCognitoError ¶ added in v1.8.0
func NewValidationError ¶ added in v1.8.0
type ErrorResponse ¶ added in v1.8.0
type ErrorResponse struct { Errors []error `json:"errors"` Status int `json:"-"` Headers map[string]string `json:"-"` }
func NewErrorResponse ¶ added in v1.8.0
func NewErrorResponse(statusCode int, headers map[string]string, errors ...error) *ErrorResponse
type GlobalSignOut ¶ added in v1.19.0
type GlobalSignOut struct { ResultsChannel chan string BackoffSchedule []time.Duration RetryAllowed bool }
func (GlobalSignOut) BuildSignOutUserRequest ¶ added in v1.19.0
func (g GlobalSignOut) BuildSignOutUserRequest(users *[]UserParams, userPoolId *string) []*cognitoidentityprovider.AdminUserGlobalSignOutInput
buildSignOutUserRequest - standalone request builder - builds a signout request array
this is required for concurrent global signout requests
type Group ¶ added in v1.13.0
type Group struct { Name string `json:"name"` Description string `json:"description"` Precedence int64 `json:"precedence"` Created time.Time `json:"created"` Members []UserParams `json:"members"` }
Type to map for the Cognito GroupType object
func NewAdminRoleGroup ¶ added in v1.13.0
func NewAdminRoleGroup() Group
Constructor for a new instance of the admin role group
func NewPublisherRoleGroup ¶ added in v1.13.0
func NewPublisherRoleGroup() Group
Constructor for a new instance of the publisher role group
func (*Group) BuildAddUserToGroupRequest ¶ added in v1.15.0
func (g *Group) BuildAddUserToGroupRequest(userPoolId, userId string) *cognitoidentityprovider.AdminAddUserToGroupInput
BuildAddUserToGroupRequest builds a correctly populated AdminAddUserToGroupInput object
func (*Group) BuildCreateGroupRequest ¶ added in v1.13.0
func (g *Group) BuildCreateGroupRequest(userPoolId string) *cognitoidentityprovider.CreateGroupInput
BuildCreateGroupRequest builds a correctly populated CreateGroupInput object using the Groups values
func (*Group) BuildGetGroupRequest ¶ added in v1.13.0
func (g *Group) BuildGetGroupRequest(userPoolId string) *cognitoidentityprovider.GetGroupInput
BuildCreateGroupRequest builds a correctly populated GetGroupInput object using the Groups values
func (*Group) BuildListUsersInGroupRequest ¶ added in v1.15.0
func (g *Group) BuildListUsersInGroupRequest(userPoolId string) *cognitoidentityprovider.ListUsersInGroupInput
BuildListUsersInGroupRequest builds a correctly populated ListUsersInGroupInput object
func (*Group) BuildListUsersInGroupRequestWithNextToken ¶ added in v1.18.0
func (g *Group) BuildListUsersInGroupRequestWithNextToken(userPoolId string, nextToken string) *cognitoidentityprovider.ListUsersInGroupInput
BuildListUsersInGroupRequest builds a correctly populated ListUsersInGroupInput object with Next Token
func (*Group) BuildRemoveUserFromGroupRequest ¶ added in v1.16.0
func (g *Group) BuildRemoveUserFromGroupRequest(userPoolId, userId string) *cognitoidentityprovider.AdminRemoveUserFromGroupInput
BuildRemoveUserFromGroupRequest builds a correctly populated AdminRemoveUserFromGroupInput object
func (*Group) BuildSuccessfulJsonResponse ¶ added in v1.15.0
BuildSuccessfulJsonResponse builds the Group response json for client responses
func (*Group) MapCognitoDetails ¶ added in v1.15.0
func (g *Group) MapCognitoDetails(groupDetails *cognitoidentityprovider.GroupType)
MapCognitoDetails maps the group details returned from GetGroup requests
func (*Group) MapMembers ¶ added in v1.15.0
func (g *Group) MapMembers(membersList *[]*cognitoidentityprovider.UserType)
MapMembers maps Cognito user details to the internal UserParams model from ListUserInGroup requests
type IdClaims ¶
type IdClaims struct { Sub string `json:"sub"` Aud string `json:"aud"` EmailVerified bool `json:"email_verified"` TokenUse string `json:"token_use"` AuthTime int `json:"auth_time"` Iss string `json:"iss"` CognitoUser string `json:"cognito:username"` Exp int `json:"exp"` GivenName string `json:"given_name"` Iat int `json:"iat"` Email string `json:"email"` jwt.StandardClaims }
type IdToken ¶
func (*IdToken) ParseWithoutValidating ¶
ParseWithoutValidating parses the claims in an ID token JWT in to a IdClaims struct without validating the token
type ListUserGroupType ¶ added in v1.21.0
type ListUserGroupType struct { CreationDate *time.Time `type:"timestamp" json:"creation_date"` Description *string `type:"string" json:"description"` GroupName *string `min:"1" type:"string" json:"group_name"` LastModifiedDate *time.Time `type:"timestamp" json:"last_modified_date"` Precedence *int64 `type:"integer" json:"precedence"` RoleArn *string `min:"20" type:"string" json:"role_arn"` UserPoolId *string `min:"1" type:"string" json:"user_pool_id"` }
ListGroupsForUser output structure from cognitoidentityprovider.AdminListGroupsForUserOutput but changing the json output
func (*ListUserGroupType) BuildListGroupsRequest ¶ added in v1.25.0
func (g *ListUserGroupType) BuildListGroupsRequest(userPoolId string, nextToken string) *cognitoidentityprovider.ListGroupsInput
BuildListGroupsRequest build the require input for cognito query to obtain the groups for given user
type ListUserGroups ¶ added in v1.21.0
type ListUserGroups struct { Groups []*ListUserGroupType `json:"groups"` NextToken *string `json:"next_token"` Count int `json:"count"` }
List groups for user output structure from cognitoidentityprovider.AdminListGroupsForUserOutput with count of total groups returned
func (*ListUserGroups) BuildListGroupsSuccessfulJsonResponse ¶ added in v1.25.0
func (g *ListUserGroups) BuildListGroupsSuccessfulJsonResponse(ctx context.Context, result *cognitoidentityprovider.ListGroupsOutput) ([]byte, error)
BuildListGroupsSuccessfulJsonResponse formats the output to comply with current standards and to json , adds the count of groups returned and
func (*ListUserGroups) BuildListUserGroupsSuccessfulJsonResponse ¶ added in v1.21.0
func (p *ListUserGroups) BuildListUserGroupsSuccessfulJsonResponse(ctx context.Context, result *cognitoidentityprovider.AdminListGroupsForUserOutput) ([]byte, error)
BuildListUserGroupsSuccessfulJsonResponse formats the output to comply with current standards and to json , adds the count of groups returned and
type ListUsersInput ¶
type ListUsersInput struct {
ListUsersInput *cognitoidentityprovider.ListUsersInput
}
type ListUsersOutput ¶
type ListUsersOutput struct {
ListUsersOutput *cognitoidentityprovider.ListUsersOutput
}
type PasswordReset ¶ added in v1.11.0
type PasswordReset struct {
Email string `json:"email"`
}
func (PasswordReset) BuildCognitoRequest ¶ added in v1.11.0
func (p PasswordReset) BuildCognitoRequest(clientSecret string, clientId string) *cognitoidentityprovider.ForgotPasswordInput
type RefreshToken ¶
type RefreshToken struct {
TokenString string
}
func (*RefreshToken) BuildSuccessfulJsonResponse ¶ added in v1.8.0
func (t *RefreshToken) BuildSuccessfulJsonResponse(ctx context.Context, result *cognitoidentityprovider.InitiateAuthOutput) ([]byte, error)
func (*RefreshToken) GenerateRefreshRequest ¶
func (t *RefreshToken) GenerateRefreshRequest(clientSecret string, username string, clientId string) *cognitoidentityprovider.InitiateAuthInput
GenerateRefreshRequest produces a Cognito InitiateAuthInput struct for refreshing a users current session
type SuccessResponse ¶ added in v1.8.0
type SuccessResponse struct { Body []byte `json:"-"` Status int `json:"-"` Headers map[string]string `json:"-"` }
func NewSuccessResponse ¶ added in v1.8.0
func NewSuccessResponse(jsonBody []byte, statusCode int, headers map[string]string) *SuccessResponse
type UserParams ¶
type UserParams struct { Forename string `json:"forename"` Lastname string `json:"lastname"` Email string `json:"email"` Password string `json:"-"` Groups []string `json:"groups"` Status string `json:"status"` Active bool `json:"active"` ID string `json:"id"` StatusNotes string `json:"status_notes"` }
Model for the User
func (UserParams) BuildAdminGetUserRequest ¶ added in v1.12.0
func (p UserParams) BuildAdminGetUserRequest(userPoolId string) *cognitoidentityprovider.AdminGetUserInput
BuildAdminGetUserRequest generates a AdminGetUserInput for Cognito
func (UserParams) BuildCreateUserRequest ¶ added in v1.8.0
func (p UserParams) BuildCreateUserRequest(userId string, userPoolId string) *cognitoidentityprovider.AdminCreateUserInput
BuildCreateUserRequest generates a AdminCreateUserInput for Cognito
func (UserParams) BuildDisableUserRequest ¶ added in v1.15.0
func (p UserParams) BuildDisableUserRequest(userPoolId string) *cognitoidentityprovider.AdminDisableUserInput
BuildDisableUserRequest generates a AdminDisableUserInput for Cognito
func (UserParams) BuildEnableUserRequest ¶ added in v1.15.0
func (p UserParams) BuildEnableUserRequest(userPoolId string) *cognitoidentityprovider.AdminEnableUserInput
BuildEnableUserRequest generates a AdminEnableUserInput for Cognito
func (UserParams) BuildListUserGroupsRequest ¶ added in v1.21.0
func (p UserParams) BuildListUserGroupsRequest(userPoolId string, nextToken string) *cognitoidentityprovider.AdminListGroupsForUserInput
BuildListUserGroupsRequest build the require input for cognito query to obtain the groups for given user
func (UserParams) BuildSuccessfulJsonResponse ¶ added in v1.8.0
func (p UserParams) BuildSuccessfulJsonResponse(ctx context.Context) ([]byte, error)
BuildSuccessfulJsonResponse builds the UserParams response json for client responses
func (UserParams) BuildUpdateUserRequest ¶ added in v1.13.0
func (p UserParams) BuildUpdateUserRequest(userPoolId string) *cognitoidentityprovider.AdminUpdateUserAttributesInput
BuildUpdateUserRequest generates a AdminUpdateUserAttributesInput for Cognito
func (UserParams) CheckForDuplicateEmail ¶ added in v1.8.0
func (p UserParams) CheckForDuplicateEmail(ctx context.Context, listUserResp *cognitoidentityprovider.ListUsersOutput) error
CheckForDuplicateEmail checks the Cognito response for users already using the email address, returning a validation error if found
func (*UserParams) GeneratePassword ¶ added in v1.8.0
func (p *UserParams) GeneratePassword(ctx context.Context) error
GeneratePassword creates a password for the user and assigns it to the struct
func (UserParams) MapCognitoDetails ¶ added in v1.11.0
func (p UserParams) MapCognitoDetails(userDetails *cognitoidentityprovider.UserType) UserParams
MapCognitoDetails maps the details from the Cognito ListUser User model to the UserParams model
func (*UserParams) MapCognitoGetResponse ¶ added in v1.12.0
func (p *UserParams) MapCognitoGetResponse(userDetails *cognitoidentityprovider.AdminGetUserOutput)
MapCognitoGetResponse maps the details from the Cognito GetUser User model to the UserParams model
func (UserParams) ValidateRegistration ¶ added in v1.8.0
func (p UserParams) ValidateRegistration(ctx context.Context, allowedDomains []string) []error
ValidateRegistration validates the required fields for user creation, returning validation errors for any failures
func (UserParams) ValidateUpdate ¶ added in v1.13.0
func (p UserParams) ValidateUpdate(ctx context.Context) []error
ValidateUpdate validates the required fields for user update, returning validation errors for any failures
type UserSignIn ¶ added in v1.8.0
func (*UserSignIn) BuildCognitoRequest ¶ added in v1.8.0
func (p *UserSignIn) BuildCognitoRequest(clientId string, clientSecret string, clientAuthFlow string) *cognitoidentityprovider.InitiateAuthInput
BuildCognitoRequest generates a InitiateAuthInput for Cognito
func (*UserSignIn) BuildSuccessfulJsonResponse ¶ added in v1.8.0
func (p *UserSignIn) BuildSuccessfulJsonResponse(ctx context.Context, result *cognitoidentityprovider.InitiateAuthOutput, refreshTokenTTL int) ([]byte, error)
BuildSuccessfulJsonResponse builds the UserSignIn response json for client responses
func (*UserSignIn) ValidateCredentials ¶ added in v1.8.0
func (p *UserSignIn) ValidateCredentials(ctx context.Context) *[]error
ValidateCredentials validates the required fields have been submitted and meet the basic structure requirements
type UsersList ¶ added in v1.11.0
type UsersList struct { Count int `json:"count"` Users []UserParams `json:"users"` PaginationToken string }
func (UsersList) BuildListUserRequest ¶ added in v1.11.0
func (p UsersList) BuildListUserRequest(filterString string, requiredAttribute string, limit int64, paginationToken *string, userPoolId *string) *cognitoidentityprovider.ListUsersInput
BuildListUserRequest generates a ListUsersInput object for Cognito
func (*UsersList) BuildSuccessfulJsonResponse ¶ added in v1.11.0
BuildSuccessfulJsonResponse builds the UsersList response json for client responses
func (*UsersList) MapCognitoUsers ¶ added in v1.11.0
func (p *UsersList) MapCognitoUsers(cognitoResults *[]*cognitoidentityprovider.UserType)
MapCognitoUsers maps the users from the cognito response into the UsersList Users attribute and sets the Count attribute
func (*UsersList) SetUsers ¶ added in v1.20.0
func (p *UsersList) SetUsers(usersList *[]UserParams)
SetUsers sets the UsersList Users attribute and sets the Count attribute