make oidc check if email verification is required
This commit is contained in:
@@ -2773,20 +2773,22 @@ impl AuthApplicationService {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let provider_name = oidc.provider_name().to_string();
|
let provider_name = oidc.provider_name().to_string();
|
||||||
// Check email_verified - only if email is present in claims
|
// Check email_verified - only if email is present in claims, and email verification is required.
|
||||||
if let Some(email) = &claims.email {
|
if self.require_verified_email() {
|
||||||
let verified = claims.email_verified.unwrap_or(false);
|
if let Some(email) = &claims.email {
|
||||||
if !verified {
|
let verified = claims.email_verified.unwrap_or(false);
|
||||||
tracing::warn!(
|
if !verified {
|
||||||
"OIDC login rejected: email not verified (provider: {}, email: {})",
|
tracing::warn!(
|
||||||
provider_name,
|
"OIDC login rejected: email not verified (provider: {}, email: {})",
|
||||||
email
|
provider_name,
|
||||||
);
|
email
|
||||||
return Err(DomainError::new(
|
);
|
||||||
ErrorKind::AccessDenied,
|
return Err(DomainError::new(
|
||||||
"OIDC",
|
ErrorKind::AccessDenied,
|
||||||
"Email verification required. Please verify your email at the identity provider.",
|
"OIDC",
|
||||||
));
|
"Email verification required. Please verify your email at the identity provider.",
|
||||||
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user