ultisuite-backend/internal/api/middleware/forwarded_test.go
R3D347HR4Y 525edb188a
Some checks are pending
CI / Go tests (push) Waiting to run
CI / Integration tests (push) Waiting to run
CI / DB migrations (push) Waiting to run
feat(authentik): enhance OIDC flow with new logout redirect and branding support
- Added a new blueprint for OIDC logout that invalidates the Authentik session and redirects to a specified landing page.
- Introduced custom CSS and JS files for branding, improving the visual integration of Authentik flows.
- Updated Nginx configuration to serve the new branding assets and handle specific routes for signup and password recovery.
- Enhanced the flow completion logic to support OIDC bridge functionality, including session management and redirect handling.
- Implemented unit tests for the new OIDC bridge and flow context functionalities to ensure reliability.
2026-06-21 00:12:53 +02:00

29 lines
742 B
Go

package middleware
import (
"net/http"
"net/http/httptest"
"testing"
)
func TestForwardedHeaders(t *testing.T) {
var gotScheme, gotHost string
handler := ForwardedHeaders(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
gotScheme = r.URL.Scheme
gotHost = r.URL.Host
}))
req := httptest.NewRequest(http.MethodGet, "http://ultid:8080/api/v1/calendar", nil)
req.Header.Set("X-Forwarded-Proto", "https")
req.Header.Set("X-Forwarded-Host", "dev.ultispace.fr")
req.Host = "dev.ultispace.fr"
handler.ServeHTTP(httptest.NewRecorder(), req)
if gotScheme != "https" {
t.Fatalf("scheme = %q, want https", gotScheme)
}
if gotHost != "dev.ultispace.fr" {
t.Fatalf("host = %q, want dev.ultispace.fr", gotHost)
}
}