[CST-5669] Returns 422 in case of invalid authorization code during ORCID connection

This commit is contained in:
Luca Giamminonni
2022-06-14 16:41:30 +02:00
parent fc323830a0
commit 11b896424c
2 changed files with 2 additions and 2 deletions

View File

@@ -63,7 +63,7 @@ public class ResearcherProfileAddOrcidOperation extends PatchOperation<Researche
} catch (OrcidClientException ex) {
if (ex.isInvalidGrantException()) {
throw new IllegalArgumentException("The provided ORCID authorization code is not valid", ex);
throw new UnprocessableEntityException("The provided ORCID authorization code is not valid", ex);
}
throw ex;

View File

@@ -2288,7 +2288,7 @@ public class ResearcherProfileRestRepositoryIT extends AbstractControllerIntegra
.perform(patch("/api/eperson/profiles/{id}", user.getID().toString())
.content(getPatchContent(asList(new AddOperation("/orcid", code))))
.contentType(MediaType.APPLICATION_JSON_VALUE))
.andExpect(status().isBadRequest());
.andExpect(status().isUnprocessableEntity());
verify(orcidClientMock).getAccessToken(code);
verifyNoMoreInteractions(orcidClientMock);