diff --git a/apps/user-ms/src/main/docs/openapi.json b/apps/user-ms/src/main/docs/openapi.json index 15639e4f..0aceba1c 100644 --- a/apps/user-ms/src/main/docs/openapi.json +++ b/apps/user-ms/src/main/docs/openapi.json @@ -49,11 +49,11 @@ } } }, - "401" : { - "description" : "Not Authorized" - }, "403" : { "description" : "Not Allowed" + }, + "401" : { + "description" : "Not Authorized" } }, "security" : [ { @@ -104,11 +104,11 @@ "application/json" : { } } }, - "401" : { - "description" : "Not Authorized" - }, "403" : { "description" : "Not Allowed" + }, + "401" : { + "description" : "Not Authorized" } }, "security" : [ { @@ -184,11 +184,11 @@ } } }, - "401" : { - "description" : "Not Authorized" - }, "403" : { "description" : "Not Allowed" + }, + "401" : { + "description" : "Not Authorized" } }, "security" : [ { @@ -222,11 +222,11 @@ } } }, - "401" : { - "description" : "Not Authorized" - }, "403" : { "description" : "Not Allowed" + }, + "401" : { + "description" : "Not Authorized" } }, "security" : [ { @@ -317,11 +317,11 @@ } } }, - "401" : { - "description" : "Not Authorized" - }, "403" : { "description" : "Not Allowed" + }, + "401" : { + "description" : "Not Authorized" } }, "security" : [ { @@ -351,11 +351,11 @@ } } }, - "401" : { - "description" : "Not Authorized" - }, "403" : { "description" : "Not Allowed" + }, + "401" : { + "description" : "Not Authorized" } }, "security" : [ { @@ -396,11 +396,11 @@ } } }, - "401" : { - "description" : "Not Authorized" - }, "403" : { "description" : "Not Allowed" + }, + "401" : { + "description" : "Not Authorized" } }, "security" : [ { @@ -436,11 +436,11 @@ } } }, - "401" : { - "description" : "Not Authorized" - }, "403" : { "description" : "Not Allowed" + }, + "401" : { + "description" : "Not Authorized" } }, "security" : [ { @@ -486,11 +486,11 @@ } } }, - "401" : { - "description" : "Not Authorized" - }, "403" : { "description" : "Not Allowed" + }, + "401" : { + "description" : "Not Authorized" } }, "security" : [ { @@ -529,11 +529,11 @@ } } }, - "401" : { - "description" : "Not Authorized" - }, "403" : { "description" : "Not Allowed" + }, + "401" : { + "description" : "Not Authorized" } }, "security" : [ { @@ -576,11 +576,11 @@ } } }, - "401" : { - "description" : "Not Authorized" - }, "403" : { "description" : "Not Allowed" + }, + "401" : { + "description" : "Not Authorized" } }, "security" : [ { @@ -623,11 +623,11 @@ } } }, - "401" : { - "description" : "Not Authorized" - }, "403" : { "description" : "Not Allowed" + }, + "401" : { + "description" : "Not Authorized" } }, "security" : [ { @@ -672,11 +672,11 @@ "204" : { "description" : "No Content" }, - "401" : { - "description" : "Not Authorized" - }, "403" : { "description" : "Not Allowed" + }, + "401" : { + "description" : "Not Authorized" } }, "security" : [ { @@ -733,11 +733,11 @@ "application/json" : { } } }, - "401" : { - "description" : "Not Authorized" - }, "403" : { "description" : "Not Allowed" + }, + "401" : { + "description" : "Not Authorized" } }, "security" : [ { @@ -779,11 +779,11 @@ "application/json" : { } } }, - "401" : { - "description" : "Not Authorized" - }, "403" : { "description" : "Not Allowed" + }, + "401" : { + "description" : "Not Authorized" } }, "security" : [ { @@ -819,11 +819,11 @@ "application/json" : { } } }, - "401" : { - "description" : "Not Authorized" - }, "403" : { "description" : "Not Allowed" + }, + "401" : { + "description" : "Not Authorized" } }, "security" : [ { @@ -906,11 +906,11 @@ } } }, - "401" : { - "description" : "Not Authorized" - }, "403" : { "description" : "Not Allowed" + }, + "401" : { + "description" : "Not Authorized" } }, "security" : [ { @@ -956,11 +956,11 @@ } } }, - "401" : { - "description" : "Not Authorized" - }, "403" : { "description" : "Not Allowed" + }, + "401" : { + "description" : "Not Authorized" } }, "security" : [ { @@ -998,11 +998,11 @@ "204" : { "description" : "No Content" }, - "401" : { - "description" : "Not Authorized" - }, "403" : { "description" : "Not Allowed" + }, + "401" : { + "description" : "Not Authorized" } }, "security" : [ { @@ -1181,7 +1181,6 @@ "type" : "object", "properties" : { "fiscalCode" : { - "pattern" : "\\S", "type" : "string" } } diff --git a/apps/user-ms/src/main/docs/openapi.yaml b/apps/user-ms/src/main/docs/openapi.yaml index 2cb7ba11..76fc6170 100644 --- a/apps/user-ms/src/main/docs/openapi.yaml +++ b/apps/user-ms/src/main/docs/openapi.yaml @@ -37,10 +37,10 @@ paths: application/json: schema: type: boolean - "401": - description: Not Authorized "403": description: Not Allowed + "401": + description: Not Authorized security: - SecurityScheme: [] /institutions/{institutionId}/products/{productId}/createdAt: @@ -76,10 +76,10 @@ paths: description: OK content: application/json: {} - "401": - description: Not Authorized "403": description: Not Allowed + "401": + description: Not Authorized security: - SecurityScheme: [] /institutions/{institutionId}/user-institutions: @@ -130,10 +130,10 @@ paths: type: array items: $ref: '#/components/schemas/UserInstitutionResponse' - "401": - description: Not Authorized "403": description: Not Allowed + "401": + description: Not Authorized security: - SecurityScheme: [] /institutions/{institutionId}/users: @@ -156,10 +156,10 @@ paths: type: array items: $ref: '#/components/schemas/UserProductResponse' - "401": - description: Not Authorized "403": description: Not Allowed + "401": + description: Not Authorized security: - SecurityScheme: [] /users: @@ -222,10 +222,10 @@ paths: type: array items: $ref: '#/components/schemas/UserInstitutionResponse' - "401": - description: Not Authorized "403": description: Not Allowed + "401": + description: Not Authorized security: - SecurityScheme: [] post: @@ -245,10 +245,10 @@ paths: application/json: schema: type: string - "401": - description: Not Authorized "403": description: Not Allowed + "401": + description: Not Authorized security: - SecurityScheme: [] /users/emails: @@ -276,10 +276,10 @@ paths: type: array items: type: string - "401": - description: Not Authorized "403": description: Not Allowed + "401": + description: Not Authorized security: - SecurityScheme: [] /users/ids: @@ -303,10 +303,10 @@ paths: type: array items: $ref: '#/components/schemas/UserInstitutionResponse' - "401": - description: Not Authorized "403": description: Not Allowed + "401": + description: Not Authorized security: - SecurityScheme: [] /users/notification: @@ -338,10 +338,10 @@ paths: application/json: schema: $ref: '#/components/schemas/UsersNotificationResponse' - "401": - description: Not Authorized "403": description: Not Allowed + "401": + description: Not Authorized security: - SecurityScheme: [] /users/search: @@ -366,10 +366,10 @@ paths: application/json: schema: $ref: '#/components/schemas/UserDetailResponse' - "401": - description: Not Authorized "403": description: Not Allowed + "401": + description: Not Authorized security: - SecurityScheme: [] /users/{id}: @@ -398,10 +398,10 @@ paths: application/json: schema: $ref: '#/components/schemas/UserResponse' - "401": - description: Not Authorized "403": description: Not Allowed + "401": + description: Not Authorized security: - SecurityScheme: [] /users/{id}/details: @@ -431,10 +431,10 @@ paths: application/json: schema: $ref: '#/components/schemas/UserDetailResponse' - "401": - description: Not Authorized "403": description: Not Allowed + "401": + description: Not Authorized security: - SecurityScheme: [] /users/{id}/institution/{institutionId}/product/{productId}/status: @@ -466,10 +466,10 @@ paths: responses: "204": description: No Content - "401": - description: Not Authorized "403": description: Not Allowed + "401": + description: Not Authorized security: - SecurityScheme: [] /users/{id}/status: @@ -509,10 +509,10 @@ paths: description: OK content: application/json: {} - "401": - description: Not Authorized "403": description: Not Allowed + "401": + description: Not Authorized security: - SecurityScheme: [] /users/{id}/user-registry: @@ -541,10 +541,10 @@ paths: description: OK content: application/json: {} - "401": - description: Not Authorized "403": description: Not Allowed + "401": + description: Not Authorized security: - SecurityScheme: [] /users/{userId}: @@ -569,10 +569,10 @@ paths: description: OK content: application/json: {} - "401": - description: Not Authorized "403": description: Not Allowed + "401": + description: Not Authorized security: - SecurityScheme: [] /users/{userId}/institution/{institutionId}: @@ -633,10 +633,10 @@ paths: type: array items: $ref: '#/components/schemas/UserDataResponse' - "401": - description: Not Authorized "403": description: Not Allowed + "401": + description: Not Authorized security: - SecurityScheme: [] /users/{userId}/institutions: @@ -667,10 +667,10 @@ paths: application/json: schema: $ref: '#/components/schemas/UserInfoResponse' - "401": - description: Not Authorized "403": description: Not Allowed + "401": + description: Not Authorized security: - SecurityScheme: [] /users/{userId}/institutions/{institutionId}/products/{productId}: @@ -697,10 +697,10 @@ paths: responses: "204": description: No Content - "401": - description: Not Authorized "403": description: Not Allowed + "401": + description: Not Authorized security: - SecurityScheme: [] components: @@ -852,7 +852,6 @@ components: type: object properties: fiscalCode: - pattern: \S type: string UpdateUserRequest: type: object diff --git a/apps/user-ms/src/main/java/it/pagopa/selfcare/user/controller/response/product/SearchUserDto.java b/apps/user-ms/src/main/java/it/pagopa/selfcare/user/controller/response/product/SearchUserDto.java index 95a9f8a3..20542974 100644 --- a/apps/user-ms/src/main/java/it/pagopa/selfcare/user/controller/response/product/SearchUserDto.java +++ b/apps/user-ms/src/main/java/it/pagopa/selfcare/user/controller/response/product/SearchUserDto.java @@ -6,12 +6,14 @@ import lombok.NoArgsConstructor; import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Pattern; @AllArgsConstructor @NoArgsConstructor @Getter public class SearchUserDto { @JsonProperty(required = true) - @NotBlank + @NotNull private String fiscalCode; } diff --git a/apps/user-ms/src/main/java/it/pagopa/selfcare/user/util/UserUtils.java b/apps/user-ms/src/main/java/it/pagopa/selfcare/user/util/UserUtils.java index 551c3644..fc01f3e2 100644 --- a/apps/user-ms/src/main/java/it/pagopa/selfcare/user/util/UserUtils.java +++ b/apps/user-ms/src/main/java/it/pagopa/selfcare/user/util/UserUtils.java @@ -24,6 +24,7 @@ import lombok.extern.slf4j.Slf4j; import org.apache.http.HttpStatus; import org.gradle.internal.impldep.org.apache.commons.lang.StringUtils; +import org.jboss.resteasy.reactive.ClientWebApplicationException; import org.jboss.resteasy.reactive.client.api.WebClientApplicationException; import org.openapi.quarkus.user_registry_json.model.CertifiableFieldResourceOfstring; import org.openapi.quarkus.user_registry_json.model.UserResource; @@ -67,7 +68,7 @@ public void checkProductRole(String productId, PartyRole role, String productRol } public static boolean checkIfNotFoundException(Throwable throwable) { - if (throwable instanceof WebClientApplicationException wex) { + if (throwable instanceof ClientWebApplicationException wex) { return wex.getResponse().getStatus() == HttpStatus.SC_NOT_FOUND; } diff --git a/apps/user-ms/src/test/java/it/pagopa/selfcare/user/service/UserServiceTest.java b/apps/user-ms/src/test/java/it/pagopa/selfcare/user/service/UserServiceTest.java index 3d293383..aae769e0 100644 --- a/apps/user-ms/src/test/java/it/pagopa/selfcare/user/service/UserServiceTest.java +++ b/apps/user-ms/src/test/java/it/pagopa/selfcare/user/service/UserServiceTest.java @@ -38,6 +38,7 @@ import org.apache.http.HttpStatus; import org.bson.types.ObjectId; import org.eclipse.microprofile.rest.client.inject.RestClient; +import org.jboss.resteasy.reactive.ClientWebApplicationException; import org.jboss.resteasy.reactive.client.api.WebClientApplicationException; import org.junit.jupiter.api.Test; import org.mockito.Mockito; @@ -226,7 +227,7 @@ void testRetrievePersonFailsWhenPdvFails() { UserInstitution userInstitution = new UserInstitution(); userInstitution.setUserId("test-user"); when(userInstitutionService.retrieveFirstFilteredUserInstitution(any())).thenReturn(Uni.createFrom().item(userInstitution)); - when(userRegistryApi.findByIdUsingGET(any(), any())).thenReturn(Uni.createFrom().failure(new WebClientApplicationException(HttpStatus.SC_NOT_FOUND))); + when(userRegistryApi.findByIdUsingGET(any(), any())).thenReturn(Uni.createFrom().failure(new ClientWebApplicationException(HttpStatus.SC_NOT_FOUND))); UniAssertSubscriber subscriber = userService.retrievePerson("test-user", "test-product", "test-institutionId").subscribe().withSubscriber(UniAssertSubscriber.create());