Documentation
¶
Index ¶
- func BufferedResponse(ctx context.Context) *events.LambdaFunctionURLResponse
- func Request(ctx context.Context) *events.LambdaFunctionURLRequest
- func RequireGroupMembership(fn func(*gin.Context) (authenticated bool, groups rules.Groups), ...) gin.HandlerFunc
- func StartBuffered(r *gin.Engine, options ...awslambda.Option)
- func StartStream(r *gin.Engine, options ...lambda.Option)
- func StreamResponse(ctx context.Context) *events.LambdaFunctionURLStreamingResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BufferedResponse ¶
func BufferedResponse(ctx context.Context) *events.LambdaFunctionURLResponse
BufferedResponse returns the pending events.LambdaFunctionURLResponse from context.
If the gin handlers passed to StartBuffered or StartStream need access to the pending response, it can be retrieved from context with this method.
func Request ¶
func Request(ctx context.Context) *events.LambdaFunctionURLRequest
Request returns the original events.LambdaFunctionURLRequest from context.
If the gin handlers passed to StartBuffered or StartStream need access to the original invocation, it can be retrieved from context with this method.
func RequireGroupMembership ¶ added in v0.1.3
func RequireGroupMembership(fn func(*gin.Context) (authenticated bool, groups rules.Groups), rule rules.Rule, more ...rules.Rule) gin.HandlerFunc
RequireGroupMembership returns a gin middleware that aborts the request with either http.StatusUnauthorized or http.StatusForbidden depending on whether there exists a user with the current session whose group membership satisfies the given rules.
The middleware must be given a function that can retrieve the user's group from the current request. The argument fn returns whether the session is authenticated and the groups associated with the user. If session is not authenticated then the request is aborted with http.StatusUnauthorized. If the session is authenticated but the groups do not satisfy the rules, the request is aborted with http.StatusForbidden. Otherwise, the request goes through.
func StartBuffered ¶
StartBuffered starts the Lambda loop in BUFFERED mode with the given Gin engine.
func StartStream ¶
StartStream starts the Lambda loop in STREAM_RESPONSE mode with the given Gin engine.
func StreamResponse ¶
func StreamResponse(ctx context.Context) *events.LambdaFunctionURLStreamingResponse
StreamResponse returns the pending events.LambdaFunctionURLStreamingResponse from context.
If the gin handlers passed to StartBuffered or StartStream need access to the pending response, it can be retrieved from context with this method.
Types ¶
This section is empty.