diff --git a/docker/keycloak/extensions-7.6/themes/src/main/resources/theme/bcgov-idp-login/login/login.ftl b/docker/keycloak/extensions-7.6/themes/src/main/resources/theme/bcgov-idp-login/login/login.ftl
index f5c3197a..95553f59 100755
--- a/docker/keycloak/extensions-7.6/themes/src/main/resources/theme/bcgov-idp-login/login/login.ftl
+++ b/docker/keycloak/extensions-7.6/themes/src/main/resources/theme/bcgov-idp-login/login/login.ftl
@@ -9,7 +9,7 @@
<#list social.providers as p>
- ${p.displayName!}
+ ${p.displayName!}
#list>
diff --git a/helm/keycloak/values-b861c7-test-4.yaml b/helm/keycloak/values-b861c7-test-4.yaml
index 5a7edf02..029e2c6a 100644
--- a/helm/keycloak/values-b861c7-test-4.yaml
+++ b/helm/keycloak/values-b861c7-test-4.yaml
@@ -2,7 +2,7 @@ replicaCount: 1
image:
repository: ghcr.io/bcgov/sso
- tag: 7.6.5-build.18
+ tag: 7.6.5-build.21
pullPolicy: IfNotPresent
rollingUpdate:
diff --git a/helm/keycloak/values-b861c7-test-5.yaml b/helm/keycloak/values-b861c7-test-5.yaml
index b66784f0..01688cf2 100644
--- a/helm/keycloak/values-b861c7-test-5.yaml
+++ b/helm/keycloak/values-b861c7-test-5.yaml
@@ -2,7 +2,7 @@ replicaCount: 1
image:
repository: ghcr.io/bcgov/sso
- tag: 7.6.5-build.18
+ tag: 7.6.5-build.21
pullPolicy: IfNotPresent
rollingUpdate:
diff --git a/helm/keycloak/values-b861c7-test-6.yaml b/helm/keycloak/values-b861c7-test-6.yaml
index 040e08ff..88f81941 100644
--- a/helm/keycloak/values-b861c7-test-6.yaml
+++ b/helm/keycloak/values-b861c7-test-6.yaml
@@ -2,7 +2,7 @@ replicaCount: 1
image:
repository: ghcr.io/bcgov/sso
- tag: 7.6.5-build.18
+ tag: 7.6.5-build.21
pullPolicy: IfNotPresent
rollingUpdate:
diff --git a/scripts/keycloak-gold-standard-client-rep-roles-terraform-imports.js b/scripts/keycloak-gold-standard-client-rep-roles-terraform-imports.js
new file mode 100644
index 00000000..03e4f8aa
--- /dev/null
+++ b/scripts/keycloak-gold-standard-client-rep-roles-terraform-imports.js
@@ -0,0 +1,88 @@
+const _ = require('lodash');
+const { argv } = require('yargs');
+const Confirm = require('prompt-confirm');
+const { getAdminClient } = require('./keycloak-core');
+const { handleError, ignoreError } = require('./helpers');
+const { env, auto } = argv;
+
+const prefix = 'client-';
+
+const envMap = {
+ alpha: 'dev',
+ beta: 'test',
+ gamma: 'prod',
+};
+
+async function main() {
+ if (!env || !['alpha', 'beta', 'gamma'].includes(env)) {
+ console.info(`
+Prints Terraform import statements to import the standard client-representative realm roles.
+
+Usages:
+ node keycloak-gold-standard-client-rep-roles-terraform-imports --env [--auto]
+`);
+
+ return;
+ }
+
+ try {
+ const adminClient = await getAdminClient(env);
+ if (!adminClient) return;
+
+ if (!auto) {
+ const prompt = new Confirm(`Are you sure to proceed?`);
+ const answer = await prompt.run();
+ if (!answer) return;
+ }
+
+ const max = 500;
+ let first = 0;
+ let total = 0;
+
+ const result = [];
+
+ while (true) {
+ const roles = await adminClient.roles.find({ realm: 'standard' });
+
+ const count = roles.length;
+ total += count;
+
+ for (let x = 0; x < roles.length; x++) {
+ const role = roles[x];
+ if (!role.name.startsWith(prefix)) continue;
+
+ const clientId = role.name.substring(prefix.length);
+
+ const clients = await adminClient.clients.find({ realm: 'standard', clientId: clientId });
+ if (clients.length === 0) {
+ console.log(`client not found: ${clientId}`);
+ continue;
+ }
+
+ const usersWithRole = await adminClient.roles.findUsersWithRole({ realm: 'standard', name: role.name });
+ if (usersWithRole.length === 0) {
+ continue;
+ }
+
+ const module = `module.keycloak_${envMap[env]}.module.standard_clients.module.${clientId}.keycloak_role.realm_role`;
+ const rmCmd = `terraform state rm ${module}`;
+ const addCmd = `terraform import ${module} standard/${role.id}`;
+
+ result.push(addCmd);
+ }
+
+ if (count < max) break;
+
+ first = first + max;
+ }
+
+ console.log(`${total} roles found.`);
+ result.map((v) => console.log(v));
+ process.exit(0);
+ } catch (err) {
+ handleError(err);
+ process.exit(1);
+ }
+}
+
+main();
diff --git a/scripts/migrations/helpers/migrate-target-bceidboth-users.js b/scripts/migrations/helpers/migrate-target-bceidboth-users.js
index 9d0fdbfe..a2cabc25 100644
--- a/scripts/migrations/helpers/migrate-target-bceidboth-users.js
+++ b/scripts/migrations/helpers/migrate-target-bceidboth-users.js
@@ -43,13 +43,16 @@ const parseAccount = (data) => {
const displayName = _.get(data, 'displayName.0.value.0');
const type = _.get(data, 'type.0.code.0');
const email = _.get(data, 'contact.0.email.0.value.0');
+ const telephone = _.get(data, 'contact.0.telephone.0.value.0');
+ const firstName = _.get(data, 'individualIdentity.0.name.0.firstname.0.value.0');
+ const lastName = _.get(data, 'individualIdentity.0.name.0.surname.0.value.0');
const businessGuid = _.get(data, 'business.0.guid.0.value.0');
const businessLegalName = _.get(data, 'business.0.legalName.0.value.0');
- return { guid, userId, displayName, type, email, businessGuid, businessLegalName };
+ return { guid, userId, displayName, type, email, telephone, firstName, lastName, businessGuid, businessLegalName };
};
-const fetchBceidUser = async ({ accountType = 'Business', matchKey = '', env = 'dev' }) => {
+const fetchBceidUser = async ({ accountType = 'Business', property = 'userGuid', matchKey = '', env = 'dev' }) => {
let serviceUrl = '';
let serviceId = '';
if (env === 'dev') {
@@ -63,7 +66,7 @@ const fetchBceidUser = async ({ accountType = 'Business', matchKey = '', env = '
serviceId = process.env.BCEID_SERVICE_ID_PROD;
}
- const xml = generateXML({ accountType, matchKey, serviceId });
+ const xml = generateXML({ accountType, property, matchKey, serviceId });
try {
const { response } = await soapRequest({
diff --git a/scripts/migrations/test-bceid-webservice.js b/scripts/migrations/test-bceid-webservice.js
index 8bdf0097..04f25ef5 100644
--- a/scripts/migrations/test-bceid-webservice.js
+++ b/scripts/migrations/test-bceid-webservice.js
@@ -3,7 +3,7 @@ const { argv } = require('yargs');
const Confirm = require('prompt-confirm');
const { handleError, ignoreError } = require('../helpers');
const { fetchBceidUser } = require('./helpers/migrate-target-bceidboth-users');
-const { type, search, env, auto } = argv;
+const { type, search, property, env, auto } = argv;
async function main() {
if (!env) {
@@ -14,7 +14,8 @@ async function main() {
Flags:
--env BCeID Client environment; dev | test | prod
--type BCeID account type; Business | Individual
- --search BCeID account GUID to search for
+ --property BCeID search property; userGuid | userId
+ --search BCeID account search value
--auto Skips the confirmation before running the script
`);
@@ -28,7 +29,7 @@ async function main() {
if (!answer) return;
}
- const result = await fetchBceidUser({ accountType: type, matchKey: search, env });
+ const result = await fetchBceidUser({ accountType: type, property, matchKey: search, env });
console.log('result', result);
process.exit(0);