MCPcopy Create free account
hub / github.com/discourse/discourse-auth-proxy / BuildTestSSOURL

Function BuildTestSSOURL

main_test.go:72–87  ·  view source on GitHub ↗
(options SSOOptions)

Source from the content-addressed store, hash-verified

70}
71
72func BuildTestSSOURL(options SSOOptions) string {
73 innerqs := url.Values{
74 "username": []string{"sam"},
75 "groups": []string{options.Groups},
76 "admin": []string{strconv.FormatBool(options.Admin)},
77 "nonce": []string{options.Nonce},
78 }
79 inner := base64.StdEncoding.EncodeToString([]byte(innerqs.Encode()))
80
81 u := mustParseURL(options.URL)
82 outerqs := u.Query()
83 outerqs.Set("sso", inner)
84 outerqs.Set("sig", computeHMAC(inner, options.Secret))
85 u.RawQuery = outerqs.Encode()
86 return u.String()
87}
88
89func GetTestResult(t *testing.T, configOverride ConfigOverrideFunc, ssoOverride SSOOverrideFunc) *http.Response {
90 handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {

Callers 1

GetTestResultFunction · 0.85

Calls 2

mustParseURLFunction · 0.85
computeHMACFunction · 0.85

Tested by

no test coverage detected