(jwtToken string)
| 66 | } |
| 67 | |
| 68 | func ExtractNamespaceFromJwt(jwtToken string) (uint64, error) { |
| 69 | claims, err := ParseJWT(jwtToken) |
| 70 | if err != nil { |
| 71 | return 0, errors.Wrap(err, "extracting namespace from JWT") |
| 72 | } |
| 73 | namespace, ok := claims["namespace"].(float64) |
| 74 | if !ok { |
| 75 | return 0, errors.Errorf("namespace in claims is not valid:%v", namespace) |
| 76 | } |
| 77 | return uint64(namespace), nil |
| 78 | } |
| 79 | |
| 80 | func ExtractNamespaceFrom(ctx context.Context) (uint64, error) { |
| 81 | jwtString, err := ExtractJwt(ctx) |
no test coverage detected