Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { UserpoolID string ClientID string Username string Password string AWSConfig *aws.Config RequireTransportSecurity bool }
Config holds configuration info for the cognito http client
type Token ¶
type Token struct { AccessToken string IDToken string RefreshToken string TokenType string Expiration time.Time }
Token holds the credentials received from Cognito
type TokenSource ¶
type TokenSource struct {
// contains filtered or unexported fields
}
TokenSource handles the retrieval and refreshing of tokens
func NewTokenSource ¶
func NewTokenSource(conf *Config) (*TokenSource, error)
NewTokenSource returns a new TokenSource with the provided configuration
func (*TokenSource) GetRequestMetadata ¶
func (ts *TokenSource) GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error)
GetRequestMetadata is used to implement PerRPCCredentials interface.
func (*TokenSource) GetToken ¶
func (ts *TokenSource) GetToken() (*Token, error)
GetToken returns the existing Token if valid or refreshes and returns the new Token.
func (*TokenSource) RequireTransportSecurity ¶
func (ts *TokenSource) RequireTransportSecurity() bool
RequireTransportSecurity is used to implement PerRPCCredentials interface. TODO: Make this default to true.
type Transport ¶
type Transport struct { // Source supplies the token to add to outgoing requests' // Authorization headers. Source *TokenSource // Base is the base RoundTripper used to make HTTP requests. // If nil, http.DefaultTransport is used. Base http.RoundTripper // contains filtered or unexported fields }
Transport is an http.RoundTripper that makes OAuth 2.0 HTTP requests, wrapping a base RoundTripper and adding an Authorization header with a token from the supplied Sources.
Transport is a low-level mechanism. Most code will use the higher-level Config.Client method instead.
func (*Transport) CancelRequest ¶
CancelRequest cancels an in-flight request by closing its connection.