v0.34.15
This commit is contained in:
1 parent
62b7574553
commit
e364392659
47 files changed
+2164
-257
No files matched your search
@@ -37,7 +37,7 @@ fn should_replace_error_page(response: &Response, minimal_welcome: bool) -> bool
|
||||
.is_none()
|
||||
&& response
|
||||
.extensions()
|
||||
.get::<crate::tinyauth::AuthenticationFailure>()
|
||||
.get::<crate::auth_provider::AuthenticationResponse>()
|
||||
.is_none()
|
||||
}
|
||||
|
||||
@@ -285,7 +285,7 @@ async fn observe(State(state): State<Arc<App>>, mut request: Request, next: Next
|
||||
.is_none()
|
||||
&& response
|
||||
.extensions()
|
||||
.get::<crate::tinyauth::AuthenticationFailure>()
|
||||
.get::<crate::auth_provider::AuthenticationResponse>()
|
||||
.is_none()
|
||||
{
|
||||
apply_response_rules(
|
||||
@@ -385,7 +385,7 @@ async fn observe(State(state): State<Arc<App>>, mut request: Request, next: Next
|
||||
.is_none()
|
||||
&& response
|
||||
.extensions()
|
||||
.get::<crate::tinyauth::AuthenticationFailure>()
|
||||
.get::<crate::auth_provider::AuthenticationResponse>()
|
||||
.is_none()
|
||||
{
|
||||
let outcome = match exchange.cache_status.load(Ordering::Relaxed) {
|
||||
@@ -513,3 +513,21 @@ fn effective_host(request: &Request, tls: bool) -> Result<HeaderValue, ()> {
|
||||
request.headers().get(HOST).cloned().ok_or(())
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod auth_provider_page_interception_tests {
|
||||
use super::*;
|
||||
#[test]
|
||||
fn provider_failures_and_redirects_bypass_custom_http_error_pages() {
|
||||
for kind in [
|
||||
crate::auth_provider::GatewayFailure::Connection,
|
||||
crate::auth_provider::GatewayFailure::Timeout,
|
||||
crate::auth_provider::GatewayFailure::Verification,
|
||||
] {
|
||||
let response = crate::auth_provider::gateway_failure("Future", kind);
|
||||
assert!(!should_replace_error_page(&response, false));
|
||||
}
|
||||
let response = crate::auth_provider::deny(StatusCode::UNAUTHORIZED);
|
||||
assert!(!should_replace_error_page(&response, false));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user