Skip to content

Commit

Permalink
[SELC-5899] feat: change Namirial SWS URL using container resource gr…
Browse files Browse the repository at this point in the history
…oup (#588)

Co-authored-by: Giulia Tremolada <[email protected]>
  • Loading branch information
manuraf and giulia-tremolada authored Nov 4, 2024
1 parent 7ebe547 commit 60b467a
Show file tree
Hide file tree
Showing 12 changed files with 123 additions and 35 deletions.
2 changes: 1 addition & 1 deletion infra/container_apps/namirial-sign/container_group.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
resource "azurerm_container_group" "namirial_sws_cg" {

count = var.enable_sws ? 1 : 0
name = "${local.project}-namirial-sws-cg"
location = data.azurerm_resource_group.rg_contracts_storage.location
Expand Down
2 changes: 1 addition & 1 deletion infra/container_apps/namirial-sign/data.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
data "azurerm_resource_group" "rg_contracts_storage" {
name = "${local.project}-contracts-storage-rg"
name = "${local.project}-contracts-storage-rg"
}

data "azurerm_key_vault" "key_vault" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ container_config = {
}

environment_variables = {
SPRINGDOC_API_DOCS_ENABLED=true
SPRINGDOC_API_DOCS_ENABLED = true
}

enable_sws = true
10 changes: 6 additions & 4 deletions infra/container_apps/namirial-sign/env/prod/terraform.tfvars
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
prefix = "selc"
env_short = "p"
suffix_increment = "-002"
cae_name = "cae-002"
prefix = "selc"
env_short = "p"
suffix_increment = "-002"
cae_name = "cae-002"

tags = {
CreatedBy = "Terraform"
Expand All @@ -17,3 +17,5 @@ container_config = {
}

enable_sws = true

environment_variables = {}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ container_config = {
}

environment_variables = {
SPRINGDOC_API_DOCS_ENABLED=true
SPRINGDOC_API_DOCS_ENABLED = true
}

enable_sws = true
2 changes: 1 addition & 1 deletion infra/container_apps/namirial-sign/locals.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
locals {
project = "selc-${var.env_short}"
project = "selc-${var.env_short}"
}
2 changes: 1 addition & 1 deletion infra/container_apps/namirial-sign/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ variable "tags" {
}

variable "enable_sws" {
type = bool
type = bool
default = false
}

Expand Down
83 changes: 83 additions & 0 deletions infra/functions/onboarding-functions/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions infra/functions/onboarding-functions/env/dev/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ cidr_subnet_selc_onboarding_fn = ["10.1.144.0/24"]
function_always_on = false

app_service_plan_info = {
kind = "Linux"
sku_size = "P1v3"
sku_tier = "PremiumV3"
maximum_elastic_worker_count = 1
worker_count = 1
zone_balancing_enabled = false
kind = "Linux"
sku_size = "P1v3"
sku_tier = "PremiumV3"
maximum_elastic_worker_count = 1
worker_count = 1
zone_balancing_enabled = false
}

storage_account_info = {
Expand Down Expand Up @@ -107,7 +107,7 @@ app_settings = {

##NAMIRIAL SIGNATURE
"PAGOPA_SIGNATURE_SOURCE" = "disabled",
"NAMIRIAL_BASE_URL" = "https://selc-d-namirial-sign-ca.whitemoss-eb7ef327.westeurope.azurecontainerapps.io",
"NAMIRIAL_BASE_URL" = "http://selc-d-namirial-sws-cg.westeurope.azurecontainer.io:8080",
"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 @@ -119,7 +119,7 @@ app_settings = {
"JWT_TOKEN_KID" = "@Microsoft.KeyVault(SecretUri=https://selc-p-kv.vault.azure.net/secrets/jwt-kid/)"

##NAMIRIAL SIGNATURE
"NAMIRIAL_BASE_URL" = "https://selc-p-namirial-sign-ca.lemonpond-bb0b750e.westeurope.azurecontainerapps.io",
"NAMIRIAL_BASE_URL" = "http://selc-p-namirial-sws-cg.westeurope.azurecontainer.io:8080",
"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/)"
}
30 changes: 15 additions & 15 deletions infra/functions/onboarding-functions/env/uat/terraform.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -102,23 +102,23 @@ app_settings = {


##ARUBA SIGNATURE
"PAGOPA_SIGNATURE_SOURCE" = "disabled",
"ARUBA_SIGN_SERVICE_IDENTITY_TYPE_OTP_AUTH" = "faPagoPa",
"ARUBA_SIGN_SERVICE_IDENTITY_OTP_PWD" = "dsign",
"ARUBA_SIGN_SERVICE_IDENTITY_USER" = "@Microsoft.KeyVault(SecretUri=https://selc-u-kv.vault.azure.net/secrets/aruba-sign-service-user/)",
"ARUBA_SIGN_SERVICE_IDENTITY_DELEGATED_USER" = "@Microsoft.KeyVault(SecretUri=https://selc-u-kv.vault.azure.net/secrets/aruba-sign-service-delegated-user/)",
"ARUBA_SIGN_SERVICE_IDENTITY_DELEGATED_PASSWORD" = "@Microsoft.KeyVault(SecretUri=https://selc-u-kv.vault.azure.net/secrets/aruba-sign-service-delegated-psw/)",
"ARUBA_SIGN_SERVICE_IDENTITY_DELEGATED_DOMAIN" = "faPagoPa",
"ARUBA_SIGN_SERVICE_BASE_URL" = "https://asbr-pagopa.arubapec.it/ArubaSignService/ArubaSignService"
"ARUBA_SIGN_SERVICE_REQUEST_TIMEOUT_MS" = "60000"
"ARUBA_SIGN_SERVICE_CONNECT_TIMEOUT_MS" = "60000",
"EMAIL_SERVICE_AVAILABLE" = "true",
"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/)"
"PAGOPA_SIGNATURE_SOURCE" = "disabled",
"ARUBA_SIGN_SERVICE_IDENTITY_TYPE_OTP_AUTH" = "faPagoPa",
"ARUBA_SIGN_SERVICE_IDENTITY_OTP_PWD" = "dsign",
"ARUBA_SIGN_SERVICE_IDENTITY_USER" = "@Microsoft.KeyVault(SecretUri=https://selc-u-kv.vault.azure.net/secrets/aruba-sign-service-user/)",
"ARUBA_SIGN_SERVICE_IDENTITY_DELEGATED_USER" = "@Microsoft.KeyVault(SecretUri=https://selc-u-kv.vault.azure.net/secrets/aruba-sign-service-delegated-user/)",
"ARUBA_SIGN_SERVICE_IDENTITY_DELEGATED_PASSWORD" = "@Microsoft.KeyVault(SecretUri=https://selc-u-kv.vault.azure.net/secrets/aruba-sign-service-delegated-psw/)",
"ARUBA_SIGN_SERVICE_IDENTITY_DELEGATED_DOMAIN" = "faPagoPa",
"ARUBA_SIGN_SERVICE_BASE_URL" = "https://asbr-pagopa.arubapec.it/ArubaSignService/ArubaSignService"
"ARUBA_SIGN_SERVICE_REQUEST_TIMEOUT_MS" = "60000"
"ARUBA_SIGN_SERVICE_CONNECT_TIMEOUT_MS" = "60000",
"EMAIL_SERVICE_AVAILABLE" = "true",
"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_BASE_URL" = "https://selc-u-namirial-sign-ca.mangopond-2a5d4d65.westeurope.azurecontainerapps.io",
"NAMIRIAL_BASE_URL" = "http://selc-u-namirial-sws-cg.westeurope.azurecontainer.io:8080",
"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/)"
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@ public byte[] signDocument(SignRequest request) throws IOException {
HttpTransport httpTransport = new NetHttpTransport();
HttpRequestFactory requestFactory = httpTransport.createRequestFactory();

String boundary = "----WebKitFormBoundary7MA4YWxkTrZu0gW";

// Create the multipart content
MultipartContent multipartContent = new MultipartContent();
MultipartContent multipartContent = new MultipartContent()
.setBoundary(boundary);
ObjectMapper objectMapper = new ObjectMapper();


Expand Down Expand Up @@ -58,7 +61,7 @@ public byte[] signDocument(SignRequest request) throws IOException {
new GenericUrl(NAMIRIAL_SIGN_PADES_URL), multipartContent);

// Set any required headers
httpRequest.getHeaders().setContentType("multipart/form-data;");
httpRequest.getHeaders().setContentType("multipart/form-data; boundary=" + boundary);


try {
Expand Down

0 comments on commit 60b467a

Please sign in to comment.