Help us shape the future of Go! Take the 2026 Go Developer Survey

activation

package
v1.11.21 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package activation is an intetnionally separate package from keymaker / keystore that keeps roles between the packages tidy by focusing on activation-specific logic for non-oauth / OIDC providers

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrHealthCheckFailed indicates the provider health check failed.
	ErrHealthCheckFailed = errors.New("activation: health check failed")
	// ErrStoreRequired indicates the credential store is required.
	ErrStoreRequired = errors.New("activation: credential store required")
	// ErrKeymakerRequired indicates the keymaker dependency is required.
	ErrKeymakerRequired = errors.New("activation: keymaker required")
	// ErrOperationsRequired indicates the operations manager is required for validation.
	ErrOperationsRequired = errors.New("activation: operations manager required")
	// ErrMinterRequired indicates the payload minter is required.
	ErrMinterRequired = errors.New("activation: payload minter required")
)

Functions

This section is empty.

Types

type BeginOAuthRequest

type BeginOAuthRequest struct {
	// OrgID identifies the organization initiating the flow
	OrgID string
	// IntegrationID optionally identifies the integration record being activated
	IntegrationID string
	// Provider specifies which provider to authorize
	Provider types.ProviderType
	// RedirectURI overrides the default callback URL when needed
	RedirectURI string
	// Scopes optionally override the provider default scopes
	Scopes []string
	// Metadata carries optional provider-specific metadata
	Metadata map[string]any
	// LabelOverrides customizes UI labels presented to the user
	LabelOverrides map[string]string
	// State optionally supplies a pre-generated OAuth state value
	State string
}

BeginOAuthRequest starts an OAuth/OIDC activation flow

type BeginOAuthResponse

type BeginOAuthResponse struct {
	// Provider identifies which provider issued the authorization URL
	Provider types.ProviderType
	// State carries the CSRF state value for the flow
	State string
	// AuthURL is the URL the user should visit to authorize
	AuthURL string
}

BeginOAuthResponse returns the authorization URL/state pair

type CompleteOAuthRequest

type CompleteOAuthRequest struct {
	// State is the CSRF state value returned by the provider
	State string
	// Code is the authorization code returned by the provider
	Code string
}

CompleteOAuthRequest finalizes an OAuth/OIDC activation flow

type CompleteOAuthResult

type CompleteOAuthResult struct {
	// Provider identifies which provider issued the credential
	Provider types.ProviderType
	// OrgID identifies the organization that owns the credential
	OrgID string
	// IntegrationID identifies the integration record containing the credential
	IntegrationID string
	// Credential contains the persisted credential payload
	Credential types.CredentialPayload
}

CompleteOAuthResult reports the persisted credential and related identifiers

type ConfigureRequest

type ConfigureRequest struct {
	// OrgID identifies the organization initiating the configuration
	OrgID string
	// Provider specifies which provider to configure
	Provider types.ProviderType
	// ProviderData carries provider-specific configuration values
	ProviderData map[string]any
	// Validate controls whether a health check should be executed
	Validate bool
}

ConfigureRequest carries the information required to persist non-OAuth credentials

type ConfigureResult

type ConfigureResult struct {
	// Credential contains the persisted credential payload
	Credential types.CredentialPayload
	// HealthResult captures the optional health check result
	HealthResult *types.OperationResult
}

ConfigureResult reports the persisted credential and optional health result

type CredentialWriter

type CredentialWriter interface {
	SaveCredential(ctx context.Context, orgID string, payload types.CredentialPayload) (types.CredentialPayload, error)
}

CredentialWriter persists credential payloads produced during activation

type OperationRunner

type OperationRunner interface {
	// Run executes an operation loading credentials from the store
	Run(ctx context.Context, req types.OperationRequest) (types.OperationResult, error)
	// RunWithPayload executes an operation using the provided credential payload without loading from the store
	RunWithPayload(ctx context.Context, req types.OperationRequest, payload types.CredentialPayload) (types.OperationResult, error)
}

OperationRunner executes provider operations for health checks

type PayloadMinter added in v1.11.5

type PayloadMinter interface {
	// MintPayload exchanges or refreshes the supplied in-memory credential payload via the provider
	MintPayload(ctx context.Context, subject types.CredentialSubject) (types.CredentialPayload, error)
}

PayloadMinter mints credentials from an in-memory payload without accessing the credential store

type Service

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

Service coordinates activation flows for OAuth and non-OAuth providers

func NewService

func NewService(keymakerSvc *keymaker.Service, store CredentialWriter, operations OperationRunner, minter PayloadMinter) (*Service, error)

NewService constructs an activation service from the supplied dependencies

func (*Service) BeginOAuth

func (s *Service) BeginOAuth(ctx context.Context, req BeginOAuthRequest) (BeginOAuthResponse, error)

BeginOAuth starts an OAuth/OIDC transaction with the requested provider

func (*Service) CompleteOAuth

func (s *Service) CompleteOAuth(ctx context.Context, req CompleteOAuthRequest) (CompleteOAuthResult, error)

CompleteOAuth finalizes an OAuth/OIDC transaction and persists credentials

func (*Service) Configure

func (s *Service) Configure(ctx context.Context, req ConfigureRequest) (ConfigureResult, error)

Configure validates connectivity with the provider and persists credentials only on success

Jump to

Keyboard shortcuts

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