api

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2021 License: MIT Imports: 17 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	IdTokenHeaderName      = "ID"
	AccessTokenHeaderName  = "Authorization"
	RefreshTokenHeaderName = "Refresh"
)

Functions

func CreateNewUserModel added in v1.7.0

func CreateNewUserModel(forename string, surname, userId string, email string, tempPass string, userPoolId string) (*cognitoidentityprovider.AdminCreateUserInput, error)

CreateNewUserModel creates and returns *AdminCreateUserInput

func ListUsersModel added in v1.7.0

func ListUsersModel(filterString string, requiredAttribute string, limit int64, userPoolId *string) (*cognitoidentityprovider.ListUsersInput, error)

ListUsersModel creates and returns *ListUsersInput

Types

type API

type API struct {
	Router         *mux.Router
	CognitoClient  cognito.Client
	UserPoolId     string
	ClientId       string
	ClientSecret   string
	ClientAuthFlow string
}

API provides a struct to wrap the api around

func Setup

func Setup(ctx context.Context, r *mux.Router, cognitoClient cognito.Client, userPoolId string, clientId string, clientSecret string, clientAuthFlow string) (*API, error)

Setup function sets up the api and returns an api

func (*API) CreateUserHandler added in v1.7.0

func (api *API) CreateUserHandler(ctx context.Context) http.HandlerFunc

CreateUserHandler creates a new user and returns a http handler interface

func (*API) RefreshHandler added in v1.7.0

func (api *API) RefreshHandler(ctx context.Context) http.HandlerFunc

RefreshHandler refreshes a users access token and returns new access and ID tokens, expiration time and the refresh token

func (*API) SignOutHandler added in v1.5.0

func (api *API) SignOutHandler(ctx context.Context) http.HandlerFunc

SignOutHandler invalidates a users access token signing them out and returns a http handler interface

func (*API) TokensHandler added in v1.6.0

func (api *API) TokensHandler(ctx context.Context) http.HandlerFunc

TokensHandler uses submitted email address and password to sign a user in against Cognito and returns a http handler interface

type AuthParams added in v1.5.0

type AuthParams struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

Jump to

Keyboard shortcuts

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