mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-16 18:43:10 -06:00
parent
1c17c20097
commit
808eb2279b
|
|
@ -63,7 +63,7 @@ func SSORedirect(
|
||||||
Code: http.StatusBadRequest,
|
Code: http.StatusBadRequest,
|
||||||
JSON: jsonerror.InvalidArgumentValue("Invalid redirectURL: " + err.Error()),
|
JSON: jsonerror.InvalidArgumentValue("Invalid redirectURL: " + err.Error()),
|
||||||
}
|
}
|
||||||
} else if ru.Scheme == "" || ru.Host == "" || ru.Path == "" {
|
} else if ru.Scheme == "" || ru.Host == "" {
|
||||||
return util.JSONResponse{
|
return util.JSONResponse{
|
||||||
Code: http.StatusBadRequest,
|
Code: http.StatusBadRequest,
|
||||||
JSON: jsonerror.InvalidArgumentValue("Invalid redirectURL: " + redirectURL),
|
JSON: jsonerror.InvalidArgumentValue("Invalid redirectURL: " + redirectURL),
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,21 @@ func TestSSORedirect(t *testing.T) {
|
||||||
WantLocationRE: `http://auth.example.com/authorize\?callbackURL=http.*%3Fprovider%3Dsomeprovider&nonce=.+&providerID=someprovider`,
|
WantLocationRE: `http://auth.example.com/authorize\?callbackURL=http.*%3Fprovider%3Dsomeprovider&nonce=.+&providerID=someprovider`,
|
||||||
WantSetCookieRE: "sso_nonce=[^;].*Path=/_matrix/v4/login/sso",
|
WantSetCookieRE: "sso_nonce=[^;].*Path=/_matrix/v4/login/sso",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Name: "redirectEmptyredirectPath",
|
||||||
|
Req: http.Request{
|
||||||
|
Host: "matrix.example.com",
|
||||||
|
URL: &url.URL{
|
||||||
|
Path: "/_matrix/v4/login/sso/redirect",
|
||||||
|
RawQuery: url.Values{
|
||||||
|
"redirectUrl": []string{"http://example.com"},
|
||||||
|
}.Encode(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
IDPID: "someprovider",
|
||||||
|
WantLocationRE: `http://auth.example.com/authorize\?callbackURL=http.*%3Fprovider%3Dsomeprovider&nonce=.+&providerID=someprovider`,
|
||||||
|
WantSetCookieRE: "sso_nonce=[^;].*Path=/_matrix/v4/login/sso",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
for _, tst := range tsts {
|
for _, tst := range tsts {
|
||||||
t.Run(tst.Name, func(t *testing.T) {
|
t.Run(tst.Name, func(t *testing.T) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue