Skip to content

Commit

Permalink
[SELC-5508] feat: implement Namirial option in onboarding functions (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
giulia-tremolada authored Sep 26, 2024
1 parent 06f4e97 commit 819da61
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public class OnboardingFunctionConfig {

private static final Logger log = LoggerFactory.getLogger(OnboardingFunctionConfig.class);
public static final String SIGNATURE_SOURCE_ARUBA = "aruba";
public static final String SIGNATURE_SOURCE_NAMIRIAL = "namirial";
public static final String SIGNATURE_SOURCE_DISABLED = "disabled";

void onStart(@Observes StartupEvent ev, OnboardingRepository repository) {
Expand Down Expand Up @@ -62,6 +63,12 @@ public Pkcs7HashSignService arubaPkcs7HashSignService(){
return new ArubaPkcs7HashSignServiceImpl(new ArubaSignServiceImpl());
}

public Pkcs7HashSignService namirialPkcs7HashSignService(String username, String password){
log.info("Signature will be performed using NamirialPkcs7HashSignServiceImpl");
return new NamirialPkcs7HashSignServiceImpl(new NamiralSignServiceImpl(username,password));
}


public Pkcs7HashSignService disabledPkcs7HashSignService(){
log.info("Signature will be performed using Pkcs7HashSignService");
return new Pkcs7HashSignService(){
Expand All @@ -82,9 +89,12 @@ public Pkcs7HashSignService pkcs7HashSignService(){
return new Pkcs7HashSignServiceImpl();
}
@ApplicationScoped
public PadesSignService padesSignService(@ConfigProperty(name = "onboarding-functions.pagopa-signature.source") String source){
public PadesSignService padesSignService(@ConfigProperty(name = "onboarding-functions.pagopa-signature.source") String source,
@ConfigProperty(name = "onboarding-functions.pagopa-signature.namirial-user") String username,
@ConfigProperty(name = "onboarding-functions.pagopa-signature.namirial-psw") String psw){
return switch (source) {
case SIGNATURE_SOURCE_ARUBA -> new PadesSignServiceImpl(arubaPkcs7HashSignService());
case SIGNATURE_SOURCE_NAMIRIAL -> new PadesSignServiceImpl(namirialPkcs7HashSignService(username, psw));
case SIGNATURE_SOURCE_DISABLED -> new PadesSignServiceImpl(disabledPkcs7HashSignService());
default -> new PadesSignServiceImpl(pkcs7HashSignService());
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,8 @@ public interface PagoPaSignatureConfig {
String location();

String applyOnboardingTemplateReason();

String namirialUser();

String namirialPsw();
}
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ onboarding-functions.pagopa-signature.source=${PAGOPA_SIGNATURE_SOURCE:disabled}
onboarding-functions.pagopa-signature.signer=${PAGOPA_SIGNATURE_SIGNER:PagoPA S.p.A.}
onboarding-functions.pagopa-signature.location=${PAGOPA_SIGNATURE_LOCATION:Roma}
onboarding-functions.pagopa-signature.apply-onboarding-template-reason=${PAGOPA_SIGNATURE_ONBOARDING_REASON_TEMPLATE:Firma contratto adesione prodotto}
onboarding-functions.pagopa-signature.namirial-user=${NAMIRIAL_SIGN_SERVICE_IDENTITY_USER:test}
onboarding-functions.pagopa-signature.namirial-psw=${NAMIRIAL_SIGN_SERVICE_IDENTITY_PASSWORD:test}

## Jacoco
quarkus.jacoco.includes=it/pagopa/selfcare/onboarding/*,it/pagopa/selfcare/onboarding/service/**,it/pagopa/selfcare/onboarding/repository/**
Expand Down
5 changes: 5 additions & 0 deletions infra/functions/onboarding-functions/env/dev/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,9 @@ app_settings = {
"JWT_TOKEN_ISSUER" = "SPID"
"JWT_TOKEN_PRIVATE_KEY" = "@Microsoft.KeyVault(SecretUri=https://selc-d-kv.vault.azure.net/secrets/jwt-private-key/)"
"JWT_TOKEN_KID" = "@Microsoft.KeyVault(SecretUri=https://selc-d-kv.vault.azure.net/secrets/jwt-kid/)"

##NAMIRIAL SIGNATURE
"PAGOPA_SIGNATURE_SOURCE" = "disabled",
"NAMIRIAL_SIGN_SERVICE_IDENTITY_USER" = "@Microsoft.KeyVault(SecretUri=https://selc-d-kv.vault.azure.net/secrets/namirial-sign-service-user/)",
"NAMIRIAL_SIGN_SERVICE_IDENTITY_PASSWORD" = "@Microsoft.KeyVault(SecretUri=https://selc-d-kv.vault.azure.net/secrets/namirial-sign-service-psw/)"
}
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,8 @@ app_settings = {
"JWT_TOKEN_ISSUER" = "SPID"
"JWT_TOKEN_PRIVATE_KEY" = "@Microsoft.KeyVault(SecretUri=https://selc-p-kv.vault.azure.net/secrets/jwt-private-key/)"
"JWT_TOKEN_KID" = "@Microsoft.KeyVault(SecretUri=https://selc-p-kv.vault.azure.net/secrets/jwt-kid/)"

##NAMIRIAL SIGNATURE
"NAMIRIAL_SIGN_SERVICE_IDENTITY_USER" = "@Microsoft.KeyVault(SecretUri=https://selc-p-kv.vault.azure.net/secrets/namirial-sign-service-user/)",
"NAMIRIAL_SIGN_SERVICE_IDENTITY_PASSWORD" = "@Microsoft.KeyVault(SecretUri=https://selc-p-kv.vault.azure.net/secrets/namirial-sign-service-psw/)"
}
4 changes: 4 additions & 0 deletions infra/functions/onboarding-functions/env/uat/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,8 @@ app_settings = {
"JWT_TOKEN_ISSUER" = "SPID"
"JWT_TOKEN_PRIVATE_KEY" = "@Microsoft.KeyVault(SecretUri=https://selc-u-kv.vault.azure.net/secrets/jwt-private-key/)"
"JWT_TOKEN_KID" = "@Microsoft.KeyVault(SecretUri=https://selc-u-kv.vault.azure.net/secrets/jwt-kid/)"

##NAMIRIAL SIGNATURE
"NAMIRIAL_SIGN_SERVICE_IDENTITY_USER" = "@Microsoft.KeyVault(SecretUri=https://selc-u-kv.vault.azure.net/secrets/namirial-sign-service-user/)",
"NAMIRIAL_SIGN_SERVICE_IDENTITY_PASSWORD" = "@Microsoft.KeyVault(SecretUri=https://selc-u-kv.vault.azure.net/secrets/namirial-sign-service-psw/)"
}

0 comments on commit 819da61

Please sign in to comment.