mirror of
https://codeberg.org/pfzetto/axum-oidc
synced 2025-12-09 22:55:17 +01:00
add UserInfoClaims, add untrusted_audiences, add tracing
This commit is contained in:
parent
6280ad62cc
commit
094e9e5ff6
9 changed files with 210 additions and 43 deletions
25
src/error.rs
25
src/error.rs
|
|
@ -41,6 +41,14 @@ pub enum MiddlewareError {
|
|||
#[error("claims verification: {0:?}")]
|
||||
ClaimsVerification(#[from] openidconnect::ClaimsVerificationError),
|
||||
|
||||
#[error("user info retrieval: {0:?}")]
|
||||
UserInfoRetrieval(
|
||||
#[from]
|
||||
openidconnect::UserInfoError<
|
||||
openidconnect::HttpClientError<openidconnect::reqwest::Error>,
|
||||
>,
|
||||
),
|
||||
|
||||
#[error("url parsing: {0:?}")]
|
||||
UrlParsing(#[from] openidconnect::url::ParseError),
|
||||
|
||||
|
|
@ -77,7 +85,7 @@ pub enum MiddlewareError {
|
|||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum HandlerError {
|
||||
#[error("the redirect handler got accessed without a valid session")]
|
||||
#[error("redirect handler accessed without valid session, session cookie missing?")]
|
||||
RedirectedWithoutSession,
|
||||
|
||||
#[error("csrf token invalid")]
|
||||
|
|
@ -156,24 +164,21 @@ impl IntoResponse for ExtractorError {
|
|||
|
||||
impl IntoResponse for Error {
|
||||
fn into_response(self) -> axum_core::response::Response {
|
||||
match self {
|
||||
_ => (StatusCode::INTERNAL_SERVER_ERROR, "internal server error").into_response(),
|
||||
}
|
||||
tracing::error!(error = self.to_string());
|
||||
(StatusCode::INTERNAL_SERVER_ERROR, "internal server error").into_response()
|
||||
}
|
||||
}
|
||||
|
||||
impl IntoResponse for MiddlewareError {
|
||||
fn into_response(self) -> axum_core::response::Response {
|
||||
match self {
|
||||
_ => (StatusCode::INTERNAL_SERVER_ERROR, "internal server error").into_response(),
|
||||
}
|
||||
tracing::error!(error = self.to_string());
|
||||
(StatusCode::INTERNAL_SERVER_ERROR, "internal server error").into_response()
|
||||
}
|
||||
}
|
||||
|
||||
impl IntoResponse for HandlerError {
|
||||
fn into_response(self) -> axum_core::response::Response {
|
||||
match self {
|
||||
_ => (StatusCode::INTERNAL_SERVER_ERROR, "internal server error").into_response(),
|
||||
}
|
||||
tracing::error!(error = self.to_string());
|
||||
(StatusCode::INTERNAL_SERVER_ERROR, "internal server error").into_response()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue