From 81a3446d8ec1e192e1ccba7776be557f52fc22ff Mon Sep 17 00:00:00 2001 From: Camelia Dumitru <62257307+Camelia-Orcid@users.noreply.github.com> Date: Sun, 28 Apr 2024 22:09:45 +0100 Subject: [PATCH] Added the short log for DisabledException (#7028) --- .../org/orcid/api/common/jaxb/OrcidExceptionMapper.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/orcid-api-common/src/main/java/org/orcid/api/common/jaxb/OrcidExceptionMapper.java b/orcid-api-common/src/main/java/org/orcid/api/common/jaxb/OrcidExceptionMapper.java index 8029a6e5263..13e79e8c3ff 100644 --- a/orcid-api-common/src/main/java/org/orcid/api/common/jaxb/OrcidExceptionMapper.java +++ b/orcid-api-common/src/main/java/org/orcid/api/common/jaxb/OrcidExceptionMapper.java @@ -59,6 +59,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.MessageSource; +import org.springframework.security.authentication.DisabledException; import org.springframework.security.core.AuthenticationException; import org.springframework.security.oauth2.common.exceptions.OAuth2Exception; import org.springframework.security.oauth2.common.exceptions.RedirectMismatchException; @@ -116,6 +117,8 @@ public Response toResponse(Throwable t) { logShortError(t, clientId); } else if (t instanceof DeactivatedException) { logShortError(t, clientId); + } else if (t instanceof DisabledException) { + logShortError(t, clientId); } else if (t instanceof ClientDeactivatedException) { logShortError(t, clientId); } else if (t instanceof OrcidNonPublicElementException) { @@ -249,7 +252,11 @@ private Response legacyErrorResponse(Throwable t) { } else if (LockedException.class.isAssignableFrom(t.getClass())) { OrcidMessage entity = getLegacyOrcidEntity("Account locked : ", t); return Response.status(Response.Status.CONFLICT).entity(entity).build(); - } else if (ClientDeactivatedException.class.isAssignableFrom(t.getClass())) { + }else if (DisabledException.class.isAssignableFrom(t.getClass())) { + OrcidMessage entity = getLegacyOrcidEntity("Account not active: ", t); + return Response.status(Response.Status.CONFLICT).entity(entity).build(); + } + else if (ClientDeactivatedException.class.isAssignableFrom(t.getClass())) { OrcidMessage entity = getLegacyOrcidEntity("Client deactivated : ", t); return Response.status(Response.Status.CONFLICT).entity(entity).build(); } else if (NoResultException.class.isAssignableFrom(t.getClass())) {