Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: #1264 config prod bcsc #1288

Merged
merged 5 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 51 additions & 53 deletions infrastructure/server/oidc_idp_bcsc.tf
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# BCSC IDP that connects directly to IDIM Consulting OIDC server
locals{
dev_local_bcsc_userinfo_proxy_endpoint = "${aws_api_gateway_deployment.fam_api_gateway_deployment.invoke_url}/bcsc/userinfo/dev"
locals {
dev_local_bcsc_userinfo_proxy_endpoint = "${aws_api_gateway_deployment.fam_api_gateway_deployment.invoke_url}/bcsc/userinfo/dev"
test_local_bcsc_userinfo_proxy_endpoint = "${aws_api_gateway_deployment.fam_api_gateway_deployment.invoke_url}/bcsc/userinfo/test"
prod_local_bcsc_userinfo_proxy_endpoint = "${aws_api_gateway_deployment.fam_api_gateway_deployment.invoke_url}/bcsc/userinfo/prod"
dev_local_bcsc_token_proxy_endpoint = "${aws_api_gateway_deployment.fam_api_gateway_deployment.invoke_url}/bcsc/token/dev"
test_local_bcsc_token_proxy_endpoint = "${aws_api_gateway_deployment.fam_api_gateway_deployment.invoke_url}/bcsc/token/test"
prod_local_bcsc_token_proxy_endpoint = "${aws_api_gateway_deployment.fam_api_gateway_deployment.invoke_url}/bcsc/token/prod"
}

resource "aws_cognito_identity_provider" "dev_bcsc_oidc_provider" {
Expand All @@ -16,25 +19,24 @@ resource "aws_cognito_identity_provider" "dev_bcsc_oidc_provider" {
client_secret = var.dev_oidc_bcsc_idp_client_secret
oidc_issuer = var.dev_bcsc_oidc_idp_issuer
attributes_request_method = "GET"
authorize_url = "https://idtest.gov.bc.ca/login/oidc/authorize"
token_url = "${aws_api_gateway_deployment.fam_api_gateway_deployment.invoke_url}/bcsc/token/dev"
attributes_url = "${var.use_override_proxy_endpoints ? var.dev_override_bcsc_userinfo_proxy_endpoint : local.dev_local_bcsc_userinfo_proxy_endpoint}"

jwks_uri = "https://idtest.gov.bc.ca/oauth2/jwk.json"
authorize_url = "https://idtest.gov.bc.ca/login/oidc/authorize"
token_url = "${var.use_override_proxy_endpoints ? var.dev_override_bcsc_token_proxy_endpoint : local.dev_local_bcsc_token_proxy_endpoint}"
MCatherine1994 marked this conversation as resolved.
Show resolved Hide resolved
attributes_url = "${var.use_override_proxy_endpoints ? var.dev_override_bcsc_userinfo_proxy_endpoint : local.dev_local_bcsc_userinfo_proxy_endpoint}"
jwks_uri = "https://idtest.gov.bc.ca/oauth2/jwk"
}

attribute_mapping = {
given_name = "given_name",
family_name = "family_name",
birthdate = "birthdate",
gender = "gender",
email = "email",
email_verified = "email_verified",
address = "address",
"custom:idp_name" = "aud",
"custom:idp_user_id" = "sub",
"custom:idp_display_name" = "display_name",
"custom:given_names" = "given_names"
given_name = "given_name",
family_name = "family_name",
birthdate = "birthdate",
gender = "gender",
email = "email",
email_verified = "email_verified",
address = "address",
"custom:idp_name" = "aud",
"custom:idp_user_id" = "sub",
"custom:idp_display_name" = "display_name",
"custom:given_names" = "given_names"
}
}

Expand All @@ -49,26 +51,24 @@ resource "aws_cognito_identity_provider" "test_bcsc_oidc_provider" {
client_secret = var.test_oidc_bcsc_idp_client_secret
oidc_issuer = var.test_bcsc_oidc_idp_issuer
attributes_request_method = "GET"
authorize_url = "https://idtest.gov.bc.ca/login/oidc/authorize"
token_url = "${aws_api_gateway_deployment.fam_api_gateway_deployment.invoke_url}/bcsc/token/test"

attributes_url = "${var.use_override_proxy_endpoints ? var.test_override_bcsc_userinfo_proxy_endpoint : local.test_local_bcsc_userinfo_proxy_endpoint}"

jwks_uri = "https://idtest.gov.bc.ca/oauth2/jwk.json"
authorize_url = "https://idtest.gov.bc.ca/login/oidc/authorize"
token_url = "${var.use_override_proxy_endpoints ? var.test_override_bcsc_token_proxy_endpoint : local.test_local_bcsc_token_proxy_endpoint}"
attributes_url = "${var.use_override_proxy_endpoints ? var.test_override_bcsc_userinfo_proxy_endpoint : local.test_local_bcsc_userinfo_proxy_endpoint}"
jwks_uri = "https://idtest.gov.bc.ca/oauth2/jwk"
}

attribute_mapping = {
given_name = "given_name",
family_name = "family_name",
birthdate = "birthdate",
gender = "gender",
email = "email",
email_verified = "email_verified",
address = "address",
"custom:idp_name" = "aud",
"custom:idp_user_id" = "sub",
"custom:idp_display_name" = "display_name",
"custom:given_names" = "given_names"
given_name = "given_name",
family_name = "family_name",
birthdate = "birthdate",
gender = "gender",
email = "email",
email_verified = "email_verified",
address = "address",
"custom:idp_name" = "aud",
"custom:idp_user_id" = "sub",
"custom:idp_display_name" = "display_name",
"custom:given_names" = "given_names"
}

}
Expand All @@ -84,26 +84,24 @@ resource "aws_cognito_identity_provider" "prod_bcsc_oidc_provider" {
client_secret = var.prod_oidc_bcsc_idp_client_secret
MCatherine1994 marked this conversation as resolved.
Show resolved Hide resolved
oidc_issuer = var.prod_bcsc_oidc_idp_issuer
attributes_request_method = "GET"
authorize_url = "https://idtest.gov.bc.ca/login/oidc/authorize"
token_url = "${aws_api_gateway_deployment.fam_api_gateway_deployment.invoke_url}/bcsc/token/prod"

attributes_url = "${var.use_override_proxy_endpoints ? var.prod_override_bcsc_userinfo_proxy_endpoint : local.prod_local_bcsc_userinfo_proxy_endpoint}"

jwks_uri = "https://idtest.gov.bc.ca/oauth2/jwk.json"
authorize_url = "https://id.gov.bc.ca/login/oidc/authorize"
token_url = "${var.use_override_proxy_endpoints ? var.prod_override_bcsc_token_proxy_endpoint : local.prod_local_bcsc_token_proxy_endpoint}"
attributes_url = "${var.use_override_proxy_endpoints ? var.prod_override_bcsc_userinfo_proxy_endpoint : local.prod_local_bcsc_userinfo_proxy_endpoint}"
jwks_uri = "https://id.gov.bc.ca/oauth2/jwk"
}

attribute_mapping = {
given_name = "given_name",
family_name = "family_name",
birthdate = "birthdate",
gender = "gender",
email = "email",
email_verified = "email_verified",
address = "address",
"custom:idp_display_name" = "display_name",
"custom:idp_name" = "aud",
"custom:idp_user_id" = "sub",
"custom:given_names" = "given_names"
given_name = "given_name",
family_name = "family_name",
birthdate = "birthdate",
gender = "gender",
email = "email",
email_verified = "email_verified",
address = "address",
"custom:idp_display_name" = "display_name",
"custom:idp_name" = "aud",
"custom:idp_user_id" = "sub",
"custom:given_names" = "given_names"
}

}
}
20 changes: 19 additions & 1 deletion infrastructure/server/variables_provided.tf
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ variable "test_oidc_bcsc_idp_client_id" {

variable "prod_oidc_bcsc_idp_client_id" {
type = string
default = "not.yet.implemented"
default = "ca.bc.gov.flnr.fam.prod"
ianliuwk1019 marked this conversation as resolved.
Show resolved Hide resolved
}

# Networking Variables
Expand Down Expand Up @@ -335,6 +335,24 @@ variable "prod_override_bcsc_userinfo_proxy_endpoint" {
default = "not used unless overridden in terragrunt"
}

variable "dev_override_bcsc_token_proxy_endpoint" {
description = "Endpoint for Cognito to get token for BCSC DEV environment"
type = string
default = "not used unless overridden in terragrunt"
}

variable "test_override_bcsc_token_proxy_endpoint" {
description = "Endpoint for Cognito to get token for BCSC TEST environment"
type = string
default = "not used unless overridden in terragrunt"
}

variable "prod_override_bcsc_token_proxy_endpoint" {
description = "Endpoint for Cognito to get token for BCSC PROD environment"
type = string
default = "not used unless overridden in terragrunt"
}

variable "dev_pr_url_count" {
description = "Number of pull request redirect urls of Cognito dev clients"
type = number
Expand Down
9 changes: 6 additions & 3 deletions terraform/dev/terragrunt.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,12 @@ generate "dev_tfvars" {
fam_console_idp_name_bceid = "TEST-BCEIDBUSINESS"
forest_client_api_base_url = "https://nr-forest-client-api-test.api.gov.bc.ca"
use_override_proxy_endpoints = true
dev_override_bcsc_userinfo_proxy_endpoint = "https://c727z9v3cc.execute-api.ca-central-1.amazonaws.com/v1/bcsc/userinfo/dev"
test_override_bcsc_userinfo_proxy_endpoint = "https://c727z9v3cc.execute-api.ca-central-1.amazonaws.com/v1/bcsc/userinfo/test"
prod_override_bcsc_userinfo_proxy_endpoint = "https://c727z9v3cc.execute-api.ca-central-1.amazonaws.com/v1/bcsc/userinfo/prod"
dev_override_bcsc_userinfo_proxy_endpoint = "https://6mud7781pe.execute-api.ca-central-1.amazonaws.com/v1/bcsc/userinfo/dev"
ianliuwk1019 marked this conversation as resolved.
Show resolved Hide resolved
test_override_bcsc_userinfo_proxy_endpoint = "https://6mud7781pe.execute-api.ca-central-1.amazonaws.com/v1/bcsc/userinfo/test"
prod_override_bcsc_userinfo_proxy_endpoint = "https://6mud7781pe.execute-api.ca-central-1.amazonaws.com/v1/bcsc/userinfo/prod"
dev_override_bcsc_token_proxy_endpoint = "https://6mud7781pe.execute-api.ca-central-1.amazonaws.com/v1/bcsc/token/dev"
test_override_bcsc_token_proxy_endpoint = "https://6mud7781pe.execute-api.ca-central-1.amazonaws.com/v1/bcsc/token/test"
prod_override_bcsc_token_proxy_endpoint = "https://6mud7781pe.execute-api.ca-central-1.amazonaws.com/v1/bcsc/token/prod"
idim_proxy_api_base_url = "https://nr-fam-idim-lookup-proxy-test-backend.apps.silver.devops.gov.bc.ca"
EOF
}
5 changes: 1 addition & 4 deletions terraform/tools/terragrunt.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,7 @@ generate "tools_tfvars" {
fam_console_idp_name = "TEST-IDIR"
fam_console_idp_name_bceid = "TEST-BCEIDBUSINESS"
forest_client_api_base_url = "https://nr-forest-client-api-test.api.gov.bc.ca"
use_override_proxy_endpoints = true
dev_override_bcsc_userinfo_proxy_endpoint = "https://c727z9v3cc.execute-api.ca-central-1.amazonaws.com/v1/bcsc/userinfo/dev"
test_override_bcsc_userinfo_proxy_endpoint = "https://c727z9v3cc.execute-api.ca-central-1.amazonaws.com/v1/bcsc/userinfo/test"
prod_override_bcsc_userinfo_proxy_endpoint = "https://c727z9v3cc.execute-api.ca-central-1.amazonaws.com/v1/bcsc/userinfo/prod"
use_override_proxy_endpoints = false
ianliuwk1019 marked this conversation as resolved.
Show resolved Hide resolved
idim_proxy_api_base_url = "https://nr-fam-idim-lookup-proxy-test-backend.apps.silver.devops.gov.bc.ca"
EOF
}
Loading