Skip to content

🎧 Your Personal Streaming Service

refactor(stream): remove dead type branches from getIntClaim (#5594)

Deluan Quintão3b958dd6a725
diff --git a/core/stream/token.go b/core/stream/token.go
index 24a154b54..21a26ca93 100644
--- a/core/stream/token.go
+++ b/core/stream/token.go
@@ -92,17 +92,10 @@ func paramsFromToken(token jwt.Token) (*params, error) {
return &p, nil
}
-// getIntClaim extracts an int claim from a JWT token, handling the case where
-// the value may be stored as int64 or float64 (common in JSON-based JWT libraries).
+// getIntClaim extracts a numeric claim from a JWT token. Numeric claims in a
+// parsed token are always deserialized as float64, regardless of the type used
+// when encoding.
func getIntClaim(token jwt.Token, key string) int {
- var v int
- if err := token.Get(key, &v); err == nil {
- return v
- }
- var v64 int64
- if err := token.Get(key, &v64); err == nil {
- return int(v64)
- }
var f float64
if err := token.Get(key, &f); err == nil {
return int(f)