auth

package
v1.3.3-beta Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2022 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrRefreshTokenInvalid refresh token invalid
	ErrRefreshTokenInvalid = errors.New("refresh token is invalid")
	// ErrNoAuthTokenFound no access token found
	ErrNoAuthTokenFound = errors.New("no auth token found")
	// ErrInvalidAccessToken invalid access token
	ErrInvalidAccessToken = errors.New("invalid access token")
)

Functions

This section is empty.

Types

type CalcSignatureInput

type CalcSignatureInput struct {
	AccessToken string
	HTTPMethod  string
	URI         string
	Timestamp   string
	ContentType string
	RawBody     []byte
}

CalcSignatureInput input to CalcSignature function

type Manager

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

Manager manages aws cognito authentication

func NewManager

func NewManager() *Manager

NewManager returns a new auth Manager

func (*Manager) CalcSignature

func (m *Manager) CalcSignature(i *CalcSignatureInput) (string, error)

CalcSignature calculates the signature for signing the requests

func (*Manager) GetTokens

func (m *Manager) GetTokens() (*Token, error)

GetTokens gets tokens from env var or local storage if not expired else refreshes the tokens first and then provides the new tokens

func (*Manager) IsBearerAuth

func (m *Manager) IsBearerAuth() bool

IsBearerAuth check if token auth type is bearer

func (*Manager) Login

func (m *Manager) Login() error

Login logs in to the user pool and stores the tokens

type Token

type Token struct {
	AccessToken     string `json:"access_token"`
	IDToken         string `json:"id_token"`
	RefreshToken    string `json:"refresh_token"`
	Expires         int64  `json:"expires"`
	DetaAccessToken string `json:"deta_access_token"`
}

Token aws cognito token or access keys

Jump to

Keyboard shortcuts

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