Authorized returns whether the context has been identified as a cluster call. It panics if it does not inherit from `NewContext`.
(ctx context.Context)
| 79 | // Authorized returns whether the context has been identified as a cluster call. |
| 80 | // It panics if it does not inherit from `NewContext`. |
| 81 | func Authorized(ctx context.Context) error { |
| 82 | ok, isStored := ctx.Value(clusterAuthKey).(bool) |
| 83 | if !isStored { |
| 84 | panic("call source not verified; did you register the cluster authentication hook for this call?") |
| 85 | } |
| 86 | if ok { |
| 87 | return nil |
| 88 | } |
| 89 | return ctx.Value(clusterAuthFailureKey).(error) |
| 90 | } |