middleware

package
v5.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package middleware provides HTTP middlewares for the application.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CORSMiddleware

func CORSMiddleware() gin.HandlerFunc

CORSMiddleware handles CORS headers and preflight requests

func GetUserEmail

func GetUserEmail(c *gin.Context) (string, bool)

GetUserEmail retrieves the authenticated user's email from context

func GetUserInfo

func GetUserInfo(c *gin.Context) map[string]interface{}

GetUserInfo retrieves all user info from context

func GoogleAuthMiddleware

func GoogleAuthMiddleware() gin.HandlerFunc

GoogleAuthMiddleware validates Google OAuth ID tokens Only enforces authentication when running on Cloud Run

func IsCloudRun

func IsCloudRun() bool

IsCloudRun checks if the application is running on Google Cloud Run

func LogAuthInfo

func LogAuthInfo(c *gin.Context)

LogAuthInfo logs authentication information (useful for debugging)

func OptionalAuthMiddleware

func OptionalAuthMiddleware() gin.HandlerFunc

OptionalAuthMiddleware checks for authentication but doesn't enforce it Useful for endpoints that can work with or without auth

Types

This section is empty.

Jump to

Keyboard shortcuts

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