Skip to content

Commit 389918d

Browse files
authored
Merge pull request #125 from dmcinnes/support-refresh-tokens-that-do-not-expire
Support access and refresh tokens that do not expire
2 parents 535666c + 7d41418 commit 389918d

File tree

6 files changed

+156
-20
lines changed

6 files changed

+156
-20
lines changed

go.mod

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ require (
1111
github.com/google/go-querystring v1.0.0 // indirect
1212
github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e // indirect
1313
github.com/imkira/go-interpol v1.1.0 // indirect
14-
github.com/jtolds/gls v4.2.1+incompatible // indirect
1514
github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88 // indirect
1615
github.com/mattn/go-colorable v0.0.9 // indirect
1716
github.com/mattn/go-isatty v0.0.4 // indirect
@@ -20,8 +19,7 @@ require (
2019
github.com/onsi/gomega v1.4.3 // indirect
2120
github.com/pmezard/go-difflib v1.0.0 // indirect
2221
github.com/sergi/go-diff v1.0.0 // indirect
23-
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d // indirect
24-
github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c
22+
github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337
2523
github.com/stretchr/testify v1.2.2 // indirect
2624
github.com/tidwall/btree v0.0.0-20170113224114-9876f1454cf0 // indirect
2725
github.com/tidwall/buntdb v1.0.0
@@ -38,5 +36,5 @@ require (
3836
github.com/yudai/gojsondiff v1.0.0 // indirect
3937
github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 // indirect
4038
github.com/yudai/pp v2.0.1+incompatible // indirect
41-
golang.org/x/net v0.0.0-20181217023233-e147a9138326 // indirect
39+
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45
4240
)

go.sum

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
12
github.com/ajg/form v0.0.0-20160822230020-523a5da1a92f h1:zvClvFQwU++UpIUBGC8YmDlfhUrweEy1R1Fj1gu5iIM=
23
github.com/ajg/form v0.0.0-20160822230020-523a5da1a92f/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY=
34
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
@@ -18,14 +19,15 @@ github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM
1819
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
1920
github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk=
2021
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
22+
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
2123
github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e h1:JKmoR8x90Iww1ks85zJ1lfDGgIiMDuIptTOhJq+zKyg=
2224
github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
2325
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
2426
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
2527
github.com/imkira/go-interpol v1.1.0 h1:KIiKr0VSG2CUW1hl1jpiyuzuJeKUUpC8iM1AIE7N1Vk=
2628
github.com/imkira/go-interpol v1.1.0/go.mod h1:z0h2/2T3XF8kyEPpRgJ3kmNv+C43p+I/CoI+jC3w2iA=
27-
github.com/jtolds/gls v4.2.1+incompatible h1:fSuqC+Gmlu6l/ZYAoZzx2pyucC8Xza35fpRVWLVmUEE=
28-
github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
29+
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
30+
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
2931
github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88 h1:uC1QfSlInpQF+M0ao65imhwqKnz3Q2z/d8PWZRMQvDM=
3032
github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k=
3133
github.com/klauspost/compress v1.4.0 h1:8nsMz3tWa9SWWPL60G1V6CUsf4lLjWLTNEtibhe8gh8=
@@ -49,8 +51,8 @@ github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=
4951
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
5052
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
5153
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
52-
github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c h1:Ho+uVpkel/udgjbwB5Lktg9BtvJSh2DT0Hi6LPSyI2w=
53-
github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c/go.mod h1:XDJAKZRPZ1CvBcN2aX5YOUTYGHki24fSF0Iv48Ibg0s=
54+
github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337 h1:WN9BUFbdyOsSH/XohnWpXOlq9NBD5sGAB2FciQMUEe8=
55+
github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
5456
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
5557
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
5658
github.com/tidwall/btree v0.0.0-20170113224114-9876f1454cf0 h1:QnyrPZZvPmR0AtJCxxfCtI1qN+fYpKTKJ/5opWmZ34k=
@@ -86,16 +88,30 @@ github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 h1:BHyfKlQyqbsFN5p3Ifn
8688
github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82/go.mod h1:lgjkn3NuSvDfVJdfcVVdX+jpBxNmX4rDAzaS45IcYoM=
8789
github.com/yudai/pp v2.0.1+incompatible h1:Q4//iY4pNF6yPLZIigmvcl7k/bPgrcTPIFIcmawg5bI=
8890
github.com/yudai/pp v2.0.1+incompatible/go.mod h1:PuxR/8QJ7cyCkFp/aUDS+JY727OFEZkTdatxwunjIkc=
91+
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
92+
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
8993
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
9094
golang.org/x/net v0.0.0-20180911220305-26e67e76b6c3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
91-
golang.org/x/net v0.0.0-20181217023233-e147a9138326 h1:iCzOf0xz39Tstp+Tu/WwyGjUXCk34QhQORRxBeXXTA4=
92-
golang.org/x/net v0.0.0-20181217023233-e147a9138326/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
95+
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e h1:bRhVy7zSSasaqNksaRZiA5EEI+Ei4I1nO5Jh72wfHlg=
96+
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
97+
golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628=
98+
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
99+
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 h1:SVwTIAaPC2U/AvvLNZ2a7OVsmBpC8L5BlwK1whH3hm0=
100+
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
93101
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA=
94102
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
103+
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw=
104+
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
95105
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e h1:o3PsSEY8E4eXWkXrIP9YJALUkVZqzHJT5DOasTyn8Vs=
96106
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
107+
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU=
108+
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
97109
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
98110
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
111+
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384 h1:TFlARGu6Czu1z7q93HTxcP1P+/ZFC/IKythI5RzrnRg=
112+
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
113+
google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508=
114+
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
99115
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
100116
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
101117
gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=

manage/config.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@ import "time"
44

55
// Config authorization configuration parameters
66
type Config struct {
7-
// access token expiration time
7+
// access token expiration time, 0 means it doesn't expire
88
AccessTokenExp time.Duration
9-
// refresh token expiration time
9+
// refresh token expiration time, 0 means it doesn't expire
1010
RefreshTokenExp time.Duration
1111
// whether to generate the refreshing token
1212
IsGenerateRefresh bool
1313
}
1414

1515
// RefreshingConfig refreshing token config
1616
type RefreshingConfig struct {
17-
// access token expiration time
17+
// access token expiration time, 0 means it doesn't expire
1818
AccessTokenExp time.Duration
19-
// refresh token expiration time
19+
// refresh token expiration time, 0 means it doesn't expire
2020
RefreshTokenExp time.Duration
2121
// whether to generate the refreshing token
2222
IsGenerateRefresh bool

manage/manage_test.go

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package manage_test
22

33
import (
44
"testing"
5+
"time"
56

67
"gopkg.in/oauth2.v3"
78
"gopkg.in/oauth2.v3/manage"
@@ -41,6 +42,15 @@ func TestManager(t *testing.T) {
4142
Convey("Token test", func() {
4243
testManager(tgr, manager)
4344
})
45+
46+
Convey("zero expiration access token test", func() {
47+
testZeroAccessExpirationManager(tgr, manager)
48+
testCannotRequestZeroExpirationAccessTokens(tgr, manager)
49+
})
50+
51+
Convey("zero expiration refresh token test", func() {
52+
testZeroRefreshExpirationManager(tgr, manager)
53+
})
4454
})
4555
}
4656

@@ -107,3 +117,110 @@ func testManager(tgr *oauth2.TokenGenerateRequest, manager oauth2.Manager) {
107117
_, err = manager.LoadRefreshToken(refreshToken)
108118
So(err, ShouldNotBeNil)
109119
}
120+
121+
func testZeroAccessExpirationManager(tgr *oauth2.TokenGenerateRequest, manager oauth2.Manager) {
122+
config := manage.Config{
123+
AccessTokenExp: 0, // Set explicitly as we're testing 0 (no) expiration
124+
IsGenerateRefresh: true,
125+
}
126+
m, ok := manager.(*manage.Manager)
127+
So(ok, ShouldBeTrue)
128+
m.SetAuthorizeCodeTokenCfg(&config)
129+
130+
cti, err := manager.GenerateAuthToken(oauth2.Code, tgr)
131+
So(err, ShouldBeNil)
132+
133+
code := cti.GetCode()
134+
So(code, ShouldNotBeEmpty)
135+
136+
atParams := &oauth2.TokenGenerateRequest{
137+
ClientID: tgr.ClientID,
138+
ClientSecret: "11",
139+
RedirectURI: tgr.RedirectURI,
140+
Code: code,
141+
}
142+
ati, err := manager.GenerateAccessToken(oauth2.AuthorizationCode, atParams)
143+
So(err, ShouldBeNil)
144+
145+
accessToken, refreshToken := ati.GetAccess(), ati.GetRefresh()
146+
So(accessToken, ShouldNotBeEmpty)
147+
So(refreshToken, ShouldNotBeEmpty)
148+
149+
tokenInfo, err := manager.LoadAccessToken(accessToken)
150+
So(err, ShouldBeNil)
151+
So(tokenInfo, ShouldNotBeNil)
152+
So(tokenInfo.GetAccess(), ShouldEqual, accessToken)
153+
So(tokenInfo.GetAccessExpiresIn(), ShouldEqual, 0)
154+
}
155+
156+
func testCannotRequestZeroExpirationAccessTokens(tgr *oauth2.TokenGenerateRequest, manager oauth2.Manager) {
157+
config := manage.Config{
158+
AccessTokenExp: time.Hour * 5,
159+
}
160+
m, ok := manager.(*manage.Manager)
161+
So(ok, ShouldBeTrue)
162+
m.SetAuthorizeCodeTokenCfg(&config)
163+
164+
cti, err := manager.GenerateAuthToken(oauth2.Code, tgr)
165+
So(err, ShouldBeNil)
166+
167+
code := cti.GetCode()
168+
So(code, ShouldNotBeEmpty)
169+
170+
atParams := &oauth2.TokenGenerateRequest{
171+
ClientID: tgr.ClientID,
172+
ClientSecret: "11",
173+
RedirectURI: tgr.RedirectURI,
174+
AccessTokenExp: 0, // requesting token without expiration
175+
Code: code,
176+
}
177+
ati, err := manager.GenerateAccessToken(oauth2.AuthorizationCode, atParams)
178+
So(err, ShouldBeNil)
179+
180+
accessToken := ati.GetAccess()
181+
So(accessToken, ShouldNotBeEmpty)
182+
So(ati.GetAccessExpiresIn(), ShouldEqual, time.Hour*5)
183+
}
184+
185+
func testZeroRefreshExpirationManager(tgr *oauth2.TokenGenerateRequest, manager oauth2.Manager) {
186+
config := manage.Config{
187+
RefreshTokenExp: 0, // Set explicitly as we're testing 0 (no) expiration
188+
IsGenerateRefresh: true,
189+
}
190+
m, ok := manager.(*manage.Manager)
191+
So(ok, ShouldBeTrue)
192+
m.SetAuthorizeCodeTokenCfg(&config)
193+
194+
cti, err := manager.GenerateAuthToken(oauth2.Code, tgr)
195+
So(err, ShouldBeNil)
196+
197+
code := cti.GetCode()
198+
So(code, ShouldNotBeEmpty)
199+
200+
atParams := &oauth2.TokenGenerateRequest{
201+
ClientID: tgr.ClientID,
202+
ClientSecret: "11",
203+
RedirectURI: tgr.RedirectURI,
204+
AccessTokenExp: time.Hour,
205+
Code: code,
206+
}
207+
ati, err := manager.GenerateAccessToken(oauth2.AuthorizationCode, atParams)
208+
So(err, ShouldBeNil)
209+
210+
accessToken, refreshToken := ati.GetAccess(), ati.GetRefresh()
211+
So(accessToken, ShouldNotBeEmpty)
212+
So(refreshToken, ShouldNotBeEmpty)
213+
214+
tokenInfo, err := manager.LoadRefreshToken(refreshToken)
215+
So(err, ShouldBeNil)
216+
So(tokenInfo, ShouldNotBeNil)
217+
So(tokenInfo.GetRefresh(), ShouldEqual, refreshToken)
218+
So(tokenInfo.GetRefreshExpiresIn(), ShouldEqual, 0)
219+
220+
// LoadAccessToken also checks refresh expiry
221+
tokenInfo, err = manager.LoadAccessToken(accessToken)
222+
So(err, ShouldBeNil)
223+
So(tokenInfo, ShouldNotBeNil)
224+
So(tokenInfo.GetRefresh(), ShouldEqual, refreshToken)
225+
So(tokenInfo.GetRefreshExpiresIn(), ShouldEqual, 0)
226+
}

manage/manager.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -464,10 +464,12 @@ func (m *Manager) LoadAccessToken(access string) (info oauth2.TokenInfo, err err
464464
} else if ti == nil || ti.GetAccess() != access {
465465
err = errors.ErrInvalidAccessToken
466466
return
467-
} else if ti.GetRefresh() != "" && ti.GetRefreshCreateAt().Add(ti.GetRefreshExpiresIn()).Before(ct) {
467+
} else if ti.GetRefresh() != "" && ti.GetRefreshExpiresIn() != 0 &&
468+
ti.GetRefreshCreateAt().Add(ti.GetRefreshExpiresIn()).Before(ct) {
468469
err = errors.ErrExpiredRefreshToken
469470
return
470-
} else if ti.GetAccessCreateAt().Add(ti.GetAccessExpiresIn()).Before(ct) {
471+
} else if ti.GetAccessExpiresIn() != 0 &&
472+
ti.GetAccessCreateAt().Add(ti.GetAccessExpiresIn()).Before(ct) {
471473
err = errors.ErrExpiredAccessToken
472474
return
473475
}
@@ -489,7 +491,8 @@ func (m *Manager) LoadRefreshToken(refresh string) (info oauth2.TokenInfo, err e
489491
} else if ti == nil || ti.GetRefresh() != refresh {
490492
err = errors.ErrInvalidRefreshToken
491493
return
492-
} else if ti.GetRefreshCreateAt().Add(ti.GetRefreshExpiresIn()).Before(time.Now()) {
494+
} else if ti.GetRefreshExpiresIn() != 0 && // refresh token set to not expire
495+
ti.GetRefreshCreateAt().Add(ti.GetRefreshExpiresIn()).Before(time.Now()) {
493496
err = errors.ErrExpiredRefreshToken
494497
return
495498
}

store/token.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,23 @@ func (ts *TokenStore) Create(info oauth2.TokenInfo) (err error) {
4747
basicID := uuid.Must(uuid.NewRandom()).String()
4848
aexp := info.GetAccessExpiresIn()
4949
rexp := aexp
50+
expires := true
5051
if refresh := info.GetRefresh(); refresh != "" {
5152
rexp = info.GetRefreshCreateAt().Add(info.GetRefreshExpiresIn()).Sub(ct)
5253
if aexp.Seconds() > rexp.Seconds() {
5354
aexp = rexp
5455
}
55-
_, _, err = tx.Set(refresh, basicID, &buntdb.SetOptions{Expires: true, TTL: rexp})
56+
expires = info.GetRefreshExpiresIn() != 0
57+
_, _, err = tx.Set(refresh, basicID, &buntdb.SetOptions{Expires: expires, TTL: rexp})
5658
if err != nil {
5759
return
5860
}
5961
}
60-
_, _, err = tx.Set(basicID, string(jv), &buntdb.SetOptions{Expires: true, TTL: rexp})
62+
_, _, err = tx.Set(basicID, string(jv), &buntdb.SetOptions{Expires: expires, TTL: rexp})
6163
if err != nil {
6264
return
6365
}
64-
_, _, err = tx.Set(info.GetAccess(), basicID, &buntdb.SetOptions{Expires: true, TTL: aexp})
66+
_, _, err = tx.Set(info.GetAccess(), basicID, &buntdb.SetOptions{Expires: expires, TTL: aexp})
6567
return
6668
})
6769
return

0 commit comments

Comments
 (0)