-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update Citizen Consents structure (#7)
Co-authored-by: DanieleRanaldo <Daniele.Ranaldo@nttdata.com> Co-authored-by: Vitolo-Andrea <andrea.vitolo@emeal.nttdata.com>
- Loading branch information
1 parent
3aed12c
commit 63157c2
Showing
38 changed files
with
2,519 additions
and
194 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
extends: | ||
- "spectral:oas" | ||
- "spectral:asyncapi" | ||
- "https://unpkg.com/@stoplight/spectral-owasp-ruleset/dist/ruleset.mjs" | ||
overrides: | ||
- files: | ||
- "src/main/resources/META-INF/openapi.yaml#/paths/~1token/post/security" | ||
rules: | ||
owasp:api2:2023-write-restricted: "off" | ||
- files: | ||
- "src/main/resources/META-INF/openapi.yaml#/paths/~1.well-known~1jwks.json/get/security" | ||
- "src/main/resources/META-INF/openapi.yaml#/paths/~1.well-known~1openid-configuration/get/security" | ||
rules: | ||
owasp:api2:2023-read-restricted: "off" | ||
- files: | ||
- "src/main/resources/META-INF/openapi.yaml" | ||
rules: | ||
owasp:api3:2023-no-additionalProperties: "off" | ||
owasp:api3:2023-constrained-additionalProperties: "off" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
src/main/java/it/gov/pagopa/onboarding/citizen/connector/tpp/TppConnector.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package it.gov.pagopa.onboarding.citizen.connector.tpp; | ||
|
||
import it.gov.pagopa.onboarding.citizen.dto.TppDTO; | ||
import reactor.core.publisher.Mono; | ||
|
||
public interface TppConnector { | ||
Mono<TppDTO> get(String tppId); | ||
} |
27 changes: 27 additions & 0 deletions
27
src/main/java/it/gov/pagopa/onboarding/citizen/connector/tpp/TppConnectorImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package it.gov.pagopa.onboarding.citizen.connector.tpp; | ||
|
||
import it.gov.pagopa.onboarding.citizen.dto.TppDTO; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.core.ParameterizedTypeReference; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.web.reactive.function.client.WebClient; | ||
import reactor.core.publisher.Mono; | ||
|
||
@Service | ||
public class TppConnectorImpl implements TppConnector { | ||
private final WebClient webClient; | ||
|
||
public TppConnectorImpl(WebClient.Builder webClientBuilder, | ||
@Value("${rest-client.tpp.baseUrl}") String baseUrl) { | ||
this.webClient = webClientBuilder.baseUrl(baseUrl).build(); | ||
} | ||
|
||
@Override | ||
public Mono<TppDTO> get(String tppId) { | ||
return webClient.get() | ||
.uri("/emd/tpp/" + tppId) | ||
.retrieve() | ||
.bodyToMono(new ParameterizedTypeReference<>() { | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 19 additions & 5 deletions
24
src/main/java/it/gov/pagopa/onboarding/citizen/dto/CitizenConsentDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,36 @@ | ||
package it.gov.pagopa.onboarding.citizen.dto; | ||
|
||
import com.fasterxml.jackson.annotation.JsonAlias; | ||
import jakarta.validation.constraints.NotBlank; | ||
import jakarta.validation.constraints.Pattern; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import lombok.experimental.SuperBuilder; | ||
|
||
import java.time.LocalDateTime; | ||
import java.util.Map; | ||
|
||
import static it.gov.pagopa.onboarding.citizen.constants.CitizenConstants.ValidationRegex.FISCAL_CODE_STRUCTURE_REGEX; | ||
|
||
@Data | ||
@SuperBuilder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class CitizenConsentDTO { | ||
@JsonAlias("fiscalCode") | ||
private String hashedFiscalCode; | ||
private String tppId; | ||
private Boolean tppState; | ||
private LocalDateTime creationDate; | ||
private LocalDateTime lastUpdateDate; | ||
@NotBlank(message = "Fiscal Code must not be blank") | ||
@Pattern(regexp = FISCAL_CODE_STRUCTURE_REGEX, | ||
message = "Fiscal Code must be 11 digits or up to 16 alphanumeric characters") | ||
private String fiscalCode; | ||
private Map<String, ConsentDTO> consents; | ||
|
||
@Data | ||
@SuperBuilder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public static class ConsentDTO { | ||
private Boolean tppState; | ||
private LocalDateTime tcDate; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/main/java/it/gov/pagopa/onboarding/citizen/dto/CitizenConsentStateUpdateDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package it.gov.pagopa.onboarding.citizen.dto; | ||
|
||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import lombok.AllArgsConstructor; | ||
import lombok.experimental.SuperBuilder; | ||
|
||
@Data | ||
@SuperBuilder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class CitizenConsentStateUpdateDTO { | ||
private String fiscalCode; | ||
private String tppId; | ||
private Boolean tppState; | ||
} |
15 changes: 15 additions & 0 deletions
15
src/main/java/it/gov/pagopa/onboarding/citizen/dto/Contact.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package it.gov.pagopa.onboarding.citizen.dto; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Data | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class Contact { | ||
|
||
private String name; | ||
private String number; | ||
private String email; | ||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/it/gov/pagopa/onboarding/citizen/dto/TppDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package it.gov.pagopa.onboarding.citizen.dto; | ||
|
||
|
||
import it.gov.pagopa.onboarding.citizen.enums.AuthenticationType; | ||
import jakarta.validation.constraints.NotNull; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import lombok.experimental.SuperBuilder; | ||
|
||
@Data | ||
@SuperBuilder | ||
@NoArgsConstructor | ||
public class TppDTO { | ||
@NotNull | ||
private String tppId; | ||
private String entityId; | ||
private String businessName; | ||
private String messageUrl; | ||
private String authenticationUrl; | ||
private AuthenticationType authenticationType; | ||
private Contact contact; | ||
private Boolean state; | ||
|
||
|
||
|
||
} |
Oops, something went wrong.