NM-258: add host claim verfication to token validation

This commit is contained in:
abhishek9686
2026-03-03 01:12:29 +04:00
parent 5617d97ce6
commit c344f54ce1
+6
View File
@@ -262,6 +262,12 @@ func VerifyHostToken(tokenString string) (hostID string, mac string, network str
})
if token != nil && token.Valid {
if !strings.HasPrefix(claims.Subject, "node|") {
return "", "", "", errors.New("not a host token")
}
if claims.ID == "" {
return "", "", "", errors.New("invalid host token: missing host ID")
}
return claims.ID, claims.MacAddress, claims.Network, nil
}
return "", "", "", err