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())) {