pub struct RequestContext {
pub sender_tenant: String,
pub sender_identity: String,
pub sender_account: String,
pub sender_session: String,
pub on_behalf_of: String,
pub expected_version: Option<u64>,
pub correlation_id: String,
pub causation_id: String,
pub trace_id: String,
pub bypass_authorization: bool,
pub attributes: BTreeMap<String, String>,
}Expand description
Who sends a request and in which context: signed with the command and stored with every
event it causes; signed with file and cache requests too, for middlewares to check. attributes are business data only, never security decisions.
Set a default for a connection with crate::Options::context, or one per request with
crate::Submit::context, crate::Query::context, crate::Files::context and
crate::Cache::context. Inside a listener’s handler,
submit follow-up commands with ctx.follow() (crate::ListenerContext::follow). All
fields default to empty; set the ones you need:
RequestContext { sender_identity: "customer-7".into(), expected_version: Some(3), ..Default::default() }.
Fields§
§sender_tenant: StringThe tenant the sender belongs to.
sender_identity: StringWho sends the request, e.g. a user or service ID; middlewares check permissions on it.
sender_account: String§sender_session: String§on_behalf_of: StringAuthorize as this identity of the target tenant; the sender stays the real principal.
expected_version: Option<u64>Reject the command (version_mismatch) unless the aggregate is at this version.
correlation_id: StringShared by everything one original request causes; defaults to the command ID.
causation_id: StringThe command that caused this one.
trace_id: StringPrivileged: only keys granted privileged for it may set it.
attributes: BTreeMap<String, String>Trait Implementations§
Source§impl Clone for RequestContext
impl Clone for RequestContext
Source§impl Debug for RequestContext
impl Debug for RequestContext
Source§impl Default for RequestContext
impl Default for RequestContext
impl Eq for RequestContext
Source§impl PartialEq for RequestContext
impl PartialEq for RequestContext
impl StructuralPartialEq for RequestContext
Auto Trait Implementations§
impl Forget for RequestContext
impl Freeze for RequestContext
impl Move for RequestContext
impl RefUnwindSafe for RequestContext
impl Send for RequestContext
impl Sync for RequestContext
impl Unpin for RequestContext
impl UnsafeUnpin for RequestContextwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
*const LeafNode<String, String> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, String)>>: UnsafeUnpin,
impl UnwindSafe for RequestContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request