Improve JWTAuthenticator validation of Issuer,Discovery

This commit is contained in:
Benjamin A. Petersen
2024-03-19 16:48:06 -04:00
parent 0467e5c1d5
commit a45a537cdb
4 changed files with 325 additions and 30 deletions
+21
View File
@@ -0,0 +1,21 @@
// Copyright 2024 the Pinniped contributors. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
package controller
import (
"fmt"
"strings"
)
func TruncateMostLongErr(err error) string {
const max = 300
msg := err.Error()
// always log oidc and x509 errors completely
if len(msg) <= max || strings.Contains(msg, "oidc:") || strings.Contains(msg, "x509:") {
return msg
}
return msg[:max] + fmt.Sprintf(" [truncated %d chars]", len(msg)-max)
}