pub struct RequestContext {
pub user_id: String,
pub scopes: Vec<String>,
pub metadata: HashMap<String, String>,
}Expand description
Identity and authorization context extracted from an HTTP request.
This struct carries authenticated identity fields (user_id, scopes, metadata)
that flow from the server’s auth middleware into the agent invocation context.
It lives in adk-core so that both adk-server (which produces it) and
adk-runner (which consumes it) can reference it without circular dependencies.
§Example
use adk_core::RequestContext;
let ctx = RequestContext {
user_id: "user-123".to_string(),
scopes: vec!["read".to_string(), "write".to_string()],
metadata: [("tenant".to_string(), "acme".to_string())].into(),
};
assert_eq!(ctx.user_id, "user-123");
assert_eq!(ctx.scopes.len(), 2);Fields§
§user_id: StringAuthenticated user ID (e.g. from JWT sub or email claim).
scopes: Vec<String>Granted scopes (e.g. from JWT scope or scp claim).
metadata: HashMap<String, String>Additional metadata for custom middleware use.
Trait Implementations§
Source§impl Clone for RequestContext
impl Clone for RequestContext
Source§fn clone(&self) -> RequestContext
fn clone(&self) -> RequestContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for RequestContext
impl RefUnwindSafe for RequestContext
impl Send for RequestContext
impl Sync for RequestContext
impl Unpin for RequestContext
impl UnsafeUnpin for RequestContext
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
Mutably borrows from an owned value. Read more