security

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2026 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FederationActionOIDCLogin   = "oidc_login"
	FederationActionSAMLLogin   = "saml_login"
	FederationActionAccountLink = "account_link"
)

Variables

View Source
var (
	ErrInvalidFederationState = errors.New("invalid federation state")
	ErrExpiredFederationState = errors.New("expired federation state")
	ErrCSRFMismatch           = errors.New("csrf binding mismatch")
	ErrTenantMismatch         = errors.New("tenant mismatch")
	ErrUserMismatch           = errors.New("user mismatch")
	ErrActionMismatch         = errors.New("action mismatch")
	ErrMissingRequiredField   = errors.New("missing required field in federation state")
)
View Source
var (
	ErrOutboundPolicyNotFound = errors.New("no outbound policy configured")
	ErrURLNotAllowed          = errors.New("url not allowed by outbound policy")
)

Functions

func NewOutboundGuard

func NewOutboundGuard(repo port.OutboundPolicyRepository, skipTLSVerify bool) port.OutboundGuard

Types

type FederationStatePayload

type FederationStatePayload struct {
	Action         string `json:"action"`
	TenantID       string `json:"tenant_id"`
	LoginChallenge string `json:"login_challenge"`
	ConnectionID   string `json:"connection_id"`
	UserID         string `json:"user_id,omitempty"`
	CSRFHash       string `json:"csrf_hash,omitempty"`
	ExpiresAt      int64  `json:"exp"`
	IssuedAt       int64  `json:"iat"`
	Version        int    `json:"v"`
}

type FederationStateProvider

type FederationStateProvider interface {
	Issue(ctx context.Context, input IssueFederationStateInput) (string, error)
	Verify(ctx context.Context, token string, input VerifyFederationStateInput) (*FederationStatePayload, error)
}

func NewFederationStateProvider

func NewFederationStateProvider(cfg *config.Config) FederationStateProvider

func NewFederationStateProviderWithClock

func NewFederationStateProviderWithClock(cfg *config.Config, clock func() time.Time) FederationStateProvider

type IssueFederationStateInput

type IssueFederationStateInput struct {
	Action         string
	TenantID       string
	LoginChallenge string
	ConnectionID   string
	UserID         string
	CSRFToken      string
	TTL            time.Duration
}

type VerifyFederationStateInput

type VerifyFederationStateInput struct {
	ExpectedAction string
	ExpectedTenant string
	ExpectedUserID string
	CSRFToken      string
	Now            time.Time
}

Jump to

Keyboard shortcuts

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