mirror of
https://github.com/vmware-tanzu/pinniped.git
synced 2026-01-06 05:27:23 +00:00
Integration tests should use a helper func to infer Supervisor's downstream issuer URL
This commit is contained in:
committed by
Ryan Richard
parent
afec420ce6
commit
0f9352db3b
@@ -5,6 +5,7 @@ package testlib
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"net/url"
|
||||
"os"
|
||||
"sort"
|
||||
"strings"
|
||||
@@ -83,6 +84,20 @@ type TestOIDCUpstream struct {
|
||||
ExpectedGroups []string `json:"expectedGroups"`
|
||||
}
|
||||
|
||||
// InferTheIssuerURL infers the downstream issuer URL from the callback associated with the upstream test client registration.
|
||||
func (upstream *TestOIDCUpstream) InferTheIssuerURL(t *testing.T) (*url.URL, string) {
|
||||
t.Helper()
|
||||
issuerURL, err := url.Parse(upstream.CallbackURL)
|
||||
require.NoError(t, err)
|
||||
require.True(t, strings.HasSuffix(issuerURL.Path, "/callback"))
|
||||
issuerURL.Path = strings.TrimSuffix(issuerURL.Path, "/callback")
|
||||
|
||||
issuerAsString := issuerURL.String()
|
||||
t.Logf("testing with downstream issuer URL %s", issuerAsString)
|
||||
|
||||
return issuerURL, issuerAsString
|
||||
}
|
||||
|
||||
type TestLDAPUpstream struct {
|
||||
Host string `json:"host"`
|
||||
Domain string `json:"domain"`
|
||||
|
||||
Reference in New Issue
Block a user