Skip to content

Commit

Permalink
oauth2: resolve session issue with deep nested session
Browse files Browse the repository at this point in the history
Closes #512
  • Loading branch information
Aeneas Rekkas (arekkas) authored and arekkas committed Jun 17, 2017
1 parent 0f98e88 commit a89a470
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
6 changes: 4 additions & 2 deletions glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions glide.yaml
Expand Up @@ -64,6 +64,7 @@ import:
subpackages:
- clientcredentials
- package: gopkg.in/yaml.v2
- package: github.com/mohae/deepcopy
testImport:
- package: github.com/bmizerany/assert
- package: github.com/ory/dockertest
12 changes: 2 additions & 10 deletions oauth2/session.go
@@ -1,9 +1,7 @@
package oauth2

import (
"bytes"
"encoding/gob"

"github.com/mohae/deepcopy"
"github.com/ory/fosite"
"github.com/ory/fosite/handler/openid"
"github.com/ory/fosite/token/jwt"
Expand All @@ -29,11 +27,5 @@ func (s *Session) Clone() fosite.Session {
return nil
}

var clone Session
var mod bytes.Buffer
enc := gob.NewEncoder(&mod)
dec := gob.NewDecoder(&mod)
_ = enc.Encode(s)
_ = dec.Decode(&clone)
return &clone
return deepcopy.Copy(s).(fosite.Session)
}

0 comments on commit a89a470

Please sign in to comment.