registerpolicy

package
v1.14.21 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MethodEmail  = authmethod.Email
	MethodMobile = authmethod.Mobile
	MethodDevice = authmethod.Device
)

Variables

This section is empty.

Functions

func EnsureMethodEnabled

func EnsureMethodEnabled(ctx context.Context, svcCtx *svc.ServiceContext, method string) error

EnsureMethodEnabled rejects direct calls to authentication methods disabled by the administrator. OAuth methods are loaded from the auth_method table.

func EnsureRegistrationOpen

func EnsureRegistrationOpen(ctx context.Context, svcCtx *svc.ServiceContext, method string) error

EnsureRegistrationOpen applies policies shared by every new-account path.

func TakeIPPermit

func TakeIPPermit(ctx context.Context, svcCtx *svc.ServiceContext, ip string) error

TakeIPPermit atomically reserves one registration from the configured IP quota. The duration is configured in minutes.

func VerifyHuman

func VerifyHuman(ctx context.Context, svcCtx *svc.ServiceContext, token, ip string) error

VerifyHuman enforces the configured registration Turnstile challenge.

Types

type ServicePolicy added in v1.14.18

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

ServicePolicy adapts the application service context to a use case policy port. Use cases should depend on its small method set rather than on ServiceContext directly.

func NewServicePolicy added in v1.14.18

func NewServicePolicy(svcCtx *svc.ServiceContext) ServicePolicy

func (ServicePolicy) EnsureMethodEnabled added in v1.14.18

func (p ServicePolicy) EnsureMethodEnabled(ctx context.Context, method string) error

func (ServicePolicy) EnsureRegistrationOpen added in v1.14.18

func (p ServicePolicy) EnsureRegistrationOpen(ctx context.Context, method string) error

func (ServicePolicy) TakeIPPermit added in v1.14.18

func (p ServicePolicy) TakeIPPermit(ctx context.Context, ip string) error

func (ServicePolicy) VerifyHuman added in v1.14.18

func (p ServicePolicy) VerifyHuman(ctx context.Context, token, ip string) error

Jump to

Keyboard shortcuts

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