initial commit
This commit is contained in:
commit
54576d9d33
61 changed files with 5569 additions and 0 deletions
22
internal/server/oidc_test.go
Normal file
22
internal/server/oidc_test.go
Normal 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)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue