auth

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authenticator

type Authenticator interface {
	// CreateOrRenewCredentials is a best effort wrapper on credential
	// provisioning functions that can decide if it is better to create
	// new credentials or refresh using an existing token.
	CreateOrRenewCredentials() (*Credentials, error)
	// NewCredentials retrieve a new set of credentials.
	NewCredentials() (*Credentials, error)
	// RefreshCredentials uses credentials refresh tokens to create a new set of credentials.
	RefreshCredentials() (*Credentials, error)
}

Authenticator manages and stores Authentication Credentials for services.

func NewJWTAuthenticator

func NewJWTAuthenticator(certKey, clientID, user, server string, client *http.Client, logger *zap.SugaredLogger) (Authenticator, error)

NewJWTAuthenticator creates an OAuth JWT authenticator for Salesforce.

type Credentials

type Credentials struct {
	Token        string `json:"access_token"`
	TokenType    string `json:"token_type"`
	RefreshToken string `json:"refresh_token"`
	InstanceURL  string `json:"instance_url"`
	ID           string `json:"id"`
	Signature    string `json:"signature"`
	Scope        string `json:"scope"`
	IDToken      string `json:"id_token"`
	CommunityURL string `json:"sfdc_community_url"`
	CommunityID  string `json:"sfdc_community_id"`
}

Credentials returned from Salesforce Auth.

type JWTAuthenticator

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

JWTAuthenticator is the JWT OAuth implementation. See: https://help.salesforce.com/articleView?id=remoteaccess_oauth_jwt_flow.htm

func (*JWTAuthenticator) CreateOrRenewCredentials

func (j *JWTAuthenticator) CreateOrRenewCredentials() (*Credentials, error)

CreateOrRenewCredentials will always create a new set of credentials.

func (*JWTAuthenticator) NewCredentials

func (j *JWTAuthenticator) NewCredentials() (*Credentials, error)

NewCredentials generates a new set of credentials.

func (*JWTAuthenticator) RefreshCredentials

func (j *JWTAuthenticator) RefreshCredentials() (*Credentials, error)

RefreshCredentials renews credentials.

Jump to

Keyboard shortcuts

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