cognito

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

This package provides a function which authenticates a user against Cognito and returns the AWS config and IDP tokens.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthOption

type AuthOption func(*CognitoConfig)

AuthCognitoOption configures the AuthCognito function.

func WithCognitoIdentityProviderClient

func WithCognitoIdentityProviderClient(cipsvc CognitoIdentityProviderClient) AuthOption

WithCognitoIdentityProviderClient sets the CognitoIdentityProvider client.

func WithCognitoSRP

func WithCognitoSRP(csrp CognitoSRP) AuthOption

func WithLogger

func WithLogger(logger logging.Logger) AuthOption

func WithRegion

func WithRegion(region string) AuthOption

WithRegion sets the AWS region.

func WithUserPool

func WithUserPool(userPoolID string, userPoolWebClientID string) AuthOption

WithUserPoolID sets the Cognito user pool ID and the Cognito user pool web client ID.

func WithUsernamePassword

func WithUsernamePassword(username, password string) AuthOption

WithUsername sets the username and password.

type AuthResult

type AuthResult struct {
	IDPTokens *IDPTokens
	AWSConfig aws.Config
}

AuthCognitoResult auth config results.

func Auth

func Auth(ctx context.Context, opts ...AuthOption) (*AuthResult, error)

type CognitoConfig

type CognitoConfig struct {
	// contains filtered or unexported fields
}

type CognitoSRP

type CognitoSRP interface {
	GetClientId() string
	GetAuthParams() map[string]string
	PasswordVerifierChallenge(challengeParms map[string]string, ts time.Time) (map[string]string, error)
}

type IDPTokens

type IDPTokens struct {
	// The access token.
	AccessToken *string

	// The expiration period of the authentication result in seconds.
	ExpiresIn int32

	// The ID token.
	IdToken *string

	// The refresh token.
	RefreshToken *string

	// The token type.
	TokenType *string
}

IDPTokens contains the cognito "oidc" tokens.

Jump to

Keyboard shortcuts

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