pub struct BasicAuthZone {
pub zone_prefix: WebRoute,
pub login_path: WebRoute,
pub logout_path: WebRoute,
pub post_auth_redirect: Arc<RedirectTargetConfig>,
pub realm: String,
/* private fields */
}Fields§
§zone_prefix: WebRoute§login_path: WebRoute§logout_path: WebRoute§post_auth_redirect: Arc<RedirectTargetConfig>§realm: StringImplementations§
Source§impl BasicAuthZone
impl BasicAuthZone
pub fn from_isolated_config( config: BasicAuthZoneConfig, ) -> BasicAuthContextResult<Self>
pub fn from_context_config( config: BasicAuthZoneConfig, context: &BasicAuthContext<impl BasicAuthCred + Serialize + for<'a> Deserialize<'a>>, ) -> BasicAuthContextResult<Self>
Sourcepub fn challenge_header_value(&self) -> String
pub fn challenge_header_value(&self) -> String
Returns WWW-Authenticate header value for the configured realm.
Sourcepub fn is_zone_path(&self, request_path: &str) -> bool
pub fn is_zone_path(&self, request_path: &str) -> bool
Returns true when request path is inside configured middleware zone.
pub fn is_login_path(&self, request_path: &str) -> bool
pub fn is_logout_path(&self, request_path: &str) -> bool
Sourcepub fn should_attach_challenge_header(
&self,
request_path: &str,
status: StatusCode,
) -> bool
pub fn should_attach_challenge_header( &self, request_path: &str, status: StatusCode, ) -> bool
Rule for whether a WWW-Authenticate challenge header should be
attached.
Only emit challenge when unauthorized response comes from login_path.
Sourcepub fn login_challenge_protocol_response(&self) -> BasicAuthProtocolResponse
pub fn login_challenge_protocol_response(&self) -> BasicAuthProtocolResponse
Build the challenge response for login trigger route.
pub fn login_challenge_response(&self) -> HttpResponse
Sourcepub fn login_success_response(
&self,
requested_post_auth_redirect_uri: Option<&str>,
) -> Result<HttpResponse, BasicAuthContextError>
pub fn login_success_response( &self, requested_post_auth_redirect_uri: Option<&str>, ) -> Result<HttpResponse, BasicAuthContextError>
Build success redirect response for a successful /basic/login
authentication.
Sourcepub fn logout_poison_protocol_response(&self) -> BasicAuthProtocolResponse
pub fn logout_poison_protocol_response(&self) -> BasicAuthProtocolResponse
Build logout poisoning response.
MUST be 401 without WWW-Authenticate.
pub fn logout_poison_response(&self) -> HttpResponse
Build unauthorized response for generic handler paths.
- for
login_path: 401 with challenge header. - for all other paths: plain 401 without challenge header.
pub fn resolve_post_auth_redirect_uri( &self, requested_post_auth_redirect_uri: Option<&str>, ) -> Result<WebRoute, BasicAuthContextError>
Trait Implementations§
Source§impl Clone for BasicAuthZone
impl Clone for BasicAuthZone
Source§fn clone(&self) -> BasicAuthZone
fn clone(&self) -> BasicAuthZone
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 BasicAuthZone
impl RefUnwindSafe for BasicAuthZone
impl Send for BasicAuthZone
impl Sync for BasicAuthZone
impl Unpin for BasicAuthZone
impl UnsafeUnpin for BasicAuthZone
impl UnwindSafe for BasicAuthZone
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