auth

package
v0.0.0-...-135feef Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 11, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CognitoClient *cognitoidp.CognitoIdentityProvider = cognitoidp.New(awsSession())

Cognito client

Functions

func AdminAddUserToGroup

func AdminAddUserToGroup(username string, groupName string) (string, error)

Add a user to a group

func AdminCreateUser

func AdminCreateUser(username string, temporaryPassword string) (string, error)

Admin creates user with a temporary password

func AdminDeleteUser

func AdminDeleteUser(username string) (string, error)

Admin deletes a user from the User Pool

func AdminRemoveUserFromGroup

func AdminRemoveUserFromGroup(username string, groupName string) (string, error)

Remove a user from a group

func CognitoErrorDetails

func CognitoErrorDetails(err error) (string, string)

Extracts `error code` and `error message` from the `awserr`

func CreateUserGroup

func CreateUserGroup(groupName string, description string, precedence int64) (string, error)

Create a user group

func DeleteUserGroup

func DeleteUserGroup(groupName string) (string, error)

Delete a user group

func ForceChangePassword

func ForceChangePassword(session string, username string, password string) (string, error)

Force change password on first login after admin creates the user

Types

type CognitoAuth

type CognitoAuth struct {
	// Interface that provides AWS Cognito API methods (client)
	Client cognitoidpiface.CognitoIdentityProviderAPI

	// AWS Cognito User Pool ID
	UserPoolId string

	// AWS Cognito User Pool's App Client ID
	AppClientId string
}

func NewCognitoAuth

func NewCognitoAuth() CognitoAuth

func (*CognitoAuth) ChangePassword

func (self *CognitoAuth) ChangePassword(currentPassword string, newPassword string, accessToken string) (string, error)

Change password staying signed in

func (*CognitoAuth) ConfirmForgotPassword

func (self *CognitoAuth) ConfirmForgotPassword(username string, confirmationCode string, password string) (string, error)

Users can reset password using the verification code sent to their email

func (*CognitoAuth) ConfirmSignUp

func (self *CognitoAuth) ConfirmSignUp(username string, confirmationCode string) (string, error)

Confirm Signup by providing a confirmation email sent to the user email

func (*CognitoAuth) ForgotPassword

func (self *CognitoAuth) ForgotPassword(username string) (string, error)

Send a verification code to users' `email` to reset password

func (*CognitoAuth) RefreshTokenAuth

func (self *CognitoAuth) RefreshTokenAuth(refreshToken string) (map[string]string, error)

Get new `accessToken` and `idToken` using the `refreshToken`

func (*CognitoAuth) ResendConfirmationCode

func (self *CognitoAuth) ResendConfirmationCode(username string) (string, error)

Resend a verification code to user's `email`

func (*CognitoAuth) SignIn

func (self *CognitoAuth) SignIn(username string, password string) (map[string]string, error)

User signin using `username` and `password`

func (*CognitoAuth) SignUp

func (self *CognitoAuth) SignUp(username string, password string) (map[string]string, error)

Users Signup by themselves

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL