- 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.
29 lines
742 B
Go
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)
|
|
}
|
|
}
|