mirror of
https://github.com/vmware-tanzu/pinniped.git
synced 2026-01-06 13:36:54 +00:00
Enable 'makezero' and 'prealloc' linters, and require 'any' instead of 'interface{}'
Enforce importas: - go.pinniped.dev/generated/latest/apis/supervisor/config/v1alpha1 - go.pinniped.dev/generated/latest/apis/supervisor/idp/v1alpha1
This commit is contained in:
@@ -37,9 +37,9 @@ var validSession = sessionCache{
|
||||
IDToken: &oidctypes.IDToken{
|
||||
Token: "test-id-token",
|
||||
Expiry: metav1.NewTime(time.Date(2020, 10, 20, 19, 42, 07, 0, time.UTC).Local()),
|
||||
Claims: map[string]interface{}{
|
||||
Claims: map[string]any{
|
||||
"foo": "bar",
|
||||
"nested": map[string]interface{}{
|
||||
"nested": map[string]any{
|
||||
"key1": "value1",
|
||||
"key2": "value2",
|
||||
},
|
||||
|
||||
@@ -2629,7 +2629,7 @@ func TestLogin(t *testing.T) { //nolint:gocyclo
|
||||
IDToken: &oidctypes.IDToken{
|
||||
Token: testToken.IDToken.Token,
|
||||
Expiry: testToken.IDToken.Expiry,
|
||||
Claims: map[string]interface{}{"aud": "request-this-test-audience"},
|
||||
Claims: map[string]any{"aud": "request-this-test-audience"},
|
||||
},
|
||||
RefreshToken: testToken.RefreshToken,
|
||||
}}
|
||||
@@ -2659,7 +2659,7 @@ func TestLogin(t *testing.T) { //nolint:gocyclo
|
||||
IDToken: &oidctypes.IDToken{
|
||||
Token: testToken.IDToken.Token,
|
||||
Expiry: testToken.IDToken.Expiry,
|
||||
Claims: map[string]interface{}{"aud": "request-this-test-audience"},
|
||||
Claims: map[string]any{"aud": "request-this-test-audience"},
|
||||
},
|
||||
RefreshToken: testToken.RefreshToken,
|
||||
},
|
||||
@@ -2675,7 +2675,7 @@ func TestLogin(t *testing.T) { //nolint:gocyclo
|
||||
IDToken: &oidctypes.IDToken{
|
||||
Token: testToken.IDToken.Token,
|
||||
Expiry: metav1.NewTime(time.Now().Add(9 * time.Minute)), // less than Now() + minIDTokenValidity
|
||||
Claims: map[string]interface{}{"aud": "test-custom-request-audience"},
|
||||
Claims: map[string]any{"aud": "test-custom-request-audience"},
|
||||
},
|
||||
RefreshToken: testToken.RefreshToken,
|
||||
}}
|
||||
@@ -2691,7 +2691,7 @@ func TestLogin(t *testing.T) { //nolint:gocyclo
|
||||
require.Equal(t, &oidctypes.IDToken{
|
||||
Token: testToken.IDToken.Token,
|
||||
Expiry: metav1.NewTime(fakeUniqueTime),
|
||||
Claims: map[string]interface{}{"aud": "test-custom-request-audience"},
|
||||
Claims: map[string]any{"aud": "test-custom-request-audience"},
|
||||
}, cache.sawPutTokens[0].IDToken)
|
||||
})
|
||||
require.NoError(t, WithClient(buildHTTPClientForPEM(successServerCA))(h))
|
||||
@@ -2707,7 +2707,7 @@ func TestLogin(t *testing.T) { //nolint:gocyclo
|
||||
IDToken: &oidctypes.IDToken{
|
||||
Token: testToken.IDToken.Token,
|
||||
Expiry: metav1.NewTime(fakeUniqueTime), // less than Now() + minIDTokenValidity but does not matter because this is a freshly refreshed ID token
|
||||
Claims: map[string]interface{}{"aud": "test-custom-request-audience"},
|
||||
Claims: map[string]any{"aud": "test-custom-request-audience"},
|
||||
},
|
||||
RefreshToken: testToken.RefreshToken,
|
||||
}, nil)
|
||||
@@ -2732,7 +2732,7 @@ func TestLogin(t *testing.T) { //nolint:gocyclo
|
||||
IDToken: &oidctypes.IDToken{
|
||||
Token: testToken.IDToken.Token,
|
||||
Expiry: metav1.NewTime(fakeUniqueTime),
|
||||
Claims: map[string]interface{}{"aud": "test-custom-request-audience"},
|
||||
Claims: map[string]any{"aud": "test-custom-request-audience"},
|
||||
},
|
||||
RefreshToken: testToken.RefreshToken,
|
||||
},
|
||||
@@ -3452,11 +3452,11 @@ func mockUpstream(t *testing.T) *mockupstreamoidcidentityprovider.MockUpstreamOI
|
||||
// hasAccessTokenMatcher is a gomock.Matcher that expects an *oauth2.Token with a particular access token.
|
||||
type hasAccessTokenMatcher struct{ expected string }
|
||||
|
||||
func (m hasAccessTokenMatcher) Matches(arg interface{}) bool {
|
||||
func (m hasAccessTokenMatcher) Matches(arg any) bool {
|
||||
return arg.(*oauth2.Token).AccessToken == m.expected
|
||||
}
|
||||
|
||||
func (m hasAccessTokenMatcher) Got(got interface{}) string {
|
||||
func (m hasAccessTokenMatcher) Got(got any) string {
|
||||
return got.(*oauth2.Token).AccessToken
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2020-2023 the Pinniped contributors. All Rights Reserved.
|
||||
// Copyright 2020-2024 the Pinniped contributors. All Rights Reserved.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Package oidctypes provides core data types for OIDC token structures.
|
||||
@@ -33,7 +33,7 @@ type IDToken struct {
|
||||
Expiry metav1.Time `json:"expiryTimestamp,omitempty"`
|
||||
|
||||
// Claims are the claims expressed by the Token.
|
||||
Claims map[string]interface{} `json:"claims,omitempty"`
|
||||
Claims map[string]any `json:"claims,omitempty"`
|
||||
}
|
||||
|
||||
// Token contains the elements of an OIDC session.
|
||||
|
||||
Reference in New Issue
Block a user