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
|
||||
}
|
||||
codeResponse := struct {
|
||||
code string
|
||||
state string
|
||||
Code string `schema:"code"`
|
||||
State string `schema:"state,omitempty"`
|
||||
}{
|
||||
code: code,
|
||||
state: authReq.GetState(),
|
||||
Code: code,
|
||||
State: authReq.GetState(),
|
||||
}
|
||||
callback, err := AuthResponseURL(authReq.GetRedirectURI(), authReq.GetResponseType(), authReq.GetResponseMode(), &codeResponse, authorizer.Encoder())
|
||||
if err != nil {
|
||||
|
|
|
@ -1026,7 +1026,7 @@ func TestAuthResponseCode(t *testing.T) {
|
|||
},
|
||||
res: res{
|
||||
wantCode: http.StatusFound,
|
||||
wantLocationHeader: "/auth/callback/?code=id1&state=",
|
||||
wantLocationHeader: "/auth/callback/?code=id1&state=state1",
|
||||
wantBody: "",
|
||||
},
|
||||
},
|
||||
|
@ -1051,7 +1051,7 @@ func TestAuthResponseCode(t *testing.T) {
|
|||
},
|
||||
res: res{
|
||||
wantCode: http.StatusFound,
|
||||
wantLocationHeader: "/auth/callback/?code=id1&state=state1",
|
||||
wantLocationHeader: "/auth/callback/?code=id1",
|
||||
wantBody: "",
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue