feat: implement basic oidc functionality

This commit is contained in:
Stavros
2026-01-22 22:30:23 +02:00
parent 6ae7c1cbda
commit 97e90ea560
17 changed files with 916 additions and 18 deletions

View File

@@ -2,6 +2,7 @@ package middleware
import (
"fmt"
"slices"
"strings"
"time"
@@ -13,6 +14,8 @@ import (
"github.com/gin-gonic/gin"
)
var OIDCIgnorePaths = []string{"/api/oidc/token", "/api/oidc/userinfo"}
type ContextMiddlewareConfig struct {
CookieDomain string
}
@@ -37,6 +40,13 @@ func (m *ContextMiddleware) Init() error {
func (m *ContextMiddleware) Middleware() gin.HandlerFunc {
return func(c *gin.Context) {
// There is no point in trying to get credentials if it's an OIDC endpoint
path := c.Request.URL.Path
if slices.Contains(OIDCIgnorePaths, path) {
c.Next()
return
}
cookie, err := m.auth.GetSessionCookie(c)
if err != nil {