Skip to main content

OAuthConfig

Struct OAuthConfig 

Source
pub struct OAuthConfig {
Show 32 fields pub host: String, pub port: u16, pub external_url: Option<String>, pub default_scopes: Vec<String>, pub token_ttl_seconds: u32, pub refresh_token_ttl_seconds: u32, pub tls_cert: Option<PathBuf>, pub tls_key: Option<PathBuf>, pub quic_port: Option<u16>, pub deployment_well_known_dir: Option<PathBuf>, pub cors: CorsConfig, pub trusted_issuers: HashMap<String, TrustedIssuerConfig>, pub identity_registration_did_web_origins: Vec<String>, pub mesh_peers: HashMap<String, MeshPeerConfig>, pub authority_hints: Vec<String>, pub oidc_providers: HashMap<String, OidcProviderConfig>, pub user_signing_key: Option<String>, pub client_jwks_uri_cache_ttl_secs: u64, pub jwt_key_active_days: u32, pub jwt_key_lead_days: u32, pub jwt_key_drain_days: u32, pub jwt_key_active_secs: Option<u32>, pub jwt_key_lead_secs: Option<u32>, pub jwt_key_drain_secs: Option<u32>, pub jwt_key_rotation_check_secs: Option<u64>, pub require_pushed_authorization_requests: bool, pub xrpc_read_slice: bool, pub public_git_canary_backend_port: Option<u16>, pub public_git_canary_registry_repo_id: Option<String>, pub public_git_canary_publisher_did: Option<String>, pub atproto_plc_directory_url: String, pub atproto_did_cache_ttl_secs: u64,
}
Expand description

OAuth 2.1 authorization server configuration

Provides OAuth 2.1 (draft-ietf-oauth-v2-1-13) authorization for MCP and OAI services. Supports RFC 7591 (Dynamic Client Registration), RFC 8414 (AS Metadata), RFC 8707 (Resource Indicators), and Client ID Metadata Documents.

Fields§

§host: String

Host address for OAuth server

§port: u16

Port for OAuth server

§external_url: Option<String>

External URL for this server (used in metadata responses). Auto-derived from host:port if not set.

§default_scopes: Vec<String>

Default scopes granted to new clients

§token_ttl_seconds: u32

Access token TTL in seconds

§refresh_token_ttl_seconds: u32

Refresh token TTL in seconds (default: 72 hours)

§tls_cert: Option<PathBuf>

TLS certificate path (optional, overrides global [tls])

§tls_key: Option<PathBuf>

TLS private key path (optional, overrides global [tls])

§quic_port: Option<u16>

QUIC/WebTransport port. None = no QUIC, Some(0) = ephemeral, Some(N) = explicit.

§deployment_well_known_dir: Option<PathBuf>

Deployment static well-known directory (#1137 / #1136 serving half). When set, this OAuth instance terminates the deployment’s did:web host: /.well-known/did.json serves <dir>/did.json (replacing the dynamic node document), /.well-known/at9p/<cid>.cbor serves the cluster at9p capsule, /.well-known/deployment/deployment-authority.log.json serves the current root-anchored authority log, and /.well-known/deployment/registry-service.jwt serves the current registry credential. All are public, integrity-anchored bytes re-read on every request so an external credential-refresh agent needs no restart.

§cors: CorsConfig

CORS configuration for the OAuth HTTP server

§trusted_issuers: HashMap<String, TrustedIssuerConfig>

Trusted external OIDC issuers for federation. Key = issuer URL (must match JWT iss claim exactly). Value = configuration for fetching/caching that issuer’s JWKS.

§identity_registration_did_web_origins: Vec<String>

Exact HTTPS origins permitted for authenticated did:web federation intake through the identity registration API.

This is deliberately separate from CORS, OIDC issuers, and federation policy. Entries must be origins only (no wildcard, path, query, fragment, or userinfo). An empty list disables did:web intake while retaining the fixed-directory did:plc arm.

§mesh_peers: HashMap<String, MeshPeerConfig>

Trusted mesh peers’ post-quantum signing identities (#157). Key = an operator-chosen peer label (informational only). Value = the peer’s Ed25519 mesh signer key + ML-DSA-65 mesh verifying key, supplied inline as out-of-band Multikey strings. Populates the process-global KeyedPqTrustStore eagerly at startup (admin-anchored, immutable). Empty = empty store = unchanged behavior (Hybrid fails closed for unknown peers). Distinct from trusted_issuers.

§authority_hints: Vec<String>

OpenID Federation 1.0 Trust Anchor URLs (optional). When set, included as authority_hints in the entity configuration JWT, making this node discoverable within the named federations. Example: ["https://federation.example.org"]

§oidc_providers: HashMap<String, OidcProviderConfig>

External OIDC providers for login delegation (IdP-agnostic).

Users authenticate with the external provider; hyprstream validates the external id_token and issues its own JWT with scopes from the policy engine. Separate from trusted_issuers which is for hyprstream federation (direct JWT acceptance between nodes).

§user_signing_key: Option<String>

Hex-encoded Ed25519 private key bytes for the local user identity (bypasses OS keyring).

TEST USE ONLY. Set via HYPRSTREAM__OAUTH__USER_SIGNING_KEY env var. Allows the sign-challenge CLI and wizard to use a pre-generated key in isolated test environments without a keyring daemon. Never set this in production config files.

§client_jwks_uri_cache_ttl_secs: u64

How long to cache a third-party OAuth client’s JWKS fetched via jwks_uri (RFC 7591 §2.1). Applies to private_key_jwt client authentication at the token endpoint.

Clients that rotate signing keys faster than this should keep the old key in their JWKS for at least one cache window so verification spans the rotation (standard JWKS rotation hygiene). Default: 3600 seconds (1 hour).

Distinct from trusted_issuers[*].jwks_cache_ttl_secs (which configures hyprstream federation peers, not OAuth clients).

§jwt_key_active_days: u32

How many days a JWT signing key remains in the active (issuance) slot.

§jwt_key_lead_days: u32

How many days before active-key expiry a lead key is pre-generated.

§jwt_key_drain_days: u32

How many extra days after active-key expiry the drain key remains in JWKS for verification.

§jwt_key_active_secs: Option<u32>

Override active key lifetime in seconds (takes precedence over jwt_key_active_days). Intended for integration tests with short rotation cycles.

§jwt_key_lead_secs: Option<u32>

Override lead key pre-generation window in seconds (takes precedence over jwt_key_lead_days).

§jwt_key_drain_secs: Option<u32>

Override drain key retention window in seconds (takes precedence over jwt_key_drain_days).

§jwt_key_rotation_check_secs: Option<u64>

Override rotation check interval in seconds (default: 21600 = 6 hours).

§require_pushed_authorization_requests: bool

Enforce RFC 9126 Pushed Authorization Requests at /oauth/authorize.

When true, the authorization endpoint rejects any request that does not arrive via a request_uri referencing a prior /oauth/par call. Advertised in server metadata as require_pushed_authorization_requests. Defaults to false for compatibility.

§xrpc_read_slice: bool

Enable the com.atproto.* XRPC read slice (/xrpc/…) served from the OAuth HTTP surface (#1112). Defaults to false — the data plane is inert until the operator explicitly opts in and the write path (#910) populates the in-process XrpcRepoStore with public-flagged snapshots. When false, the XRPC routes are not mounted at all.

§public_git_canary_backend_port: Option<u16>

Enable the single, read-only public Git canary proxy on the HTTPS listener. The proxy forwards only the fixed canary.git upload-pack endpoints to this loopback port. The loopback backend must itself be configured with exactly one exported repository and no receive-pack. None leaves the public Git routes unmounted.

§public_git_canary_registry_repo_id: Option<String>

Opt in one Registry-owned ai.hyprstream.model record to the public XRPC getRecord path. This is the canonical Registry UUID; the publisher Every other record remains behind the existing Discovery policy boundary.

§public_git_canary_publisher_did: Option<String>

Exact Registry PdsPublisher DID from the operator-attested canonical mapping. Registry and OAuth have distinct process signing keys, so the OAuth key cannot be used to infer this publisher identity. Both canary fields must be configured together; neither is set by default.

§atproto_plc_directory_url: String

Read-only PLC directory used to resolve ATProto account signing keys.

§atproto_did_cache_ttl_secs: u64

TTL for validated ATProto DID documents.

Implementations§

Source§

impl OAuthConfig

Source

pub fn active_secs(&self) -> i64

Active key lifetime in seconds (_secs override wins over _days * 86400).

Source

pub fn lead_secs(&self) -> i64

Lead pre-generation window in seconds.

Source

pub fn drain_secs(&self) -> i64

Drain retention window in seconds.

Source

pub fn rotation_check_interval(&self) -> Duration

Rotation check interval (default 6 hours).

Source

pub fn issuer_url(&self) -> String

Get the configured issuer URL, preserving an explicit path when set, otherwise deriving it from host:port. Auto-derives https:// when global TLS is enabled.

Trait Implementations§

Source§

impl Clone for OAuthConfig

Source§

fn clone(&self) -> OAuthConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for OAuthConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for OAuthConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for OAuthConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for OAuthConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FromRef<T> for T
where T: Clone,

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

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> NoneValue for T
where T: Default,

§

type NoneType = T

§

fn null_value() -> T

The none-equivalent value.
§

impl<T> NoneValue for T
where T: Default,

§

type NoneType = T

§

fn null_value() -> T

The none-equivalent value.
§

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
Source§

impl<T> Serialize for T
where T: Serialize + ?Sized,

Source§

fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<Ok, Error>

§

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<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

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,

§

impl<E> ResultError for E
where E: Send + Debug + Sync,

§

impl<T> ResultType for T
where T: Send + Clone + Sync + Debug,

§

impl<T> RpcMessage for T
where T: Debug + Serialize + DeserializeOwned + Send + Sync + Unpin + 'static,

§

impl<T> SendSyncUnwindSafe for T
where T: Send + Sync + UnwindSafe + ?Sized,

Source§

impl<T> TerminalState for T
where T: Clone + Send + Sync,