all: modernize code (#868)

Use `go fix ./...` to modernize the code.
This commit is contained in:
Oleksandr Redko 2026-03-31 11:58:02 +03:00 • committed by GitHub
commit a1f808c86e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 44 additions and 69 deletions

View file

@ -36,7 +36,7 @@ func TestNewEnterpriseHandler_Validation(t *testing.T) {
AccessToken: "mock_access_token",
TokenType: "Bearer",
}
return token.WithExtra(map[string]interface{}{"id_token": "mock_id_token"}), nil
return token.WithExtra(map[string]any{"id_token": "mock_id_token"}), nil
},
}
@ -194,7 +194,7 @@ func TestNewEnterpriseHandler_Validation(t *testing.T) {
AccessToken: "mock_access_token",
TokenType: "Bearer",
}
return token.WithExtra(map[string]interface{}{"id_token": "mock_id_token"}), nil
return token.WithExtra(map[string]any{"id_token": "mock_id_token"}), nil
},
},
wantError: "",
@ -254,7 +254,7 @@ func TestEnterpriseHandler_Authorize_E2E(t *testing.T) {
AccessToken: "mock_access_token",
TokenType: "Bearer",
}
return token.WithExtra(map[string]interface{}{"id_token": "mock_id_token_from_user_login"}), nil
return token.WithExtra(map[string]any{"id_token": "mock_id_token_from_user_login"}), nil
},
})
if err != nil {
@ -305,7 +305,7 @@ func setupIdPServer(t *testing.T) *httptest.Server {
// OAuth/OIDC metadata endpoint - uses closure to get server URL
mux.HandleFunc("/.well-known/oauth-authorization-server", func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(map[string]interface{}{
json.NewEncoder(w).Encode(map[string]any{
"issuer": server.URL,
"token_endpoint": server.URL + "/token",
"authorization_endpoint": server.URL + "/authorize",
@ -350,7 +350,7 @@ func setupIdPServer(t *testing.T) *httptest.Server {
// Return ID-JAG (Identity Assertion JWT Authorization Grant)
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(map[string]interface{}{
json.NewEncoder(w).Encode(map[string]any{
"access_token": "id-jag-token-from-idp",
"issued_token_type": oauthex.TokenTypeIDJAG,
"token_type": "N_A",
@ -375,7 +375,7 @@ func setupMCPAuthServer(t *testing.T) *httptest.Server {
// OAuth metadata endpoint - uses closure to get server URL
mux.HandleFunc("/.well-known/oauth-authorization-server", func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(map[string]interface{}{
json.NewEncoder(w).Encode(map[string]any{
"issuer": server.URL,
"token_endpoint": server.URL + "/token",
"code_challenge_methods_supported": []string{"S256"},
@ -412,7 +412,7 @@ func setupMCPAuthServer(t *testing.T) *httptest.Server {
// Return access token
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(map[string]interface{}{
json.NewEncoder(w).Encode(map[string]any{
"access_token": "mcp_access_token_from_jwt_bearer",
"token_type": "Bearer",
"expires_in": 3600,
@ -480,7 +480,7 @@ func TestEnterpriseHandler_TokenSource_BeforeAuthorization(t *testing.T) {
AccessToken: "mock_access_token",
TokenType: "Bearer",
}
return token.WithExtra(map[string]interface{}{"id_token": "mock_id_token"}), nil
return token.WithExtra(map[string]any{"id_token": "mock_id_token"}), nil
},
})
if err != nil {

View file

@ -327,7 +327,7 @@ func createMockOIDCServer(t *testing.T) *httptest.Server {
// Handle OIDC discovery
if r.URL.Path == "/.well-known/openid-configuration" {
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(map[string]interface{}{
json.NewEncoder(w).Encode(map[string]any{
"issuer": serverURL,
"authorization_endpoint": serverURL + "/authorize",
"token_endpoint": serverURL + "/token",
@ -351,7 +351,7 @@ func createMockOIDCServerWithToken(t *testing.T) *httptest.Server {
// Handle OIDC discovery
if r.URL.Path == "/.well-known/openid-configuration" {
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(map[string]interface{}{
json.NewEncoder(w).Encode(map[string]any{
"issuer": serverURL,
"authorization_endpoint": serverURL + "/authorize",
"token_endpoint": serverURL + "/token",
@ -376,7 +376,7 @@ func createMockOIDCServerWithToken(t *testing.T) *httptest.Server {
// Create mock ID token (JWT)
now := time.Now().Unix()
idToken := fmt.Sprintf("eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.%s.mock-signature",
base64EncodeClaims(map[string]interface{}{
base64EncodeClaims(map[string]any{
"iss": serverURL,
"sub": "test-user",
"aud": "test-client",
@ -386,7 +386,7 @@ func createMockOIDCServerWithToken(t *testing.T) *httptest.Server {
}))
// Return token response
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(map[string]interface{}{
json.NewEncoder(w).Encode(map[string]any{
"access_token": "mock-access-token",
"token_type": "Bearer",
"expires_in": 3600,
@ -402,7 +402,7 @@ func createMockOIDCServerWithToken(t *testing.T) *httptest.Server {
}
// base64EncodeClaims encodes JWT claims for testing.
func base64EncodeClaims(claims map[string]interface{}) string {
func base64EncodeClaims(claims map[string]any) string {
claimsJSON, _ := json.Marshal(claims)
return base64.RawURLEncoding.EncodeToString(claimsJSON)
}