cli/internal/oauth: don't use naked returns (nakedret)

cli/internal/oauth/jwt.go:62:3: naked return in func `GetClaims` with 9 lines of code (nakedret)
            return
            ^
    cli/internal/oauth/jwt.go:67:2: naked return in func `GetClaims` with 9 lines of code (nakedret)
        return
        ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2025-02-18 09:28:55 +01:00
parent 88a019a9bb
commit e569b9f74a
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C

View File

@ -56,15 +56,19 @@ type Source struct {
}
// GetClaims returns claims from an access token without verification.
func GetClaims(accessToken string) (claims Claims, err error) {
func GetClaims(accessToken string) (Claims, error) {
token, err := parseSigned(accessToken)
if err != nil {
return
return Claims{}, err
}
var claims Claims
err = token.UnsafeClaimsWithoutVerification(&claims)
if err != nil {
return Claims{}, err
}
return
return claims, nil
}
// allowedSignatureAlgorithms is a list of allowed signature algorithms for JWTs.