pub struct AuthConfigBuilder { /* private fields */ }Expand description
Consuming builder for AuthConfig. The env_prefix MUST be set BEFORE
any env-driven build_* call; builder methods themselves do not read env.
ⓘ
let cfg = AuthConfigBuilder::new()
.env_prefix("SYSLOG_MCP")
.session_cookie_name("syslog_session")
.scopes_supported(vec!["syslog:read".to_string(), "syslog:admin".to_string()])
.resource_path("/mcp")
.default_scope("syslog:read")
.static_token_scopes(vec!["syslog:read".to_string(), "syslog:admin".to_string()])
.disable_static_token_with_oauth(true)
.build_from_sources(std::env::vars())?;Implementations§
Source§impl AuthConfigBuilder
impl AuthConfigBuilder
pub fn new() -> Self
pub fn env_prefix(self, prefix: impl Into<String>) -> Self
pub fn default_data_dir(self, dir: impl Into<PathBuf>) -> Self
pub fn scopes_supported(self, scopes: Vec<String>) -> Self
pub fn resource_path(self, path: impl Into<String>) -> Self
pub fn default_scope(self, scope: impl Into<String>) -> Self
pub fn static_token_scopes(self, scopes: Vec<String>) -> Self
pub fn login_path(self, path: impl Into<String>) -> Self
pub const fn enable_dynamic_registration(self, enabled: bool) -> Self
pub const fn disable_static_token_with_oauth(self, disabled: bool) -> Self
Sourcepub fn build_from_sources(
self,
vars: impl IntoIterator<Item = (String, String)>,
) -> Result<AuthConfig, AuthError>
pub fn build_from_sources( self, vars: impl IntoIterator<Item = (String, String)>, ) -> Result<AuthConfig, AuthError>
Read configuration from the supplied env-style key/value pairs using
the configured env_prefix, then validate and return AuthConfig.
Trait Implementations§
Source§impl Clone for AuthConfigBuilder
impl Clone for AuthConfigBuilder
Source§fn clone(&self) -> AuthConfigBuilder
fn clone(&self) -> AuthConfigBuilder
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AuthConfigBuilder
impl Debug for AuthConfigBuilder
Auto Trait Implementations§
impl Freeze for AuthConfigBuilder
impl RefUnwindSafe for AuthConfigBuilder
impl Send for AuthConfigBuilder
impl Sync for AuthConfigBuilder
impl Unpin for AuthConfigBuilder
impl UnsafeUnpin for AuthConfigBuilder
impl UnwindSafe for AuthConfigBuilder
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