Skip to content

Commit

Permalink
oauth2: state parameter is missing when response_type=id_token - closes
Browse files Browse the repository at this point in the history
  • Loading branch information
Aeneas Rekkas (arekkas) committed Sep 21, 2016
1 parent ddd8d03 commit 4db1422
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions handler/openid/flow_implicit.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ func (c *OpenIDConnectImplicitHandler) HandleAuthorizeEndpointRequest(ctx contex
}

claims.AccessTokenHash = hash[:c.RS256JWTStrategy.GetSigningMethodLength()/2]
} else {
resp.AddFragment("state", ar.GetState())
}

if err := c.IssueImplicitIDToken(ctx, req, ar, resp); err != nil {
Expand Down
4 changes: 4 additions & 0 deletions handler/openid/flow_implicit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func TestImplicit_HandleAuthorizeEndpointRequest(t *testing.T) {
description: "should not do anything because request requirements are not met",
setup: func() {
areq.ResponseTypes = fosite.Arguments{"id_token"}
areq.State = "foostate"
},
},
{
Expand Down Expand Up @@ -121,6 +122,7 @@ func TestImplicit_HandleAuthorizeEndpointRequest(t *testing.T) {
},
check: func() {
assert.NotEmpty(t, aresp.GetFragment().Get("id_token"))
assert.NotEmpty(t, aresp.GetFragment().Get("state"))
assert.Empty(t, aresp.GetFragment().Get("access_token"))
},
},
Expand All @@ -131,6 +133,7 @@ func TestImplicit_HandleAuthorizeEndpointRequest(t *testing.T) {
},
check: func() {
assert.NotEmpty(t, aresp.GetFragment().Get("id_token"))
assert.NotEmpty(t, aresp.GetFragment().Get("state"))
assert.NotEmpty(t, aresp.GetFragment().Get("access_token"))
},
},
Expand All @@ -142,6 +145,7 @@ func TestImplicit_HandleAuthorizeEndpointRequest(t *testing.T) {
},
check: func() {
assert.NotEmpty(t, aresp.GetFragment().Get("id_token"))
assert.NotEmpty(t, aresp.GetFragment().Get("state"))
assert.NotEmpty(t, aresp.GetFragment().Get("access_token"))
},
},
Expand Down

0 comments on commit 4db1422

Please sign in to comment.