aws

package
v1.6.5 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2020 License: Apache-2.0 Imports: 27 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// JWKSURL is the cognito well-known public keys url
	JWKSURL = "https://cognito-idp.%s.amazonaws.com/%s/.well-known/jwks.json"
)
View Source
const (
	// Name is the provider name
	Name = "aws"
)

Variables

This section is empty.

Functions

func New

func New(params sparks.Params) (sparks.Provider, error)

New returns a new AWS provider

Types

type AuthChallenge

type AuthChallenge struct {
	Name    *string
	Params  map[string]*string
	Session *string
}

AuthChallenge is a congnito auth challenge

func (*AuthChallenge) Error

func (c *AuthChallenge) Error() string

type AuthToken

type AuthToken struct {
	keychain.AuthToken
}

AuthToken is an JWT AuthToken

func (*AuthToken) ID

func (t *AuthToken) ID() string

ID returns the token id

func (*AuthToken) Scope

func (t *AuthToken) Scope() []string

Scope returns the token scope

func (*AuthToken) Username

func (t *AuthToken) Username() string

Username returns the token username

type Provider

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

Provider is an AWS cloud provider

func DefaultProvider added in v1.5.2

func DefaultProvider() *Provider

DefaultProvider returns the default aws provider

func (*Provider) Close

func (p *Provider) Close()

Close closes and cleans up the provider

func (*Provider) Decrypt added in v1.5.2

func (p *Provider) Decrypt(data []byte, params sparks.Params) ([]byte, error)

Decrypt implements the cloud.Encryption provider interface using KMS

func (*Provider) Encrypt added in v1.5.2

func (p *Provider) Encrypt(data []byte, params sparks.Params) ([]byte, error)

Encrypt implements the cloud.Encryption provider interface using KMS

func (*Provider) Name added in v1.5.2

func (p *Provider) Name() string

Name returns the provider name

func (*Provider) OpenObjectStore

func (p *Provider) OpenObjectStore(name string, params ...sparks.Params) (sparks.ObjectStore, error)

OpenObjectStore returns an instance to an S3 bucket

func (*Provider) OpenQueue

func (p *Provider) OpenQueue(name string, params sparks.Params) (sparks.Queue, error)

OpenQueue opens an SQS queue

func (*Provider) OpenUserPool

func (p *Provider) OpenUserPool(name string, options sparks.Params) (sparks.UserPool, error)

OpenUserPool returns a cognito user pool instance. This method takes the following required parameters:

client_id: the cognito client id
public_keys: base64 encoded json string, retrieved from:
	https://cognito-idp.<region>.amazonaws.com/<pool_id>/.well-known/jwks.json

func (*Provider) ProxyHTTP

func (p *Provider) ProxyHTTP(handler http.Handler) error

ProxyHTTP handles the lambda api gateway integration request

type User

type User struct {
	*cognitoidentityprovider.UserType
	// contains filtered or unexported fields
}

User is a cognito User

func (*User) Attributes

func (u *User) Attributes() types.StringMap

Attributes returns a map of user attributes

func (*User) Enabled

func (u *User) Enabled() bool

Enabled represents the user's status

func (*User) Groups

func (u *User) Groups() []string

Groups returns a list of groups the user belongs to

func (*User) Login

func (u *User) Login() string

Login returns the user login i.e. username

func (*User) Status added in v1.5.2

func (u *User) Status() string

Status returns the user status

type UserPool

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

UserPool is a congnito UserPool

func (*UserPool) AuthenticateUser

func (p *UserPool) AuthenticateUser(username, password string) (keychain.AuthToken, error)

AuthenticateUser authenticates the user and returns an AuthToken

func (*UserPool) ChangeUserPassword

func (p *UserPool) ChangeUserPassword(username, current, proposed string) error

ChangeUserPassword changes the users password This method first attempt to authenticate the user to get a session token then it uses this token to perform the actual password change.

func (*UserPool) CreateUser

func (p *UserPool) CreateUser(username, password string, attributes map[string]string, options ...sparks.Params) (sparks.User, error)

CreateUser creates a new user

func (*UserPool) DeleteUser

func (p *UserPool) DeleteUser(username string) error

DeleteUser deletes a user record

func (*UserPool) DisableUser

func (p *UserPool) DisableUser(username string) error

DisableUser disables a user account

func (*UserPool) GetUser

func (p *UserPool) GetUser(username string) (sparks.User, error)

GetUser returns a user

func (*UserPool) UpdateUser

func (p *UserPool) UpdateUser(username string, attributes types.StringMap) error

UpdateUser updates a users attributes

Jump to

Keyboard shortcuts

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