Documentation ¶
Index ¶
- func AdminRequired() gin.HandlerFunc
- func BasicHeaderAuthRequired(password string, options ...BasicAuthOption) gin.HandlerFunc
- func BlockRequest() gin.HandlerFunc
- func CloudSchedulerMiddleware(c *gin.Context)
- func ContinueSession(queries *db.Queries, authRefreshCache *redis.Cache) gin.HandlerFunc
- func ErrLogger() gin.HandlerFunc
- func GinContextToContext() gin.HandlerFunc
- func HandleCORS() gin.HandlerFunc
- func IPRateLimited(lim *limiters.KeyRateLimiter) gin.HandlerFunc
- func IsOriginAllowed(requestOrigin string) bool
- func RetoolAuthRequired(ctx *gin.Context)
- func Sentry(reportGinErrors bool) gin.HandlerFunc
- func TaskRequired() gin.HandlerFunc
- func Tracing() gin.HandlerFunc
- type BasicAuthOption
- type BasicAuthOptionBuilder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AdminRequired ¶
func AdminRequired() gin.HandlerFunc
AdminRequired is a middleware that checks if the user is authenticated as an admin
func BasicHeaderAuthRequired ¶
func BasicHeaderAuthRequired(password string, options ...BasicAuthOption) gin.HandlerFunc
BasicHeaderAuthRequired is a middleware that checks if the request has a Basic Auth header matching the specified password. A username can optionally be specified via WithUsername. Failures return http.StatusUnauthorized by default, but this can be changed via WithFailureStatus (for example, returning a 200 to Cloud Tasks to indicate that the task shouldn't be retried). Failures will always abort the request, regardless of the failure status code returned.
func BlockRequest ¶
func BlockRequest() gin.HandlerFunc
BlockRequest is a middleware that blocks posts from being created
func ContinueSession ¶
ContinueSession is a middleware that manages session cookies
func GinContextToContext ¶
func GinContextToContext() gin.HandlerFunc
GinContextToContext is a middleware that adds the Gin context to the request context, allowing the Gin context to be retrieved from within GraphQL resolvers. See: https://gqlgen.com/recipes/gin/
func IPRateLimited ¶
func IPRateLimited(lim *limiters.KeyRateLimiter) gin.HandlerFunc
IPRateLimited is a middleware that rate limits requests by IP address
func IsOriginAllowed ¶
func RetoolAuthRequired ¶
func Sentry ¶
func Sentry(reportGinErrors bool) gin.HandlerFunc
func TaskRequired ¶
func TaskRequired() gin.HandlerFunc
TaskRequired checks that the request comes from Cloud Tasks. Returns a 200 status to remove the message from the queue if it is a bad request.
func Tracing ¶
func Tracing() gin.HandlerFunc
Types ¶
type BasicAuthOption ¶
type BasicAuthOption func(*basicAuthOptions)
type BasicAuthOptionBuilder ¶
type BasicAuthOptionBuilder struct{}
func (BasicAuthOptionBuilder) WithFailureStatus ¶
func (BasicAuthOptionBuilder) WithFailureStatus(statusCode int) BasicAuthOption
func (BasicAuthOptionBuilder) WithUsername ¶
func (BasicAuthOptionBuilder) WithUsername(username string) BasicAuthOption