Documentation ¶
Index ¶
- Variables
- func AlignTime(unaligned time.Time, interval int) time.Time
- func AppUserJwtAuthzMiddleware(config *config.AppConfig) gin.HandlerFunc
- func AppUserProjectAuthzMiddleware(store interfaces.Datastore, config *config.AppConfig) gin.HandlerFunc
- func JSONStatsMiddleware(store interfaces.Datastore, emitter *events.Processor) gin.HandlerFunc
- func OpenCORSMiddleware() gin.HandlerFunc
- func ProjectAuthzBuildFiltersMiddleware(store interfaces.Datastore) gin.HandlerFunc
- func ProjectIDAuthzMiddleware(store interfaces.Datastore) gin.HandlerFunc
- func ProjectUserAuthzMiddleware(store interfaces.Datastore, config *config.AppConfig) gin.HandlerFunc
- func ProjectUserRegistrationMiddleware(store interfaces.Datastore) gin.HandlerFunc
- func RequestRateLimit(store interfaces.Datastore, cache redis.UniversalClient) gin.HandlerFunc
- func ResourceStatsMiddleware(store interfaces.Datastore, emitter *events.Processor) gin.HandlerFunc
- func SubDomainMiddleware() gin.HandlerFunc
- func ValidateRefreshToken(store interfaces.Datastore, config *config.AppConfig) gin.HandlerFunc
- type StoreConfig
Constants ¶
This section is empty.
Variables ¶
var APIKEY = "apikey"
APIKEY is the key for the apikey authorization token
var BEARER = "bearer"
BEARER is the key for the bearer authorization token
var JSONKey = "json"
JSONKey is the constant value for the URL parameter
var Resources = "api"
Resources is the constant value for the URL parameter
Functions ¶
func AlignTime ¶
AlignTime returns the aligned `time.Time` based on the `unaligned` parameter and the `interval` to align with (in minutes)
func AppUserJwtAuthzMiddleware ¶
func AppUserJwtAuthzMiddleware(config *config.AppConfig) gin.HandlerFunc
AppUserJwtAuthzMiddleware authorizes the JWT in the Authorization header for application users
func AppUserProjectAuthzMiddleware ¶
func AppUserProjectAuthzMiddleware(store interfaces.Datastore, config *config.AppConfig) gin.HandlerFunc
AppUserProjectAuthzMiddleware validates this app user has access to the project
func JSONStatsMiddleware ¶
func JSONStatsMiddleware(store interfaces.Datastore, emitter *events.Processor) gin.HandlerFunc
JSONStatsMiddleware logs json stats for reporting
func OpenCORSMiddleware ¶
func OpenCORSMiddleware() gin.HandlerFunc
OpenCORSMiddleware controls the cross origin policies.
func ProjectAuthzBuildFiltersMiddleware ¶
func ProjectAuthzBuildFiltersMiddleware(store interfaces.Datastore) gin.HandlerFunc
ProjectAuthzBuildFiltersMiddleware builds the necessary filters based on the requester's role, permissions, as well as the collection/resource's access policies. This middleware requires that the requester `role` has been injected into the context.
func ProjectIDAuthzMiddleware ¶
func ProjectIDAuthzMiddleware(store interfaces.Datastore) gin.HandlerFunc
ProjectIDAuthzMiddleware retrieves the project ID
func ProjectUserAuthzMiddleware ¶
func ProjectUserAuthzMiddleware(store interfaces.Datastore, config *config.AppConfig) gin.HandlerFunc
ProjectUserAuthzMiddleware authenticates the JWT and verifies the requesting user has access to this project. This middleware requires that the `project` has been injected into the context.
func ProjectUserRegistrationMiddleware ¶
func ProjectUserRegistrationMiddleware(store interfaces.Datastore) gin.HandlerFunc
ProjectUserRegistrationMiddleware verifies this project has User Registration enabled
func RequestRateLimit ¶
func RequestRateLimit(store interfaces.Datastore, cache redis.UniversalClient) gin.HandlerFunc
RequestRateLimit checks the account rate limit and returns 429 if over app tier limit
func ResourceStatsMiddleware ¶
func ResourceStatsMiddleware(store interfaces.Datastore, emitter *events.Processor) gin.HandlerFunc
ResourceStatsMiddleware logs resource stats and logging for reporting
func SubDomainMiddleware ¶
func SubDomainMiddleware() gin.HandlerFunc
SubDomainMiddleware controls the cross origin policies.
func ValidateRefreshToken ¶
func ValidateRefreshToken(store interfaces.Datastore, config *config.AppConfig) gin.HandlerFunc
ValidateRefreshToken validates the refresh token
Types ¶
type StoreConfig ¶
type StoreConfig struct { Create bool Read bool Update bool Delete bool ParallelRead bool ParallelWrite bool Headers map[string]string }
StoreConfig holds the middleware-relevant config for a collection/resource
func (*StoreConfig) VerbRequiresAuthn ¶
func (s *StoreConfig) VerbRequiresAuthn(verb string) (bool, error)
VerbRequiresAuthn returns if the provided HTTP Verb requires authentication for this endpoint