Documentation
¶
Overview ¶
Package auth handles sever-side and client-side authentication
Index ¶
- Constants
- func NewService(rdb *redis.Client, config core.Config, entity core.EntityService, ...) core.AuthService
- func Recaptcha(validator *recaptcha.ReCAPTCHA) echo.MiddlewareFunc
- func ReceiveGatewayAuthPropagation(next echo.HandlerFunc) echo.HandlerFunc
- func Restrict(principal Principal) echo.MiddlewareFunc
- type Handler
- type Principal
Constants ¶
const ( ISADMIN = iota ISLOCAL ISKNOWN ISUNITED ISREGISTERED )
Variables ¶
This section is empty.
Functions ¶
func NewService ¶
func NewService( rdb *redis.Client, config core.Config, entity core.EntityService, domain core.DomainService, key core.KeyService, policy core.PolicyService, ) core.AuthService
NewService creates a new auth service
func Recaptcha ¶
func Recaptcha(validator *recaptcha.ReCAPTCHA) echo.MiddlewareFunc
Recaptcha is a middleware factory that returns a middleware to verify reCAPTCHA challenges. It expects the challenge response in the "captcha" header and uses the provided validator. If verification is successful, it sets a flag in the context.
func ReceiveGatewayAuthPropagation ¶
func ReceiveGatewayAuthPropagation(next echo.HandlerFunc) echo.HandlerFunc
ReceiveGatewayAuthPropagation is a middleware that receives authentication information propagated from a gateway via HTTP headers. It extracts requester type, ID, tags, domain, keychain, etc., and sets them in the context. This is typically used in internal services that sit behind an authenticating gateway.
func Restrict ¶
func Restrict(principal Principal) echo.MiddlewareFunc
Restrict is a middleware factory that returns a middleware to restrict access based on the requester's principal type. It checks the requester type and tags stored in the context against the required principal level (e.g., ISADMIN, ISLOCAL).
Types ¶
type Handler ¶
Handler is the interface for handling HTTP requests
func NewHandler ¶
func NewHandler(service core.AuthService) Handler
NewHandler creates a new handler