diff --git a/backend/internal/auth/auth.go b/backend/internal/auth/auth.go index de6f02b..6b01f8e 100644 --- a/backend/internal/auth/auth.go +++ b/backend/internal/auth/auth.go @@ -1,6 +1,7 @@ package auth import ( + "Noooste/garage-ui/pkg/logger" "context" "crypto/subtle" "encoding/base64" @@ -107,35 +108,6 @@ func (a *Service) ValidateBasicAuth(username, password string) bool { return usernameMatch && passwordMatch } -// ParseBasicAuth parses the Authorization header for basic auth -func ParseBasicAuth(authHeader string) (username, password string, ok bool) { - if authHeader == "" { - return "", "", false - } - - // Check if it's a Basic auth header - const prefix = "Basic " - if !strings.HasPrefix(authHeader, prefix) { - return "", "", false - } - - // Decode base64 credentials - encoded := authHeader[len(prefix):] - decoded, err := base64.StdEncoding.DecodeString(encoded) - if err != nil { - return "", "", false - } - - // Split username:password - credentials := string(decoded) - parts := strings.SplitN(credentials, ":", 2) - if len(parts) != 2 { - return "", "", false - } - - return parts[0], parts[1], true -} - // GetAuthorizationURL returns the OIDC authorization URL for login func (a *Service) GetAuthorizationURL(state string) (string, error) { if a.oauth2Config == nil { @@ -213,6 +185,8 @@ func (a *Service) GetUserInfo(ctx context.Context, token *oauth2.Token) (*UserIn return nil, fmt.Errorf("failed to parse user info claims: %w", err) } + logger.Debug().Interface("claims", claims).Msg("Extracted user info claims") + // Build user info userInfo := &UserInfo{ Username: extractClaim(claims, a.authConfig.OIDC.UsernameAttribute), diff --git a/config.yaml.example b/config.yaml.example index b0cbda1..f3186ff 100644 --- a/config.yaml.example +++ b/config.yaml.example @@ -57,9 +57,6 @@ auth: # OIDC Provider URLs issuer_url: "https://keycloak.example.com/realms/master" - auth_url: "https://keycloak.example.com/realms/master/protocol/openid-connect/auth" - token_url: "https://keycloak.example.com/realms/master/protocol/openid-connect/token" - userinfo_url: "https://keycloak.example.com/realms/master/protocol/openid-connect/userinfo" # Token validation skip_issuer_check: false diff --git a/helm/garage-ui/README.md b/helm/garage-ui/README.md index d3a2cf9..4bc3cfe 100644 --- a/helm/garage-ui/README.md +++ b/helm/garage-ui/README.md @@ -409,9 +409,6 @@ config: - email - profile issuer_url: "https://auth.example.com/realms/production" - auth_url: "https://auth.example.com/realms/production/protocol/openid-connect/auth" - token_url: "https://auth.example.com/realms/production/protocol/openid-connect/token" - userinfo_url: "https://auth.example.com/realms/production/protocol/openid-connect/userinfo" cookie_secure: true cookie_http_only: true cookie_same_site: "lax" diff --git a/helm/garage-ui/values.schema.json b/helm/garage-ui/values.schema.json index 0b523da..69c9da8 100644 --- a/helm/garage-ui/values.schema.json +++ b/helm/garage-ui/values.schema.json @@ -292,24 +292,6 @@ "pattern": "^https?://", "default": "https://keycloak.example.com/realms/master" }, - "auth_url": { - "type": "string", - "description": "Authorization endpoint URL", - "pattern": "^https?://", - "default": "https://keycloak.example.com/realms/master/protocol/openid-connect/auth" - }, - "token_url": { - "type": "string", - "description": "Token endpoint URL", - "pattern": "^https?://", - "default": "https://keycloak.example.com/realms/master/protocol/openid-connect/token" - }, - "userinfo_url": { - "type": "string", - "description": "User info endpoint URL", - "pattern": "^https?://", - "default": "https://keycloak.example.com/realms/master/protocol/openid-connect/userinfo" - }, "skip_issuer_check": { "type": "boolean", "description": "Skip issuer validation (not recommended for production)", diff --git a/helm/garage-ui/values.yaml b/helm/garage-ui/values.yaml index f0a813c..96951d0 100644 --- a/helm/garage-ui/values.yaml +++ b/helm/garage-ui/values.yaml @@ -77,9 +77,6 @@ config: - profile # OIDC provider endpoints issuer_url: "https://keycloak.example.com/realms/master" - auth_url: "https://keycloak.example.com/realms/master/protocol/openid-connect/auth" - token_url: "https://keycloak.example.com/realms/master/protocol/openid-connect/token" - userinfo_url: "https://keycloak.example.com/realms/master/protocol/openid-connect/userinfo" # Validation settings skip_issuer_check: false skip_expiry_check: false