Documentation
¶
Overview ¶
Package mid provides app level middleware support.
Index ¶
- Variables
- func Authenticate(client authclient.Authenticator) web.MidFunc
- func Authorize(client authclient.Authenticator, rule string) web.MidFunc
- func AuthorizeHome(client authclient.Authenticator, homeBus homebus.ExtBusiness) web.MidFunc
- func AuthorizeProduct(client authclient.Authenticator, productBus productbus.ExtBusiness) web.MidFunc
- func AuthorizeUser(client authclient.Authenticator, userBus userbus.ExtBusiness, rule string) web.MidFunc
- func Basic(ath *auth.Auth, userBus userbus.ExtBusiness) web.MidFunc
- func Bearer(ath *auth.Auth) web.MidFunc
- func BeginCommitRollback(log *logger.Logger, bgn sqldb.Beginner) web.MidFunc
- func Errors(log *logger.Logger) web.MidFunc
- func GetClaims(ctx context.Context) auth.Claims
- func GetHome(ctx context.Context) (homebus.Home, error)
- func GetProduct(ctx context.Context) (productbus.Product, error)
- func GetSubjectID(ctx context.Context) uuid.UUID
- func GetTran(ctx context.Context) (sqldb.CommitRollbacker, error)
- func GetUser(ctx context.Context) (userbus.User, error)
- func GetUserID(ctx context.Context) (uuid.UUID, error)
- func HandleAuthentication(ctx context.Context, ath *auth.Auth, authorizationHeader string) (context.Context, *errs.Error)
- func HandleAuthorization(ctx context.Context, authorizationHeader string, userBus userbus.ExtBusiness, ...) (context.Context, *errs.Error)
- func Logger(log *logger.Logger) web.MidFunc
- func Metrics() web.MidFunc
- func Otel(tracer trace.Tracer) web.MidFunc
- func Panics() web.MidFunc
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidID = errors.New("ID is not in its proper form")
ErrInvalidID represents a condition where the id is not a uuid.
Functions ¶
func Authenticate ¶
func Authenticate(client authclient.Authenticator) web.MidFunc
Authenticate is a middleware function that integrates with an authentication client to validate user credentials and attach user data to the request context.
func Authorize ¶
func Authorize(client authclient.Authenticator, rule string) web.MidFunc
Authorize validates authorization via the auth service.
func AuthorizeHome ¶
func AuthorizeHome(client authclient.Authenticator, homeBus homebus.ExtBusiness) web.MidFunc
AuthorizeHome executes the specified role and extracts the specified home from the DB if a home id is specified in the call. Depending on the rule specified, the userid from the claims may be compared with the specified user id from the home.
func AuthorizeProduct ¶
func AuthorizeProduct(client authclient.Authenticator, productBus productbus.ExtBusiness) web.MidFunc
AuthorizeProduct executes the specified role and extracts the specified product from the DB if a product id is specified in the call. Depending on the rule specified, the userid from the claims may be compared with the specified user id from the product.
func AuthorizeUser ¶
func AuthorizeUser(client authclient.Authenticator, userBus userbus.ExtBusiness, rule string) web.MidFunc
AuthorizeUser executes the specified role and extracts the specified user from the DB if a user id is specified in the call. Depending on the rule specified, the userid from the claims may be compared with the specified user id.
func BeginCommitRollback ¶
BeginCommitRollback starts a transaction for the domain call.
func GetProduct ¶
func GetProduct(ctx context.Context) (productbus.Product, error)
GetProduct returns the product from the context.
func GetSubjectID ¶
GetSubjectID returns the subject id from the claims.
func GetTran ¶
func GetTran(ctx context.Context) (sqldb.CommitRollbacker, error)
GetTran retrieves the value that can manage a transaction.
func HandleAuthentication ¶
func HandleAuthorization ¶
Types ¶
This section is empty.