initial commit

This commit is contained in:
Daniel Noulet 2026-10-01 23:15:57 +02:00
commit 54576d9d33
61 changed files with 5569 additions and 0 deletions

View file

@ -0,0 +1,22 @@
package server
import (
"net/http/httptest"
"testing"
"github.com/danyel/go-loose/internal/config"
)
func TestOAuthStateCookieDomain(t *testing.T) {
server := &Server{cfg: config.Config{AuthDomain: "auth.local"}}
tenantRequest := httptest.NewRequest("GET", "http://nmbs.auth.local/auth/start", nil)
if domain := server.oauthStateCookieDomain(tenantRequest); domain != "auth.local" {
t.Fatalf("tenant cookie domain = %q, want auth.local", domain)
}
localRequest := httptest.NewRequest("GET", "http://localhost:8080/auth/start", nil)
if domain := server.oauthStateCookieDomain(localRequest); domain != "" {
t.Fatalf("local cookie domain = %q, want host-only cookie", domain)
}
}