fix(op): omit empty state from code flow redirect
Add test cases to reproduce the original bug, and it's resolution. closes #415
This commit is contained in:
parent
dcbc40093d
commit
11fef51e2d
2 changed files with 6 additions and 6 deletions
|
@ -448,11 +448,11 @@ func AuthResponseCode(w http.ResponseWriter, r *http.Request, authReq AuthReques
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
codeResponse := struct {
|
codeResponse := struct {
|
||||||
code string
|
Code string `schema:"code"`
|
||||||
state string
|
State string `schema:"state,omitempty"`
|
||||||
}{
|
}{
|
||||||
code: code,
|
Code: code,
|
||||||
state: authReq.GetState(),
|
State: authReq.GetState(),
|
||||||
}
|
}
|
||||||
callback, err := AuthResponseURL(authReq.GetRedirectURI(), authReq.GetResponseType(), authReq.GetResponseMode(), &codeResponse, authorizer.Encoder())
|
callback, err := AuthResponseURL(authReq.GetRedirectURI(), authReq.GetResponseType(), authReq.GetResponseMode(), &codeResponse, authorizer.Encoder())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -1026,7 +1026,7 @@ func TestAuthResponseCode(t *testing.T) {
|
||||||
},
|
},
|
||||||
res: res{
|
res: res{
|
||||||
wantCode: http.StatusFound,
|
wantCode: http.StatusFound,
|
||||||
wantLocationHeader: "/auth/callback/?code=id1&state=",
|
wantLocationHeader: "/auth/callback/?code=id1&state=state1",
|
||||||
wantBody: "",
|
wantBody: "",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -1051,7 +1051,7 @@ func TestAuthResponseCode(t *testing.T) {
|
||||||
},
|
},
|
||||||
res: res{
|
res: res{
|
||||||
wantCode: http.StatusFound,
|
wantCode: http.StatusFound,
|
||||||
wantLocationHeader: "/auth/callback/?code=id1&state=state1",
|
wantLocationHeader: "/auth/callback/?code=id1",
|
||||||
wantBody: "",
|
wantBody: "",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue