Documentation
¶
Overview ¶
This package provides a function which gets AWS credentials from Cognito Identity using the provided ID token
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetCredentials ¶
GetCredentials gets AWS credentials from Cognito Identity using the provided ID token.
opts are the configuration options for getting the credentials.
cfg is the CredsConfig which is populated from the opts.
awscfg is the default AWS config loaded with anonymous credentials. It is used to construct clients if not provided in opts.
cisvc is the CognitoIdentity client. If not provided in opts, it is constructed from the awscfg.
logins is the map of logins (cognito idp domain and user pool id) to the ID token.
getIdRes is the response from calling GetId to get the identity ID.
credsRes is the response from calling GetCredentialsForIdentity to get the temporary AWS credentials.
The function returns the AWS config loaded with the temporary credentials.
Types ¶
type CognitoIdentityClient ¶
type CognitoIdentityClient interface { GetId(ctx context.Context, params *cognitoidentity.GetIdInput, optFns ...func(*cognitoidentity.Options)) (*cognitoidentity.GetIdOutput, error) GetCredentialsForIdentity(ctx context.Context, params *cognitoidentity.GetCredentialsForIdentityInput, optFns ...func(*cognitoidentity.Options)) (*cognitoidentity.GetCredentialsForIdentityOutput, error) }
type CredsConfig ¶
type CredsConfig struct {
// contains filtered or unexported fields
}
type CredsOption ¶
type CredsOption func(*CredsConfig)
func WithCognitoIdentityClient ¶
func WithCognitoIdentityClient(cisvc CognitoIdentityClient) CredsOption
func WithIDToken ¶
func WithIDToken(idToken string) CredsOption
func WithLogger ¶
func WithLogger(logger logging.Logger) CredsOption
func WithRegion ¶
func WithRegion(region string) CredsOption
func WithUserPool ¶
func WithUserPool(userPoolID string, identityPoolID string) CredsOption