Skip to content

Commit 4734c57

Browse files
stonith404rhafer
authored andcommitted
fix(proxy): honor access token cache ttl
1 parent fcde957 commit 4734c57

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

services/proxy/pkg/middleware/oidc_auth.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ func NewOIDCAuthenticator(opts ...Option) *OIDCAuthenticator {
3434
userInfoCache: options.UserInfoCache,
3535
HTTPClient: options.HTTPClient,
3636
OIDCIss: options.OIDCIss,
37+
DefaultTokenCacheTTL: options.DefaultAccessTokenTTL,
3738
oidcClient: options.OIDCClient,
3839
AccessTokenVerifyMethod: options.AccessTokenVerifyMethod,
3940
skipUserInfo: options.SkipUserInfo,

services/proxy/pkg/middleware/oidc_auth_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,14 @@ var _ = Describe("Authenticating requests", Label("OIDCAuthenticator"), func() {
5353
}
5454
})
5555

56+
It("should apply the default access token ttl option", func() {
57+
ttl := 5 * time.Minute
58+
59+
authenticator := NewOIDCAuthenticator(DefaultAccessTokenTTL(ttl))
60+
61+
Expect(authenticator.DefaultTokenCacheTTL).To(Equal(ttl))
62+
})
63+
5664
When("the request contains correct data", func() {
5765
It("should successfully authenticate", func() {
5866
req := httptest.NewRequest(http.MethodGet, "http://example.com/example/path", http.NoBody)

0 commit comments

Comments
 (0)