Skip to content

Commit

Permalink
chore: issue 107, fix secretskeeper example to store changes
Browse files Browse the repository at this point in the history
briwagner authored and shaj13 committed Jul 11, 2021
1 parent 5cfc50e commit da9b88a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions auth/strategies/jwt/examples_test.go
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ type RotatedSecrets struct {
LastRotation time.Time
}

func (r RotatedSecrets) KID() string {
func (r *RotatedSecrets) KID() string {
if time.Now().After(r.LastRotation) {
r.LastRotation = time.Now().Add(r.RotationDuration)
r.LatestID = "your generated id"
@@ -29,7 +29,7 @@ func (r RotatedSecrets) KID() string {
return r.LatestID
}

func (r RotatedSecrets) Get(kid string) (key interface{}, alg string, err error) {
func (r *RotatedSecrets) Get(kid string) (key interface{}, alg string, err error) {
s, ok := r.Secrtes[kid]
if ok {
return s, jwt.HS256, nil
@@ -97,8 +97,8 @@ func ExampleSecretsKeeper() {
u := auth.NewUserInfo("example", "example", nil, nil)
c := libcache.LRU.New(0)

token, err := jwt.IssueAccessToken(u, s)
strategy := jwt.New(c, s)
token, err := jwt.IssueAccessToken(u, &s)
strategy := jwt.New(c, &s)

fmt.Println(err)

0 comments on commit da9b88a

Please sign in to comment.