oauth

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2023 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OAuth           AuthType = "OAuth"
	InvalidAuthType AuthType = "InvalidAuthType"

	RudderFlow_Delivery RudderFlow = "delivery"
	RudderFlow_Delete   RudderFlow = "delete"

	DeleteAccountIdKey   = "rudderDeleteAccountId"
	DeliveryAccountIdKey = "rudderAccountId"
)
View Source
const (
	DISABLE_DEST                = "DISABLE_DESTINATION"
	REFRESH_TOKEN               = "REFRESH_TOKEN"
	INVALID_REFRESH_TOKEN_GRANT = "refresh_token_invalid_grant"
)

Variables

This section is empty.

Functions

func GetAccountId

func GetAccountId(config map[string]interface{}, idKey string) string

func Init

func Init()

func WithOAuthClientTimeout

func WithOAuthClientTimeout(timeout time.Duration) func(*OAuthErrResHandler)

func WithRudderFlow

func WithRudderFlow(rudderFlow RudderFlow) func(*OAuthErrResHandler)

Types

type AccountSecret

type AccountSecret struct {
	ExpirationDate string          `json:"expirationDate"`
	Secret         json.RawMessage `json:"secret"`
}

type AuthResponse

type AuthResponse struct {
	Account AccountSecret
	Err     string
}

type AuthType

type AuthType string

func GetAuthType

func GetAuthType(config map[string]interface{}) AuthType

type Authorizer

type Authorizer interface {
	DisableDestination(destination *backendconfig.DestinationT, workspaceId, rudderAccountId string) (statusCode int, resBody string)
	RefreshToken(refTokenParams *RefreshTokenParams) (int, *AuthResponse)
	FetchToken(fetchTokenParams *RefreshTokenParams) (int, *AuthResponse)
}

type ControlPlaneRequestT

type ControlPlaneRequestT struct {
	Body        string
	ContentType string
	Url         string
	Method      string

	RequestType string // This is to add more refined stat tags
	// contains filtered or unexported fields
}

type DisableDestinationResponse

type DisableDestinationResponse struct {
	Enabled       bool   `json:"enabled"`
	DestinationId string `json:"id"`
}

type OAuthErrResHandler

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

OAuthErrResHandler is the handle for this class

func NewOAuthErrorHandler

func NewOAuthErrorHandler(provider tokenProvider, options ...func(*OAuthErrResHandler)) *OAuthErrResHandler

This function creates a new OauthErrorResponseHandler

func (*OAuthErrResHandler) DisableDestination

func (authErrHandler *OAuthErrResHandler) DisableDestination(destination *backendconfig.DestinationT, workspaceId, rudderAccountId string) (statusCode int, respBody string)

func (*OAuthErrResHandler) FetchToken

func (authErrHandler *OAuthErrResHandler) FetchToken(fetchTokenParams *RefreshTokenParams) (int, *AuthResponse)

func (*OAuthErrResHandler) GetTokenInfo

func (authErrHandler *OAuthErrResHandler) GetTokenInfo(refTokenParams *RefreshTokenParams, logTypeName string, authStats *OAuthStats) (int, *AuthResponse)

func (*OAuthErrResHandler) RefreshToken

func (authErrHandler *OAuthErrResHandler) RefreshToken(refTokenParams *RefreshTokenParams) (int, *AuthResponse)

type OAuthStats

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

func (*OAuthStats) SendCountStat

func (refStats *OAuthStats) SendCountStat()

Send count type stats related to OAuth(Destination)

func (*OAuthStats) SendTimerStats

func (authStats *OAuthStats) SendTimerStats(startTime time.Time)

type RefreshTokenBodyParams

type RefreshTokenBodyParams struct {
	HasExpired    bool            `json:"hasExpired"`
	ExpiredSecret json.RawMessage `json:"expiredSecret"`
}

This struct only exists for marshalling and sending payload to control-plane

type RefreshTokenParams

type RefreshTokenParams struct {
	AccountId       string
	WorkspaceId     string
	DestDefName     string
	EventNamePrefix string
	WorkerId        int
	Secret          json.RawMessage
}

type RudderFlow

type RudderFlow string

Jump to

Keyboard shortcuts

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