Skip to main content

OAuthRpcHandler

Struct OAuthRpcHandler 

Source
pub struct OAuthRpcHandler { /* private fields */ }
Expand description

Local-control RPC handler for OAuth user management.

Wraps UserService and implements the generated OauthHandler trait for Cap’n Proto serialization. Network transports must not install this handler until they provide independently verified application/session proof.

Implementations§

Source§

impl OAuthRpcHandler

Source

pub fn new( state: Arc<OAuthState>, transport: TransportConfig, signing_key: SigningKey, ) -> Self

Trait Implementations§

Source§

impl OauthHandler for OAuthRpcHandler

Source§

fn authorize<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, ctx: &'life1 EnvelopeContext, resource: &'life2 str, operation: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Authorize an operation on a resource. Override to enforce policy. Read more
Source§

fn handle_register_user<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _ctx: &'life1 EnvelopeContext, _request_id: u64, data: &'life2 RegisterUser, ) -> Pin<Box<dyn Future<Output = Result<OauthResponseVariant>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Handle registerUser request.
Source§

fn handle_get_user<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _ctx: &'life1 EnvelopeContext, _request_id: u64, username: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<OauthResponseVariant>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Handle getUser request.
Source§

fn handle_list_users<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _ctx: &'life1 EnvelopeContext, _request_id: u64, data: &'life2 ListUsers, ) -> Pin<Box<dyn Future<Output = Result<OauthResponseVariant>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Handle listUsers request.
Source§

fn handle_update_user<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _ctx: &'life1 EnvelopeContext, _request_id: u64, data: &'life2 UpdateUser, ) -> Pin<Box<dyn Future<Output = Result<OauthResponseVariant>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Handle updateUser request.
Source§

fn handle_suspend_user<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _ctx: &'life1 EnvelopeContext, _request_id: u64, username: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<OauthResponseVariant>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Handle suspendUser request.
Source§

fn handle_resume_user<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _ctx: &'life1 EnvelopeContext, _request_id: u64, username: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<OauthResponseVariant>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Handle resumeUser request.
Source§

fn handle_remove_user<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _ctx: &'life1 EnvelopeContext, _request_id: u64, username: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<OauthResponseVariant>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Handle removeUser request.
Source§

fn handle_add_pubkey<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _ctx: &'life1 EnvelopeContext, _request_id: u64, data: &'life2 AddPubkey, ) -> Pin<Box<dyn Future<Output = Result<OauthResponseVariant>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Handle addPubkey request.
Source§

fn handle_remove_pubkey<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _ctx: &'life1 EnvelopeContext, _request_id: u64, data: &'life2 RemovePubkey, ) -> Pin<Box<dyn Future<Output = Result<OauthResponseVariant>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Handle removePubkey request.
Source§

fn handle_list_pubkeys<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _ctx: &'life1 EnvelopeContext, _request_id: u64, username: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<OauthResponseVariant>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Handle listPubkeys request.
Source§

fn is_resource_authorized<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, ctx: &'life1 EnvelopeContext, resource: &'life2 str, operation: &'life3 str, ) -> Pin<Box<dyn Future<Output = bool> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Check if a specific resource+operation is authorized (non-failing). Read more
Source§

impl RequestService for OAuthRpcHandler

Source§

fn decode_request_body(&self, signed_body: &[u8]) -> Result<DecodedRequestBody>

Decode the signed request body exactly once (bounded) and derive the full numeric method leaf path (v16 §5.2 step 4). Read more
Source§

fn handle_request<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, ctx: &'life1 EnvelopeContext, body: &'life2 DecodedRequestBody, ) -> Pin<Box<dyn Future<Output = Result<(Vec<u8>, Option<Continuation>)>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Process a request and return a response with optional continuation. Read more
Source§

fn name(&self) -> &str

Service name (for logging and registry).
Source§

fn transport(&self) -> &TransportConfig

Transport configuration (endpoint binding).
Source§

fn signing_key(&self) -> SigningKey

Ed25519 signing key for signing responses.
Source§

fn build_error_payload(&self, request_id: u64, error: &str) -> Vec<u8> ⓘ

Build a generic error response payload for unexpected errors. Read more
Source§

fn producer_reach_config_handle( &self, ) -> Option<Arc<RwLock<RawRwLock, ProducerReachConfig>>>

Mutable reach source filled by the unified service spawner after the service’s QUIC and iroh listeners bind.
Source§

fn moq_origin_handle( &self, ) -> Option<Arc<RwLock<RawRwLock, Option<MoqStreamOrigin>>>>

Optional per-service MoQ origin source. The unified spawner installs a scoped origin here when this service has a relay configured.
Source§

fn pq_signing_key(&self) -> Option<SigningKey<MlDsa65>>

ML-DSA-65 signing key for the post-quantum half of the response COSE composite (#275). Returning None makes process_request fail closed before dispatch; it never selects an EdDSA-only response. The matching ML-DSA-65 public key must be anchored in the client’s PQ trust store for Hybrid verification to succeed (peer attestation). Read more
Source§

fn verifying_key(&self) -> VerifyingKey

Ed25519 verifying key for envelope signature verification.
Source§

fn jwt_key_source(&self) -> Option<Arc<dyn JwtKeySource>>

JWT key source for token verification. Read more
Source§

fn expected_audience(&self) -> Option<&str>

Expected audience (resource URL) for JWT validation. Read more
Source§

fn delegated_user_audience( &self, _signer_pubkey: &[u8; 32], _untrusted_aud: Option<&str>, ) -> Option<&str>

Select an exact, configured audience for an already-admitted delegated user bearer. The unverified claim is only a selector: implementations must return their own configured string, never a borrowed token value. Direct and service credentials always use expected_audience instead.
Source§

fn accept_delegated_resource_leaf( &self, _ctx: &EnvelopeContext, _body: &DecodedRequestBody, ) -> bool

Admit a non-native resource bearer only for a decoded signed request leaf. Default denial preserves every service’s native issuer boundary.
Source§

fn require_cnf_binding(&self) -> bool

Whether to reject JWTs that lack a cnf key binding (jwk or jkt). Read more
Source§

fn credential_revocation_store(&self) -> Option<&dyn CredentialRevocationStore>

Credential revocation store for access token revocation. Read more
Source§

fn jwt_verify_policy(&self) -> CryptoPolicy

Fu4/#677: the minimum JWT alg policy enforced in verify_claims. Read more
Source§

fn resolve_key_subject(&self, signer_pubkey: &[u8; 32]) -> Option<Subject>

Resolve a verified signer key to an authorization subject (#446). Read more
Source§

fn cache_key_binding( &self, _verifying_key: VerifyingKey, _subject: &str, _jwt: &str, _expires_at: i64, )

Cache a verified key→subject binding in the trust store. Read more
Source§

fn accept_delegated_bearer(&self, _signer_pubkey: &[u8; 32]) -> bool

Accept a relayed bearer from this verified envelope signer. Services enabling this must pin an independently configured controller key.
Source§

fn accept_deferred_federate_credential(&self) -> bool

Opt in only when this serving instance has a complete request-local holder-proof, current-primary and durable Policy-use adapter. Default false preserves the generic verifier’s reserved-profile denial.
Source§

fn admit_deferred_federate_request<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, _ctx: &'life1 EnvelopeContext, _body: &'life2 DecodedRequestBody, _proof: &'life3 ParsedProof, ) -> Pin<Box<dyn Future<Output = Result<(VerifiedProof, [u8; 32], String, String, ProofReplayKey, u64), Error>> + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait,

Verify the original holder’s proof and bind it to the exact decoded body/leaf/resource/action before identity publication. This stage must not consume replay state: generated method-policy and MAC authorization still run afterward. Durable Policy admission happens in commit_deferred_federate_request only after those gates pass.
Source§

fn commit_deferred_federate_request<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, _ctx: &'life1 EnvelopeContext, _resource: &'life2 str, _operation: &'life3 str, _replay_key: &'life4 ProofReplayKey, _replay_expiry: u64, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, Self: 'async_trait,

Perform fresh Policy admission and durable replay consumption after the generated method-policy and mandatory MAC gates, immediately before handler dispatch. Implementations must fail closed if the durable admission service is unavailable. The default never admits a request.
Source§

fn verify_internal_work_bearer<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, _ctx: &'life1 EnvelopeContext, _token: &'life2 str, _protected: &'life3 ProtectedHeader, ) -> Pin<Box<dyn Future<Output = Result<InternalWorkClaims, Error>> + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait,

Verify an iw+jwt internal execution work order presented as the direct JWT (single-service Model→Inference boundary, user-approved D5). Read more
Source§

fn verify_claims<'life0, 'life1, 'async_trait>( &'life0 self, ctx: &'life1 mut EnvelopeContext, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

E2E JWT verification with unified key source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Any for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

§

fn type_name(&self) -> &'static str

§

impl<T> AnySync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send> ⓘ

§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
§

impl<T, W> HasTypeWitness<W> for T
where W: MakeTypeWitness<Arg = T>, T: ?Sized,

§

const WITNESS: W = W::MAKE

A constant of the type witness
§

impl<T> Identity for T
where T: ?Sized,

§

const TYPE_EQ: TypeEq<T, <T as Identity>::Type> = TypeEq::NEW

Proof that Self is the same type as Self::Type, provides methods for casting between Self and Self::Type.
§

type Type = T

The same type as Self, used to emulate type equality bounds (T == U) with associated type equality constraints (T: Identity<Type = U>).
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<T> JaggedSlice<T> for T

§

type Index = Index2

§

fn push_into(self, array: &mut Jagged<T>)

§

fn insert_into(self, index: <T as JaggedSlice<T>>::Index, array: &mut Jagged<T>)

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> ServiceExt for T

§

fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>
where Self: Sized,

Apply a transformation to the response body. Read more
§

fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>
where Self: Sized,

High level tracing that classifies responses using HTTP status codes. Read more
§

fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>
where Self: Sized,

High level tracing that classifies responses using gRPC headers. Read more
§

fn follow_redirects(self) -> FollowRedirect<Self>
where Self: Sized,

Follow redirect resposes using the Standard policy. Read more
Source§

impl<S> Spawnable for S
where S: RequestService + Send + Sync,

Source§

fn name(&self) -> &str

Service name (for logging and registry).
Source§

fn registrations(&self) -> Vec<(SocketKind, TransportConfig)>

Endpoints to register with EndpointRegistry. Read more
Source§

fn run( self: Box<S>, shutdown: Arc<Notify>, on_ready: Option<Sender<()>>, ) -> Result<(), RpcError>

Run the service on current thread (blocking). Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSend for T
where T: Send,

§

impl<T> MaybeSend for T
where T: Send,

§

impl<T> MaybeSync for T
where T: Sync,

§

impl<T> MaybeSync for T
where T: Sync,