pub struct Oidc {
pub native_auth: bool,
pub browser_session_ttl: u64,
pub require_device_scope: bool,
pub require_pkce: bool,
pub strict_scope: bool,
pub registration_access_token: String,
pub registration_allowed_redirect_hosts: Vec<String>,
pub require_client_approval: bool,
pub registration_require_client_uri: bool,
pub rc_per_second: u32,
pub rc_burst_count: u32,
}Expand description
Built-in OIDC server (next-generation login)
Provides a built-in OAuth 2.0 and OpenID Connect authorization server
for clients using next-generation Matrix authentication (MSC2965). It
runs only when well_known.client is set (it becomes the issuer URL)
and at least one [[global.identity_provider]] exists or native_auth
is true; otherwise these keys have no effect. Without native_auth,
sign-in goes through the default identity provider; with it, a login
page offers local accounts alongside the providers.
Minimal example (local accounts):
[global.well_known]
client = "https://matrix.example.com"
[global.authentication.oidc]
native_auth = trueTips:
- Whether the OIDC server runs is decided at startup: enabling it on a running server takes a restart.
- Startup warns when
registration_access_tokenis set (no Matrix client sends one), whenrequire_client_approvalis false, and whennative_authhas neither password login nor a provider to offer. - The endpoint throttle needs both
rc_per_secondandrc_burst_countabove zero; password checks on the built-in login page count against[global.rate_limiting.login]instead.
Fields§
§native_auth: boolEnables native registration and login on the built-in OIDC provider.
This authenticates next-generation Matrix clients against local
accounts without a third-party identity_provider; when false, as by
default, the provider only brokers authentication through a configured
upstream provider. When true, requests selecting no provider receive a
login or registration page and require well_known.client; the login
page offers local accounts and configured providers, with one SSO entry
under authentication.login.single_sso or
authentication.login.sso_custom_providers_page. An explicit idp_id
goes directly to its provider. Registration honors
registration.enable, the registration token, and root
registration_terms exactly as client registration does.
reloadable: yes default: false legacy: oidc_native_auth
browser_session_ttl: u64Sets how long a browser stays signed in after a password sign-in on the built-in login page, in seconds.
While it lasts, approving a new device from that browser, as in QR code login, goes straight to the approval page without asking for the password again. The lifetime counts from the sign-in and is not extended by use; a lowered value applies to existing sign-ins at once, a value above 7776000 (90 days) counts as 90 days, and 0 turns browser sign-in off. Changing the password, deactivating the account or signing out of all devices ends it early.
reloadable: yes default: 2592000
require_device_scope: boolRequires OIDC clients to request an MSC2967 device scope.
When false, clients omitting urn:matrix:client:device:<id> receive a
server-generated device ID echoed in the granted scope. When true,
authorization-code grants without a device scope are rejected,
following the proposal’s expectation that clients own their device IDs.
reloadable: yes default: false legacy: oidc_require_device_scope
require_pkce: boolRequires RFC 7636 PKCE with S256 on OIDC authorization-code grants.
When true, the authorize endpoint rejects requests without
code_challenge, as
MSC2964
mandates for public clients. A supplied challenge must always use S256,
and plain is rejected regardless of this setting. Disable only
temporarily for a legacy client unable to send a challenge.
reloadable: yes default: true legacy: oidc_require_pkce
strict_scope: boolRejects OIDC authorization-code grants containing unrecognized scopes instead of narrowing the grant.
When false, as by default, unknown scope tokens are dropped and the
narrowed scope is echoed to the client under RFC
6749; when true, an unknown
scope is rejected. openid and both spellings of the
MSC2967
device and API scopes are always recognized.
reloadable: yes default: false legacy: oidc_strict_scope
registration_access_token: StringRequires an initial access token for dynamic OIDC client registration under RFC 7591.
When set, callers must supply it as an Authorization: Bearer
credential; clients that omit it cannot dynamically register for
next-generation login. Leave empty unless every OAuth client is
registered out of band.
display: sensitive reloadable: yes default: legacy: oidc_registration_access_token
registration_allowed_redirect_hosts: Vec<String>Lists permitted hosts and private-use schemes for dynamically registered OIDC redirect URIs.
When nonempty, every redirect URI must match or registration is
rejected: hosts match case-insensitively, while hostless private-use
URIs such as io.element.android:/ match their scheme under RFC
8252. For example,
["element.io", "io.element.android"] covers web and mobile clients.
The empty default imposes no registration restriction and vouches for
no client, so every sign-in remains subject to
authentication.oidc.require_client_approval. Listing an entry vouches
for any responding client: a scheme covers any device app claiming it
under RFC 8252 section
8.6, and a host
covers every path.
reloadable: yes default: [] legacy: oidc_registration_allowed_redirect_hosts
require_client_approval: boolAsks users to approve unvetted OIDC clients before issuing authorization codes.
Dynamic registration is open by default, so anyone can register a
controlled redirect target and send users an authorization link;
without confirmation, one click gives that client an account
authorization code. When true, as by default, unvetted sign-ins first
show an approve/deny page naming the client. A host or private-use
scheme listed in
authentication.oidc.registration_allowed_redirect_hosts vets its
client and restores prompt-free sign-in. When showing this prompt,
allow enough authentication.login.token_ttl for users to read it.
reloadable: yes default: true legacy: oidc_require_client_approval
registration_require_client_uri: boolRequires client_uri in dynamic registration under RFC
7591 and
MSC2966.
When false, as by default, it is optional; any supplied URI still
requires HTTPS, a host, and no userinfo, and other request URLs must
share that host or a subdomain. When true, registrations lacking an
HTTPS client_uri fail with invalid_client_metadata, enforcing the
common-base model for every client.
reloadable: yes default: false legacy: oidc_registration_require_client_uri
rc_per_second: u32Sets the per-client-IP token-bucket refill rate for OIDC endpoints in requests per second.
The throttle is shared across authorize, token, dynamic-registration,
and device-grant endpoints. The default 0 disables it and preserves
open access; raise this with authentication.oidc.rc_burst_count to
protect an exposed server. Because the key is client IP, rates that
limit brute force can also affect many users behind one NAT, so size
the burst accordingly.
reloadable: yes default: 0 legacy: oidc_rc_per_second
rc_burst_count: u32Sets the token-bucket depth for the OIDC endpoint throttle.
This is the requests one client IP can make in a burst before
authentication.oidc.rc_per_second governs replenishment. It is
ignored when that refill rate is 0.
reloadable: yes default: 0 legacy: oidc_rc_burst_count
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Oidc
impl<'de> Deserialize<'de> for Oidc
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Oidc
impl RefUnwindSafe for Oidc
impl Send for Oidc
impl Sync for Oidc
impl Unpin for Oidc
impl UnsafeUnpin for Oidc
impl UnwindSafe for Oidc
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> ExpectInto for T
impl<T> ExpectInto for T
Source§impl<T> Expected for T
impl<T> Expected for T
Source§fn expected_add(self, rhs: Self) -> Selfwhere
Self: CheckedAdd + Sized,
fn expected_add(self, rhs: Self) -> Selfwhere
Self: CheckedAdd + Sized,
rhs with an expectation that the operation is valid. Read moreSource§fn expected_sub(self, rhs: Self) -> Selfwhere
Self: CheckedSub + Sized,
fn expected_sub(self, rhs: Self) -> Selfwhere
Self: CheckedSub + Sized,
rhs with an expectation that the operation is valid. Read moreSource§fn expected_mul(self, rhs: Self) -> Selfwhere
Self: CheckedMul + Sized,
fn expected_mul(self, rhs: Self) -> Selfwhere
Self: CheckedMul + Sized,
rhs with an expectation that the operation is valid. Read moreSource§fn expected_div(self, rhs: Self) -> Selfwhere
Self: CheckedDiv + Sized,
fn expected_div(self, rhs: Self) -> Selfwhere
Self: CheckedDiv + Sized,
rhs with an expectation that the operation is valid. Read moreSource§fn expected_rem(self, rhs: Self) -> Selfwhere
Self: CheckedRem + Sized,
fn expected_rem(self, rhs: Self) -> Selfwhere
Self: CheckedRem + Sized,
§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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 moreimpl<T> JsonCastable<CanonicalJsonValue> for T
impl<T> JsonCastable<Value> for T
§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling [Attribute] value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi [Quirk] value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the [Condition] value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ServiceExt for T
impl<T> ServiceExt for T
§fn add_extension<T>(self, value: T) -> AddExtension<Self, T>where
Self: Sized,
fn add_extension<T>(self, value: T) -> AddExtension<Self, T>where
Self: Sized,
§fn compression(self) -> Compression<Self>where
Self: Sized,
fn compression(self) -> Compression<Self>where
Self: Sized,
§fn decompression(self) -> Decompression<Self>where
Self: Sized,
fn decompression(self) -> Decompression<Self>where
Self: Sized,
§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
§fn follow_redirects(self) -> FollowRedirect<Self>where
Self: Sized,
fn follow_redirects(self) -> FollowRedirect<Self>where
Self: Sized,
§fn sensitive_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveRequestHeaders<SetSensitiveResponseHeaders<Self>>where
Self: Sized,
fn sensitive_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveRequestHeaders<SetSensitiveResponseHeaders<Self>>where
Self: Sized,
§fn sensitive_request_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveRequestHeaders<Self>where
Self: Sized,
fn sensitive_request_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveRequestHeaders<Self>where
Self: Sized,
§fn sensitive_response_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveResponseHeaders<Self>where
Self: Sized,
fn sensitive_response_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveResponseHeaders<Self>where
Self: Sized,
§fn override_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
fn override_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
§fn append_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
fn append_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
§fn insert_request_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
fn insert_request_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
§fn override_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
fn override_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
§fn append_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
fn append_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
§fn insert_response_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
fn insert_response_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
§fn catch_panic(self) -> CatchPanic<Self, DefaultResponseForPanic>where
Self: Sized,
fn catch_panic(self) -> CatchPanic<Self, DefaultResponseForPanic>where
Self: Sized,
500 Internal Server responses. Read moreSource§impl<T> Tried for T
impl<T> Tried for T
Source§fn try_add(self, rhs: Self) -> Result<Self>where
Self: CheckedAdd + Sized,
fn try_add(self, rhs: Self) -> Result<Self>where
Self: CheckedAdd + Sized,
rhs with checked arithmetic. Read moreSource§fn try_sub(self, rhs: Self) -> Result<Self>where
Self: CheckedSub + Sized,
fn try_sub(self, rhs: Self) -> Result<Self>where
Self: CheckedSub + Sized,
rhs with checked arithmetic. Read moreSource§fn try_mul(self, rhs: Self) -> Result<Self>where
Self: CheckedMul + Sized,
fn try_mul(self, rhs: Self) -> Result<Self>where
Self: CheckedMul + Sized,
rhs with checked arithmetic. Read more