Documentation
¶
Index ¶
- Constants
- func EnsureMethodEnabled(ctx context.Context, svcCtx *svc.ServiceContext, method string) error
- func EnsureRegistrationOpen(ctx context.Context, svcCtx *svc.ServiceContext, method string) error
- func TakeIPPermit(ctx context.Context, svcCtx *svc.ServiceContext, ip string) error
- func VerifyHuman(ctx context.Context, svcCtx *svc.ServiceContext, token, ip string) error
- type ServicePolicy
- func (p ServicePolicy) EnsureMethodEnabled(ctx context.Context, method string) error
- func (p ServicePolicy) EnsureRegistrationOpen(ctx context.Context, method string) error
- func (p ServicePolicy) TakeIPPermit(ctx context.Context, ip string) error
- func (p ServicePolicy) VerifyHuman(ctx context.Context, token, ip string) error
Constants ¶
View Source
const ( MethodEmail = authmethod.Email MethodMobile = authmethod.Mobile MethodDevice = authmethod.Device )
Variables ¶
This section is empty.
Functions ¶
func EnsureMethodEnabled ¶
EnsureMethodEnabled rejects direct calls to authentication methods disabled by the administrator. OAuth methods are loaded from the auth_method table.
func EnsureRegistrationOpen ¶
EnsureRegistrationOpen applies policies shared by every new-account path.
func TakeIPPermit ¶
TakeIPPermit atomically reserves one registration from the configured IP quota. The duration is configured in minutes.
func VerifyHuman ¶
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
Click to show internal directories.
Click to hide internal directories.