Documentation ¶
Index ¶
- Variables
- type API
- func (api *API) AddUserToGroupHandler(ctx context.Context, w http.ResponseWriter, req *http.Request) (*models.SuccessResponse, *models.ErrorResponse)
- func (api *API) ChangePasswordHandler(ctx context.Context, w http.ResponseWriter, req *http.Request) (*models.SuccessResponse, *models.ErrorResponse)
- func (api *API) CreateUserHandler(ctx context.Context, w http.ResponseWriter, req *http.Request) (*models.SuccessResponse, *models.ErrorResponse)
- func (api *API) GetUserHandler(ctx context.Context, w http.ResponseWriter, req *http.Request) (*models.SuccessResponse, *models.ErrorResponse)
- func (api *API) ListUserGroupsHandler(ctx context.Context, w http.ResponseWriter, req *http.Request) (*models.SuccessResponse, *models.ErrorResponse)
- func (api *API) ListUsersHandler(ctx context.Context, w http.ResponseWriter, req *http.Request) (*models.SuccessResponse, *models.ErrorResponse)
- func (api *API) ListUsersInGroupHandler(ctx context.Context, w http.ResponseWriter, req *http.Request) (*models.SuccessResponse, *models.ErrorResponse)
- func (api *API) ListUsersWorker(ctx context.Context, userFilterString *string, backoffSchedule []time.Duration) (*[]models.UserParams, *models.ErrorResponse)
- func (api *API) PasswordResetHandler(ctx context.Context, w http.ResponseWriter, req *http.Request) (*models.SuccessResponse, *models.ErrorResponse)
- func (api *API) RefreshHandler(ctx context.Context, w http.ResponseWriter, req *http.Request) (*models.SuccessResponse, *models.ErrorResponse)
- func (api *API) RemoveUserFromGroupHandler(ctx context.Context, w http.ResponseWriter, req *http.Request) (*models.SuccessResponse, *models.ErrorResponse)
- func (api *API) SignOutAllUsersHandler(ctx context.Context, w http.ResponseWriter, req *http.Request) (*models.SuccessResponse, *models.ErrorResponse)
- func (api *API) SignOutHandler(ctx context.Context, w http.ResponseWriter, req *http.Request) (*models.SuccessResponse, *models.ErrorResponse)
- func (api *API) SignOutUsersWorker(ctx context.Context, g *models.GlobalSignOut, usersList *[]models.UserParams)
- func (api *API) TokensHandler(ctx context.Context, w http.ResponseWriter, req *http.Request) (*models.SuccessResponse, *models.ErrorResponse)
- func (api *API) UpdateUserHandler(ctx context.Context, w http.ResponseWriter, req *http.Request) (*models.SuccessResponse, *models.ErrorResponse)
Constants ¶
This section is empty.
Variables ¶
var ( IdTokenHeaderName = "ID" AccessTokenHeaderName = "Authorization" RefreshTokenHeaderName = "Refresh" WWWAuthenticateName = "WWW-Authenticate" ONSRealm = "Florence publishing platform" Charset = "UTF-8" NewPasswordChallenge = "NEW_PASSWORD_REQUIRED" DefaultBackOffSchedule = []time.Duration{ 1 * time.Second, 3 * time.Second, 10 * time.Second, } )
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct { Router *mux.Router CognitoClient cognito.Client UserPoolId string ClientId string ClientSecret string ClientAuthFlow string AllowedDomains []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, allowedDomains []string) (*API, error)
Setup function sets up the api and returns an api
func (*API) AddUserToGroupHandler ¶ added in v1.15.0
func (api *API) AddUserToGroupHandler(ctx context.Context, w http.ResponseWriter, req *http.Request) (*models.SuccessResponse, *models.ErrorResponse)
AddUserToGroupHandler adds a user to the specified group
func (*API) ChangePasswordHandler ¶ added in v1.10.0
func (api *API) ChangePasswordHandler(ctx context.Context, w http.ResponseWriter, req *http.Request) (*models.SuccessResponse, *models.ErrorResponse)
ChangePasswordHandler processes changes to the users password
func (*API) CreateUserHandler ¶ added in v1.7.0
func (api *API) CreateUserHandler(ctx context.Context, w http.ResponseWriter, req *http.Request) (*models.SuccessResponse, *models.ErrorResponse)
CreateUserHandler creates a new user and returns a http handler interface
func (*API) GetUserHandler ¶ added in v1.12.0
func (api *API) GetUserHandler(ctx context.Context, w http.ResponseWriter, req *http.Request) (*models.SuccessResponse, *models.ErrorResponse)
GetUserHandler lists the users in the user pool
func (*API) ListUserGroupsHandler ¶ added in v1.21.0
func (api *API) ListUserGroupsHandler(ctx context.Context, w http.ResponseWriter, req *http.Request) (*models.SuccessResponse, *models.ErrorResponse)
ListUserGroupsHandler lists the users in the user pool
func (*API) ListUsersHandler ¶ added in v1.11.0
func (api *API) ListUsersHandler(ctx context.Context, w http.ResponseWriter, req *http.Request) (*models.SuccessResponse, *models.ErrorResponse)
ListUsersHandler lists the users in the user pool
func (*API) ListUsersInGroupHandler ¶ added in v1.18.0
func (api *API) ListUsersInGroupHandler(ctx context.Context, w http.ResponseWriter, req *http.Request) (*models.SuccessResponse, *models.ErrorResponse)
ListUsersInGroupHandler list the users in the specified group
func (*API) ListUsersWorker ¶ added in v1.19.0
func (api *API) ListUsersWorker(ctx context.Context, userFilterString *string, backoffSchedule []time.Duration) (*[]models.UserParams, *models.ErrorResponse)
ListUsersWorker - generates a list of users based on `userFilterString` filter string
func (*API) PasswordResetHandler ¶ added in v1.11.0
func (api *API) PasswordResetHandler(ctx context.Context, w http.ResponseWriter, req *http.Request) (*models.SuccessResponse, *models.ErrorResponse)
PasswordResetHandler requests a password reset email be sent to the user and returns a http handler interface
func (*API) RefreshHandler ¶ added in v1.7.0
func (api *API) RefreshHandler(ctx context.Context, w http.ResponseWriter, req *http.Request) (*models.SuccessResponse, *models.ErrorResponse)
RefreshHandler refreshes a users access token and returns new access and ID tokens, expiration time and the refresh token
func (*API) RemoveUserFromGroupHandler ¶ added in v1.16.0
func (api *API) RemoveUserFromGroupHandler(ctx context.Context, w http.ResponseWriter, req *http.Request) (*models.SuccessResponse, *models.ErrorResponse)
RemoveUserFromGroupHandler adds a user to the specified group
func (*API) SignOutAllUsersHandler ¶ added in v1.19.0
func (api *API) SignOutAllUsersHandler(ctx context.Context, w http.ResponseWriter, req *http.Request) (*models.SuccessResponse, *models.ErrorResponse)
SignOutAllUsersHandler bulk refresh token invalidation for panic sign out handling
func (*API) SignOutHandler ¶ added in v1.5.0
func (api *API) SignOutHandler(ctx context.Context, w http.ResponseWriter, req *http.Request) (*models.SuccessResponse, *models.ErrorResponse)
SignOutHandler invalidates a users access token signing them out and returns a http handler interface
func (*API) SignOutUsersWorker ¶ added in v1.19.0
func (api *API) SignOutUsersWorker(ctx context.Context, g *models.GlobalSignOut, usersList *[]models.UserParams)
SignOutUsersWorker - signs out users globally by invalidating user's refresh token
func (*API) TokensHandler ¶ added in v1.6.0
func (api *API) TokensHandler(ctx context.Context, w http.ResponseWriter, req *http.Request) (*models.SuccessResponse, *models.ErrorResponse)
TokensHandler uses submitted email address and password to sign a user in against Cognito and returns a http handler interface
func (*API) UpdateUserHandler ¶ added in v1.13.0
func (api *API) UpdateUserHandler(ctx context.Context, w http.ResponseWriter, req *http.Request) (*models.SuccessResponse, *models.ErrorResponse)
UpdateUserHandler updates a users details in Cognito and returns a http handler interface