Documentation
¶
Overview ¶
Package nexssflow exposes auth session and host-authorized lifecycle actions to Flow runners. The Bundle factory supports module @require; the host must still supply per-execution dependencies through WithRuntimeDependencies.
Index ¶
- Constants
- func Bundle(_ map[string]string) compiler.Bundle
- func NewBundle(service *auth.Service) compiler.Bundle
- func NewBundleWithBoundary(service *auth.Service, boundary ActionBoundary) (compiler.Bundle, error)
- func WithRuntimeDependencies(ctx context.Context, service *auth.Service, boundary ActionBoundary) (context.Context, error)
- type ActionBoundary
- type TurnstileActionBoundary
Constants ¶
const ( BundleID = "nexssp_auth_nexssflow" LibraryName = "auth" AuthRoutesModule = "nflows/auth.nflow" )
Variables ¶
This section is empty.
Functions ¶
func Bundle ¶
Bundle is the conventional Flow extension factory resolved by `@require github.com/nexssp/auth`. Dependencies are read from each execution context, so this function never manufactures host policy, persistence, or security configuration.
func NewBundle ¶
NewBundle preserves the session-only bundle for hosts that have not configured Flow-action request authorization. Credential-bearing actions are not mounted.
func NewBundleWithBoundary ¶
NewBundleWithBoundary exposes auth lifecycle actions only when the host provides their mandatory caller, CSRF/origin, Turnstile, and rate-limit guard.
func WithRuntimeDependencies ¶
func WithRuntimeDependencies(ctx context.Context, service *auth.Service, boundary ActionBoundary) (context.Context, error)
WithRuntimeDependencies adds the host-owned auth service and Flow action boundary to the context for one Flow execution. For HTTP routes, call it from the host middleware so each request receives its own trusted dependencies.
Types ¶
type ActionBoundary ¶
type ActionBoundary interface {
AuthorizeAuthFlowAction(ctx context.Context, operation auth.BoundaryOperation, turnstileToken string) error
}
ActionBoundary applies the host's caller, CSRF/origin, Turnstile, and rate-limit policy before a credential-bearing Flow action invokes auth. Hosts must derive those checks from trusted request context, never from caller-supplied identity fields.
type TurnstileActionBoundary ¶ added in v0.2.0
type TurnstileActionBoundary struct {
// contains filtered or unexported fields
}
TurnstileActionBoundary composes host authorization with server-side Turnstile verification for selected Flow auth operations.
func NewTurnstileActionBoundary ¶ added in v0.2.0
func NewTurnstileActionBoundary(next ActionBoundary, verifier auth.TurnstileVerifier, operations ...auth.BoundaryOperation) (*TurnstileActionBoundary, error)
NewTurnstileActionBoundary constructs a Flow boundary that verifies tokens using the action name associated with each selected auth operation. The wrapped boundary should enforce trusted identity, origin/CSRF, registration rules, and rate limits, but should not separately verify the same token.
func (*TurnstileActionBoundary) AuthorizeAuthFlowAction ¶ added in v0.2.0
func (boundary *TurnstileActionBoundary) AuthorizeAuthFlowAction(ctx context.Context, operation auth.BoundaryOperation, responseToken string) error
AuthorizeAuthFlowAction runs the host's trusted-context checks before verifying a required Turnstile response.