activation

package
v1.9.3 Latest Latest
Warning

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

Go to latest
Published: Feb 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")
)

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(ctx context.Context, req types.OperationRequest) (types.OperationResult, error)
}

OperationRunner executes provider operations for health checks

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) (*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 persists non-OAuth credentials and optionally runs a health check

Jump to

Keyboard shortcuts

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