middleware

package
v1.10.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 3, 2023 License: AGPL-3.0 Imports: 6 Imported by: 0

README

Middlewares

  • The default middleware is TokenMiddleware, which expects an access token, that can be sent to AAI in return for GA4GH visas.
  • One may create custom middlewares in this middleware package, and register them to the availableMiddlewares in config.go, and adding a case for them in main.go.
  • A middleware for runtime can then be selected with the app.middleware config.
  • For custom middlewares, it is important, that they use the storeDatasets function available in middleware.go to set the permissions for accessing data.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GetCacheFromContext = func(c *gin.Context) session.Cache {
	var cache session.Cache
	cached, exists := c.Get(requestContextKey)
	if exists {
		cache = cached.(session.Cache)
	}
	log.Debugf("returning %v from request context", cached)

	return cache
}

GetCacheFromContext is a helper function that endpoints can use to get data stored to the *current* request context (not the session storage). The request context was populated by the middleware, which in turn uses the session storage.

Functions

func TokenMiddleware

func TokenMiddleware() gin.HandlerFunc

TokenMiddleware performs access token verification and validation JWTs are verified and validated by the app, opaque tokens are sent to AAI for verification Successful auth results in list of authorised datasets. The datasets are stored into a session cache for subsequent requests, and also to the current request context for use in the endpoints.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL