fix: correct error handling in rp initiated logout

Previously the extractor would return `ExtractorError::Unauthorized` when the issuer
does not provide a end_session_endpoint.
Now it will return a `ExtractorError::RpInitiatedLogoutNotSupported`.
This commit is contained in:
Paul Zinselmeyer 2024-08-30 10:33:07 +02:00
parent 32ecc2041b
commit 202b61fa83
Signed by: pfzetto
GPG key ID: B471A1AF06C895FD
3 changed files with 15 additions and 10 deletions

View file

@ -11,11 +11,12 @@ pub enum ExtractorError {
#[error("unauthorized")]
Unauthorized,
#[error("rp initiated logout information not found")]
RpInitiatedLogoutInformationNotFound,
#[error("rp initiated logout not supported by issuer")]
RpInitiatedLogoutNotSupported,
#[error("could not build rp initiated logout uri")]
FailedToCreateRpInitiatedLogoutUri,
}
#[derive(Debug, Error)]
@ -88,7 +89,7 @@ impl IntoResponse for ExtractorError {
fn into_response(self) -> axum_core::response::Response {
match self {
Self::Unauthorized => (StatusCode::UNAUTHORIZED, "unauthorized").into_response(),
Self::RpInitiatedLogoutInformationNotFound => {
Self::RpInitiatedLogoutNotSupported => {
(StatusCode::INTERNAL_SERVER_ERROR, "intenal server error").into_response()
}
Self::FailedToCreateRpInitiatedLogoutUri => {