From 513bb9372a1fcbe0a535bc237be86bd94f3685d4 Mon Sep 17 00:00:00 2001 From: pstamatop Date: Wed, 4 Sep 2024 14:56:36 +0300 Subject: [PATCH 1/3] Remove NAS authentication component, add condition for qr in vid authentication --- .../acme-verifier/src/configuration/locale.ts | 2 +- .../datasets/ehic_populate_dataset.py | 79 ++++++++++ .../AuthenticationMethodSelectionComponent.ts | 42 +---- .../VIDAuthenticationComponent.ts | 11 +- .../datasets/pda1_populate_dataset.py | 149 ++++++++++++++++++ .../AuthenticationMethodSelectionComponent.ts | 41 +---- .../datasets/vid_populate_dataset.py | 75 +++++++++ 7 files changed, 330 insertions(+), 69 deletions(-) create mode 100644 wallet-enterprise-configurations/ehic-issuer/datasets/ehic_populate_dataset.py create mode 100644 wallet-enterprise-configurations/pda1-issuer/datasets/pda1_populate_dataset.py create mode 100644 wallet-enterprise-configurations/vid-issuer/datasets/vid_populate_dataset.py diff --git a/wallet-enterprise-configurations/acme-verifier/src/configuration/locale.ts b/wallet-enterprise-configurations/acme-verifier/src/configuration/locale.ts index 83ca45d..273d2da 100644 --- a/wallet-enterprise-configurations/acme-verifier/src/configuration/locale.ts +++ b/wallet-enterprise-configurations/acme-verifier/src/configuration/locale.ts @@ -30,7 +30,7 @@ const locale = { error: { emptyUsername: "Username is empty", emptyPassword: "Password is empty", - invalidCredentials: "Invalid credentials", + invalidCredentials: "Invalid Login Data", networkError: "Network error occured", } } diff --git a/wallet-enterprise-configurations/ehic-issuer/datasets/ehic_populate_dataset.py b/wallet-enterprise-configurations/ehic-issuer/datasets/ehic_populate_dataset.py new file mode 100644 index 0000000..74ec2ad --- /dev/null +++ b/wallet-enterprise-configurations/ehic-issuer/datasets/ehic_populate_dataset.py @@ -0,0 +1,79 @@ +import pandas as pd +import json +import random +import string +import sys + +def create_json_from_excel(excel_file_path): + # Read Excel file into pandas DataFrame + df = pd.read_excel(excel_file_path, sheet_name="EHIC", header=0) + # Initialize list to store user data + users = [] + + # Iterate through each row in the DataFrame + for index, row in df.iterrows(): + username = (row['email-adress'].split('@')[0]).lower() + password = username + uid = str(row['pid_id']) + personal_identifier = str(row['social_security_pin']) + first_name = row['given_name'] + family_name = row['family_name'] + ssn = str(row['social_security_pin']) + birth_date = str(row['birth_date'].strftime('%Y-%m-%d')) + documentId = str(int(row['ehic_card_identification_number'])) + startingDate = str(row['ehic_start_date']) + endingDate = str(row['ehic_end_date']) + competentInstitutionId = row['ehic_institution_id'] + competentInstitutionName = row['ehic_institution_name'] + competentInstitutionCountryCode = row['ehic_institution_country_code_'] + + + # Construct user dictionary + user_data = { + "authentication": { + "username": username, + "password": password, + "uid": uid, + "personalIdentifier": personal_identifier + }, + "claims": { + "firstName": first_name, + "familyName": family_name, + "birthdate": birth_date, + "personalIdentifier": personal_identifier, + "socialSecurityIdentification": { + "ssn": ssn + }, + "validityPeriod": { + "startingDate": startingDate, + "endingDate": endingDate + }, + "documentId": documentId, + "competentInstitution": { + "competentInstitutionId": competentInstitutionId, + "competentInstitutionName": competentInstitutionName, + "competentInstitutionCountryCode": competentInstitutionCountryCode + } + } + } + + # Append user data to the list + users.append(user_data) + + # Construct final JSON structure + json_data = {"users": users} + + # Write JSON data to a file + output_file_path = excel_file_path.replace('.xlsx', '_output.json') + with open(output_file_path, 'w') as f: + json.dump(json_data, f, indent=4) + + print("JSON file created successfully at:", output_file_path) + +if __name__ == "__main__": + if len(sys.argv) != 2: + print("Usage: python script.py ") + sys.exit(1) + + excel_file_path = sys.argv[1] + create_json_from_excel(excel_file_path) diff --git a/wallet-enterprise-configurations/ehic-issuer/src/configuration/authentication/AuthenticationMethodSelectionComponent.ts b/wallet-enterprise-configurations/ehic-issuer/src/configuration/authentication/AuthenticationMethodSelectionComponent.ts index e517411..84bbe77 100644 --- a/wallet-enterprise-configurations/ehic-issuer/src/configuration/authentication/AuthenticationMethodSelectionComponent.ts +++ b/wallet-enterprise-configurations/ehic-issuer/src/configuration/authentication/AuthenticationMethodSelectionComponent.ts @@ -4,7 +4,6 @@ import { ParsedQs } from "qs"; import { AuthenticationComponent } from "../../authentication/AuthenticationComponent"; import AppDataSource from "../../AppDataSource"; import { AuthorizationServerState } from "../../entities/AuthorizationServerState.entity"; -import locale from "../locale"; import { appContainer } from "../../services/inversify.config"; import { CredentialIssuersConfigurationService } from "../CredentialIssuersConfigurationService"; import { UserAuthenticationMethod } from "../../types/UserAuthenticationMethod.enum"; @@ -27,12 +26,7 @@ export class AuthenticationMethodSelectionComponent extends AuthenticationCompon if (await this.hasSelectedAuthenticationMethod(req)) { return next(); } - - if (req.method == "POST") { - return this.handleAuthenticationMethodSelection(req, res); - } - - return this.renderAuthenticationMethodSelection(req, res); + return this.handleAuthenticationMethodSelection(req, res); }) .catch(() => { return next(); @@ -49,36 +43,16 @@ export class AuthenticationMethodSelectionComponent extends AuthenticationCompon } private async handleAuthenticationMethodSelection(req: Request, res: Response): Promise { - const { auth_method } = req.body; - if (auth_method) { - if (!auth_method || ( - auth_method != UserAuthenticationMethod.SSO && - auth_method != UserAuthenticationMethod.VID_AUTH)) { - return this.renderAuthenticationMethodSelection(req, res); - } - - req.session.authenticationChain.authenticationMethodSelectionComponent = { - authentication_method: auth_method - }; + const auth_method = UserAuthenticationMethod.VID_AUTH; + req.session.authenticationChain.authenticationMethodSelectionComponent = { + authentication_method: auth_method + }; - req.authorizationServerState.authenticationMethod = auth_method; + req.authorizationServerState.authenticationMethod = auth_method; - await AppDataSource.getRepository(AuthorizationServerState).save(req.authorizationServerState); - return res.redirect(this.protectedEndpoint); - } - else { - return this.renderAuthenticationMethodSelection(req, res); - } + await AppDataSource.getRepository(AuthorizationServerState).save(req.authorizationServerState); + return res.redirect(this.protectedEndpoint); } - - private async renderAuthenticationMethodSelection(req: Request, res: Response): Promise { - res.render('issuer/auth-method-selection', { - title: "Authentication Method Selection", - lang: req.lang, - locale: locale[req.lang] - }) - } - } \ No newline at end of file diff --git a/wallet-enterprise-configurations/ehic-issuer/src/configuration/authentication/VIDAuthenticationComponent.ts b/wallet-enterprise-configurations/ehic-issuer/src/configuration/authentication/VIDAuthenticationComponent.ts index b037632..5f788a9 100644 --- a/wallet-enterprise-configurations/ehic-issuer/src/configuration/authentication/VIDAuthenticationComponent.ts +++ b/wallet-enterprise-configurations/ehic-issuer/src/configuration/authentication/VIDAuthenticationComponent.ts @@ -143,8 +143,17 @@ export class VIDAuthenticationComponent extends AuthenticationComponent { lang: req.lang, locale: locale[req.lang] }); + } else { + return res.render('issuer/vid-auth-component', { + title: "VID authentication", + wwwalletURL: config.wwwalletURL, + authorizationRequestURL: url.toString(), + authorizationRequestQR: null, + state: url.searchParams.get('state'), + lang: req.lang, + locale: locale[req.lang] + }); } - return res.redirect(url.toString()); } diff --git a/wallet-enterprise-configurations/pda1-issuer/datasets/pda1_populate_dataset.py b/wallet-enterprise-configurations/pda1-issuer/datasets/pda1_populate_dataset.py new file mode 100644 index 0000000..2bfa200 --- /dev/null +++ b/wallet-enterprise-configurations/pda1-issuer/datasets/pda1_populate_dataset.py @@ -0,0 +1,149 @@ +import pandas as pd +import json +import random +import string +import sys + +# Function to generate a random reference ID +def generate_document_id(): + return ''.join(random.choices(string.digits, k=20)) + +def create_json_from_excel(excel_file_path): + # Read Excel file into pandas DataFrame + df = pd.read_excel(excel_file_path, sheet_name="PDA1", header=0) + + # Initialize list to store user data + users = [] + + # Iterate through each row in the DataFrame + for index, row in df.iterrows(): + print(row) + username = (row['email-adress'].split('@')[0]).lower() + email = row['email-adress'] + password = username + uid = str(row['pid_id']) + first_name = row['given_name'] + family_name = row['family_name'] + personal_identifier = str(row['social_security_pin']) + + ssn = str(row['social_security_pin']) + birth_date = str(row['birth_date'].strftime('%Y-%m-%d')) + documentId = str(row['pda1_document_id']) + startingDate = str(row['pda1_starting_date']) + endingDate = str(row['pda1_ending_date']) + competentInstitutionId = row['pda1_institution_id'] + competentInstitutionName = row['pda1_institution_name'] + competentInstitutionCountryCode = row['pda1_institution_country_code_'] + + nationalityCode = row['nationality'] + employmentType = row['type_of_employment '] + name = row['pda1_name '] + employerId = row['pda1_employer_id'] + typeOfId = row['pda1_type_of_id'] + + street = row['pda1_employer_Street'] + town = row['pda1_employer_town'] + postalCode = str(row['pda1_employer_postal_code']) + countryCode = row['pda1_employer_country_ code'] + + pow_companyName = row['pda1_pow_company_name '] + # pow_flagBaseHomeState = row['pda1_flag_base_home_state'] + pow_companyId = row['pda1_pow_company_id'] + pow_typeOfId = row['pda1_pow_type_ of_id '] + pow_street = row['pda1_pow_employer_street'] + pow_town = row['pda1_pow_employer_town'] + pow_postalCode = str(row['pda1_pow_employer_postal_code']) + pow_countryCode = row['pda1_pow_employer_country_code'] + + memberStateWhoseLegislationIsToBeApplied = row['pda1_member_state'] + transitionalRulesApplyAsPerTheRegulation = row['pda1_transitional_rules'] + + statusCode = row['pda1_status_confirmation'] + + + # Construct user dictionary + user_data = { + "authentication": { + "username": username, + "password": password, + "uid": uid, + "personalIdentifier": personal_identifier, + "email": email + }, + "claims": { + "firstName": first_name, + "familyName": family_name, + "birthdate": birth_date, + "personalIdentifier": personal_identifier, + "socialSecurityIdentification": { + "ssn": ssn + }, + + "nationality": { + "nationalityCode": nationalityCode + }, + "employer": { + "employmentType": employmentType, + "name": name, + "employerId": employerId, + "typeOfId": typeOfId + }, + "address": { + "street": street, + "town": town, + "postalCode": postalCode, + "countryCode": countryCode + }, + "placeOfWork": { + "companyName": pow_companyName, + "flagBaseHomeState": "", + "companyId": pow_companyId, + "typeOfId": pow_typeOfId, + "street": pow_street, + "town": pow_town, + "postalCode": pow_postalCode, + "countryCode": pow_countryCode + }, + "decisionOnApplicableLegislation": { + "decisionOnMSWhoseLegislationApplies": { + "memberStateWhoseLegislationIsToBeApplied": memberStateWhoseLegislationIsToBeApplied, + "transitionalRulesApplyAsPerTheRegulation": transitionalRulesApplyAsPerTheRegulation + }, + "validityPeriod": { + "startingDate": startingDate, + "endingDate": endingDate + }, + }, + "statusConfirmation": { + "statusCode": statusCode + }, + "documentId": documentId, + "competentInstitution": { + "competentInstitutionId": competentInstitutionId, + "competentInstitutionName": competentInstitutionName, + "competentInstitutionCountryCode": competentInstitutionCountryCode + } + } + + } + + # Append user data to the list + users.append(user_data) + + # Construct final JSON structure + json_data = {"users": users} + + # Write JSON data to a file + output_file_path = excel_file_path.replace('.xlsx', '_output.json') + with open(output_file_path, 'w') as f: + json.dump(json_data, f, indent=4) + + print("JSON file created successfully at:", output_file_path) + +if __name__ == "__main__": + if len(sys.argv) != 2: + print("Usage: python script.py ") + sys.exit(1) + + excel_file_path = sys.argv[1] + create_json_from_excel(excel_file_path) diff --git a/wallet-enterprise-configurations/pda1-issuer/src/configuration/authentication/AuthenticationMethodSelectionComponent.ts b/wallet-enterprise-configurations/pda1-issuer/src/configuration/authentication/AuthenticationMethodSelectionComponent.ts index e517411..50598f7 100644 --- a/wallet-enterprise-configurations/pda1-issuer/src/configuration/authentication/AuthenticationMethodSelectionComponent.ts +++ b/wallet-enterprise-configurations/pda1-issuer/src/configuration/authentication/AuthenticationMethodSelectionComponent.ts @@ -4,7 +4,6 @@ import { ParsedQs } from "qs"; import { AuthenticationComponent } from "../../authentication/AuthenticationComponent"; import AppDataSource from "../../AppDataSource"; import { AuthorizationServerState } from "../../entities/AuthorizationServerState.entity"; -import locale from "../locale"; import { appContainer } from "../../services/inversify.config"; import { CredentialIssuersConfigurationService } from "../CredentialIssuersConfigurationService"; import { UserAuthenticationMethod } from "../../types/UserAuthenticationMethod.enum"; @@ -27,12 +26,7 @@ export class AuthenticationMethodSelectionComponent extends AuthenticationCompon if (await this.hasSelectedAuthenticationMethod(req)) { return next(); } - - if (req.method == "POST") { - return this.handleAuthenticationMethodSelection(req, res); - } - - return this.renderAuthenticationMethodSelection(req, res); + return this.handleAuthenticationMethodSelection(req, res); }) .catch(() => { return next(); @@ -49,36 +43,17 @@ export class AuthenticationMethodSelectionComponent extends AuthenticationCompon } private async handleAuthenticationMethodSelection(req: Request, res: Response): Promise { - const { auth_method } = req.body; - if (auth_method) { - if (!auth_method || ( - auth_method != UserAuthenticationMethod.SSO && - auth_method != UserAuthenticationMethod.VID_AUTH)) { - return this.renderAuthenticationMethodSelection(req, res); - } - - req.session.authenticationChain.authenticationMethodSelectionComponent = { - authentication_method: auth_method - }; + const auth_method = UserAuthenticationMethod.VID_AUTH; - req.authorizationServerState.authenticationMethod = auth_method; + req.session.authenticationChain.authenticationMethodSelectionComponent = { + authentication_method: auth_method + }; - await AppDataSource.getRepository(AuthorizationServerState).save(req.authorizationServerState); - return res.redirect(this.protectedEndpoint); - } - else { - return this.renderAuthenticationMethodSelection(req, res); - } - } + req.authorizationServerState.authenticationMethod = auth_method; - private async renderAuthenticationMethodSelection(req: Request, res: Response): Promise { - res.render('issuer/auth-method-selection', { - title: "Authentication Method Selection", - lang: req.lang, - locale: locale[req.lang] - }) + await AppDataSource.getRepository(AuthorizationServerState).save(req.authorizationServerState); + return res.redirect(this.protectedEndpoint); } - } \ No newline at end of file diff --git a/wallet-enterprise-configurations/vid-issuer/datasets/vid_populate_dataset.py b/wallet-enterprise-configurations/vid-issuer/datasets/vid_populate_dataset.py new file mode 100644 index 0000000..63ef811 --- /dev/null +++ b/wallet-enterprise-configurations/vid-issuer/datasets/vid_populate_dataset.py @@ -0,0 +1,75 @@ +import pandas as pd +import json +import random +import string +import sys + +# Function to generate a random reference ID +def generate_random_id(k=10): + return int(''.join(random.choices(string.digits, k=k))) + + +def create_json_from_excel(excel_file_path): + # Read Excel file into pandas DataFrame + df = pd.read_excel(excel_file_path, sheet_name="PID", header=1) + + # Initialize list to store user data + users = [] + + # Iterate through each row in the DataFrame + for index, row in df.iterrows(): + print(row) + username = (row['email-adress'].split('@')[0]).lower() + password = username + uid = str(row['pid_id']) + personal_identifier = str(row['social_security_pin']) + first_name = row['given_name'] + family_name = row['family_name'] + birth_date = str(row['birth_date'].strftime('%Y-%m-%d')) + pid_expiry_date = str(row['pid_expiry_date']) + reference_id = str(generate_random_id()) + + # Construct user dictionary + user_data = { + "authentication": { + "username": username, + "password": password, + "uid": uid, + "personalIdentifier": personal_identifier + }, + "claims": { + "firstName": first_name, + "familyName": family_name, + "birthdate": birth_date, + "personalIdentifier": personal_identifier, + "referenceId": reference_id, + "validityPeriod": { + "startingDate": "2024-02-02", + "endingDate": pid_expiry_date + } + } + } + + # Append user data to the list + users.append(user_data) + df.at[index, 'personalIdentifier'] = personal_identifier + + # Construct final JSON structure + json_data = {"users": users} + + # Write JSON data to a file + output_file_path = excel_file_path.replace('.xlsx', '_output.json') + with open(output_file_path, 'w') as f: + json.dump(json_data, f, indent=4) + + df.to_excel(excel_file_path, index=False) + + print("JSON file created successfully at:", output_file_path) + +if __name__ == "__main__": + if len(sys.argv) != 2: + print("Usage: python script.py ") + sys.exit(1) + + excel_file_path = sys.argv[1] + create_json_from_excel(excel_file_path) From 39eccfa21ff2a0b5d3e6a20d4f828a4e034195f7 Mon Sep 17 00:00:00 2001 From: pstamatop Date: Thu, 5 Sep 2024 11:22:06 +0300 Subject: [PATCH 2/3] remove data entry scripts --- .../datasets/ehic_populate_dataset.py | 79 ---------- .../datasets/pda1_populate_dataset.py | 149 ------------------ .../datasets/vid_populate_dataset.py | 75 --------- 3 files changed, 303 deletions(-) delete mode 100644 wallet-enterprise-configurations/ehic-issuer/datasets/ehic_populate_dataset.py delete mode 100644 wallet-enterprise-configurations/pda1-issuer/datasets/pda1_populate_dataset.py delete mode 100644 wallet-enterprise-configurations/vid-issuer/datasets/vid_populate_dataset.py diff --git a/wallet-enterprise-configurations/ehic-issuer/datasets/ehic_populate_dataset.py b/wallet-enterprise-configurations/ehic-issuer/datasets/ehic_populate_dataset.py deleted file mode 100644 index 74ec2ad..0000000 --- a/wallet-enterprise-configurations/ehic-issuer/datasets/ehic_populate_dataset.py +++ /dev/null @@ -1,79 +0,0 @@ -import pandas as pd -import json -import random -import string -import sys - -def create_json_from_excel(excel_file_path): - # Read Excel file into pandas DataFrame - df = pd.read_excel(excel_file_path, sheet_name="EHIC", header=0) - # Initialize list to store user data - users = [] - - # Iterate through each row in the DataFrame - for index, row in df.iterrows(): - username = (row['email-adress'].split('@')[0]).lower() - password = username - uid = str(row['pid_id']) - personal_identifier = str(row['social_security_pin']) - first_name = row['given_name'] - family_name = row['family_name'] - ssn = str(row['social_security_pin']) - birth_date = str(row['birth_date'].strftime('%Y-%m-%d')) - documentId = str(int(row['ehic_card_identification_number'])) - startingDate = str(row['ehic_start_date']) - endingDate = str(row['ehic_end_date']) - competentInstitutionId = row['ehic_institution_id'] - competentInstitutionName = row['ehic_institution_name'] - competentInstitutionCountryCode = row['ehic_institution_country_code_'] - - - # Construct user dictionary - user_data = { - "authentication": { - "username": username, - "password": password, - "uid": uid, - "personalIdentifier": personal_identifier - }, - "claims": { - "firstName": first_name, - "familyName": family_name, - "birthdate": birth_date, - "personalIdentifier": personal_identifier, - "socialSecurityIdentification": { - "ssn": ssn - }, - "validityPeriod": { - "startingDate": startingDate, - "endingDate": endingDate - }, - "documentId": documentId, - "competentInstitution": { - "competentInstitutionId": competentInstitutionId, - "competentInstitutionName": competentInstitutionName, - "competentInstitutionCountryCode": competentInstitutionCountryCode - } - } - } - - # Append user data to the list - users.append(user_data) - - # Construct final JSON structure - json_data = {"users": users} - - # Write JSON data to a file - output_file_path = excel_file_path.replace('.xlsx', '_output.json') - with open(output_file_path, 'w') as f: - json.dump(json_data, f, indent=4) - - print("JSON file created successfully at:", output_file_path) - -if __name__ == "__main__": - if len(sys.argv) != 2: - print("Usage: python script.py ") - sys.exit(1) - - excel_file_path = sys.argv[1] - create_json_from_excel(excel_file_path) diff --git a/wallet-enterprise-configurations/pda1-issuer/datasets/pda1_populate_dataset.py b/wallet-enterprise-configurations/pda1-issuer/datasets/pda1_populate_dataset.py deleted file mode 100644 index 2bfa200..0000000 --- a/wallet-enterprise-configurations/pda1-issuer/datasets/pda1_populate_dataset.py +++ /dev/null @@ -1,149 +0,0 @@ -import pandas as pd -import json -import random -import string -import sys - -# Function to generate a random reference ID -def generate_document_id(): - return ''.join(random.choices(string.digits, k=20)) - -def create_json_from_excel(excel_file_path): - # Read Excel file into pandas DataFrame - df = pd.read_excel(excel_file_path, sheet_name="PDA1", header=0) - - # Initialize list to store user data - users = [] - - # Iterate through each row in the DataFrame - for index, row in df.iterrows(): - print(row) - username = (row['email-adress'].split('@')[0]).lower() - email = row['email-adress'] - password = username - uid = str(row['pid_id']) - first_name = row['given_name'] - family_name = row['family_name'] - personal_identifier = str(row['social_security_pin']) - - ssn = str(row['social_security_pin']) - birth_date = str(row['birth_date'].strftime('%Y-%m-%d')) - documentId = str(row['pda1_document_id']) - startingDate = str(row['pda1_starting_date']) - endingDate = str(row['pda1_ending_date']) - competentInstitutionId = row['pda1_institution_id'] - competentInstitutionName = row['pda1_institution_name'] - competentInstitutionCountryCode = row['pda1_institution_country_code_'] - - nationalityCode = row['nationality'] - employmentType = row['type_of_employment '] - name = row['pda1_name '] - employerId = row['pda1_employer_id'] - typeOfId = row['pda1_type_of_id'] - - street = row['pda1_employer_Street'] - town = row['pda1_employer_town'] - postalCode = str(row['pda1_employer_postal_code']) - countryCode = row['pda1_employer_country_ code'] - - pow_companyName = row['pda1_pow_company_name '] - # pow_flagBaseHomeState = row['pda1_flag_base_home_state'] - pow_companyId = row['pda1_pow_company_id'] - pow_typeOfId = row['pda1_pow_type_ of_id '] - pow_street = row['pda1_pow_employer_street'] - pow_town = row['pda1_pow_employer_town'] - pow_postalCode = str(row['pda1_pow_employer_postal_code']) - pow_countryCode = row['pda1_pow_employer_country_code'] - - memberStateWhoseLegislationIsToBeApplied = row['pda1_member_state'] - transitionalRulesApplyAsPerTheRegulation = row['pda1_transitional_rules'] - - statusCode = row['pda1_status_confirmation'] - - - # Construct user dictionary - user_data = { - "authentication": { - "username": username, - "password": password, - "uid": uid, - "personalIdentifier": personal_identifier, - "email": email - }, - "claims": { - "firstName": first_name, - "familyName": family_name, - "birthdate": birth_date, - "personalIdentifier": personal_identifier, - "socialSecurityIdentification": { - "ssn": ssn - }, - - "nationality": { - "nationalityCode": nationalityCode - }, - "employer": { - "employmentType": employmentType, - "name": name, - "employerId": employerId, - "typeOfId": typeOfId - }, - "address": { - "street": street, - "town": town, - "postalCode": postalCode, - "countryCode": countryCode - }, - "placeOfWork": { - "companyName": pow_companyName, - "flagBaseHomeState": "", - "companyId": pow_companyId, - "typeOfId": pow_typeOfId, - "street": pow_street, - "town": pow_town, - "postalCode": pow_postalCode, - "countryCode": pow_countryCode - }, - "decisionOnApplicableLegislation": { - "decisionOnMSWhoseLegislationApplies": { - "memberStateWhoseLegislationIsToBeApplied": memberStateWhoseLegislationIsToBeApplied, - "transitionalRulesApplyAsPerTheRegulation": transitionalRulesApplyAsPerTheRegulation - }, - "validityPeriod": { - "startingDate": startingDate, - "endingDate": endingDate - }, - }, - "statusConfirmation": { - "statusCode": statusCode - }, - "documentId": documentId, - "competentInstitution": { - "competentInstitutionId": competentInstitutionId, - "competentInstitutionName": competentInstitutionName, - "competentInstitutionCountryCode": competentInstitutionCountryCode - } - } - - } - - # Append user data to the list - users.append(user_data) - - # Construct final JSON structure - json_data = {"users": users} - - # Write JSON data to a file - output_file_path = excel_file_path.replace('.xlsx', '_output.json') - with open(output_file_path, 'w') as f: - json.dump(json_data, f, indent=4) - - print("JSON file created successfully at:", output_file_path) - -if __name__ == "__main__": - if len(sys.argv) != 2: - print("Usage: python script.py ") - sys.exit(1) - - excel_file_path = sys.argv[1] - create_json_from_excel(excel_file_path) diff --git a/wallet-enterprise-configurations/vid-issuer/datasets/vid_populate_dataset.py b/wallet-enterprise-configurations/vid-issuer/datasets/vid_populate_dataset.py deleted file mode 100644 index 63ef811..0000000 --- a/wallet-enterprise-configurations/vid-issuer/datasets/vid_populate_dataset.py +++ /dev/null @@ -1,75 +0,0 @@ -import pandas as pd -import json -import random -import string -import sys - -# Function to generate a random reference ID -def generate_random_id(k=10): - return int(''.join(random.choices(string.digits, k=k))) - - -def create_json_from_excel(excel_file_path): - # Read Excel file into pandas DataFrame - df = pd.read_excel(excel_file_path, sheet_name="PID", header=1) - - # Initialize list to store user data - users = [] - - # Iterate through each row in the DataFrame - for index, row in df.iterrows(): - print(row) - username = (row['email-adress'].split('@')[0]).lower() - password = username - uid = str(row['pid_id']) - personal_identifier = str(row['social_security_pin']) - first_name = row['given_name'] - family_name = row['family_name'] - birth_date = str(row['birth_date'].strftime('%Y-%m-%d')) - pid_expiry_date = str(row['pid_expiry_date']) - reference_id = str(generate_random_id()) - - # Construct user dictionary - user_data = { - "authentication": { - "username": username, - "password": password, - "uid": uid, - "personalIdentifier": personal_identifier - }, - "claims": { - "firstName": first_name, - "familyName": family_name, - "birthdate": birth_date, - "personalIdentifier": personal_identifier, - "referenceId": reference_id, - "validityPeriod": { - "startingDate": "2024-02-02", - "endingDate": pid_expiry_date - } - } - } - - # Append user data to the list - users.append(user_data) - df.at[index, 'personalIdentifier'] = personal_identifier - - # Construct final JSON structure - json_data = {"users": users} - - # Write JSON data to a file - output_file_path = excel_file_path.replace('.xlsx', '_output.json') - with open(output_file_path, 'w') as f: - json.dump(json_data, f, indent=4) - - df.to_excel(excel_file_path, index=False) - - print("JSON file created successfully at:", output_file_path) - -if __name__ == "__main__": - if len(sys.argv) != 2: - print("Usage: python script.py ") - sys.exit(1) - - excel_file_path = sys.argv[1] - create_json_from_excel(excel_file_path) From 7260c4e27996589b8de44773ee97f0c44dce4bf8 Mon Sep 17 00:00:00 2001 From: pstamatop Date: Thu, 5 Sep 2024 11:28:07 +0300 Subject: [PATCH 3/3] Hide PID presentation QR in PDA1 issuer --- .../authentication/VIDAuthenticationComponent.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/wallet-enterprise-configurations/pda1-issuer/src/configuration/authentication/VIDAuthenticationComponent.ts b/wallet-enterprise-configurations/pda1-issuer/src/configuration/authentication/VIDAuthenticationComponent.ts index 0b171ec..de17beb 100644 --- a/wallet-enterprise-configurations/pda1-issuer/src/configuration/authentication/VIDAuthenticationComponent.ts +++ b/wallet-enterprise-configurations/pda1-issuer/src/configuration/authentication/VIDAuthenticationComponent.ts @@ -143,8 +143,17 @@ export class VIDAuthenticationComponent extends AuthenticationComponent { lang: req.lang, locale: locale[req.lang] }); + } else { + return res.render('issuer/vid-auth-component', { + title: "VID authentication", + wwwalletURL: config.wwwalletURL, + authorizationRequestURL: url.toString(), + authorizationRequestQR: null, + state: url.searchParams.get('state'), + lang: req.lang, + locale: locale[req.lang] + }); } - return res.redirect(url.toString()); }