Skip to content

Commit

Permalink
Regression fix for request ID in refresh token flow
Browse files Browse the repository at this point in the history
Signed-off-by: Beorn Facchini <beorn@lade.io>
  • Loading branch information
beornf committed Apr 26, 2018
1 parent cca6af4 commit 349121b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions request.go
Expand Up @@ -137,6 +137,7 @@ func (a *Request) Sanitize(allowedParameters []string) Requester {
}

*b = *a
b.ID = a.GetID()
b.Form = url.Values{}
for k := range a.Form {
if _, ok := allowed[k]; ok {
Expand Down
15 changes: 15 additions & 0 deletions request_test.go
Expand Up @@ -99,3 +99,18 @@ func TestSanitizeRequest(t *testing.T) {
assert.Equal(t, "fasdf", a.GetRequestForm().Get("baz"))
assert.Equal(t, "fasdf", a.GetRequestForm().Get("foo"))
}

func TestIdentifyRequest(t *testing.T) {
a := &Request{
RequestedAt: time.Now().UTC(),
Client: &DefaultClient{},
Scopes: Arguments{},
GrantedScopes: []string{},
Form: url.Values{"foo": []string{"bar"}},
Session: new(DefaultSession),
}

b := a.Sanitize([]string{})
b.GetID()
assert.Equal(t, a.ID, b.GetID())
}

0 comments on commit 349121b

Please sign in to comment.