implement fix for #10

fixed #10 by implementing a flag in the response extensions that
instructs the middleware to clear the session. The flag is automatically
set when using the `OidcRpInitiatedLogout` as a responder.

improved documentation

modified example to reflect api changes
This commit is contained in:
Paul Zinselmeyer 2024-04-20 20:35:04 +02:00
parent a7b76ace76
commit ac3e0caa0b
Signed by: pfzetto
GPG key ID: 142847B253911DB0
5 changed files with 76 additions and 34 deletions

View file

@ -1,9 +1,5 @@
use axum::{
error_handling::HandleErrorLayer,
http::Uri,
response::{IntoResponse, Redirect},
routing::get,
Router,
error_handling::HandleErrorLayer, http::Uri, response::IntoResponse, routing::get, Router,
};
use axum_oidc::{
error::MiddlewareError, EmptyAdditionalClaims, OidcAuthLayer, OidcClaims, OidcLoginLayer,
@ -84,9 +80,5 @@ async fn maybe_authenticated(
}
async fn logout(logout: OidcRpInitiatedLogout) -> impl IntoResponse {
let logout_uri = logout
.with_post_logout_redirect(Uri::from_static("https://pfzetto.de"))
.uri()
.unwrap();
Redirect::temporary(&logout_uri.to_string())
logout.with_post_logout_redirect(Uri::from_static("https://pfzetto.de"))
}