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

@ -155,11 +155,14 @@ where
type Rejection = ExtractorError;
async fn from_request_parts(parts: &mut Parts, _: &S) -> Result<Self, Self::Rejection> {
parts
match parts
.extensions
.get::<Self>()
.get::<Option<Self>>()
.cloned()
.ok_or(ExtractorError::Unauthorized)
.ok_or(ExtractorError::Unauthorized)?{
Some(this) => Ok(this),
None => Err(ExtractorError::RpInitiatedLogoutNotSupported),
}
}
}