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

Replace old authentication components #95

Merged
merged 1 commit into from
Oct 16, 2024
Merged

Conversation

kkmanos
Copy link
Member

@kkmanos kkmanos commented Oct 15, 2024

Utilize the configurable authentication component templates implemented in wallet-enterprise

This PR provides an easy way to re-use the Local & VID authentication components by creating a generic authentication component for each of the methods, providing only a configuration in JSON format.

Example in diploma-issuer:

export const authChain = new AuthenticationChainBuilder()
	.addAuthenticationComponent(new AuthenticationMethodSelectionComponent("auth-method", CONSENT_ENTRYPOINT))
	.addAuthenticationComponent(new GenericVIDAuthenticationComponent("vid-auth", CONSENT_ENTRYPOINT, {
		"document_number": { input_descriptor_constraint_field_name: "Document Number", parser: (val: any) => String(val) },
	}))
	.addAuthenticationComponent(new GenericLocalAuthenticationComponent("1-local", CONSENT_ENTRYPOINT, {
		"document_number": { datasetColumnName: "vid_document_number", parser: (val: any) => String(val) },
	},
		async () => parseDiplomaData(path.join(__dirname, "../../../../dataset/" + datasetName)) as any[],
		[{ username: "john", password: "secret" }, { username: "emily", password: "secret" }]
	))
	.addAuthenticationComponent(new InspectPersonalInfoComponent("2-ediplomas", CONSENT_ENTRYPOINT))
	.build();

In the GenericVIDAuthenticationComponent the third argument is a JSON object where the keys are the database columns in which the authentication component will map the value received from the presentation in the field name "Document Number".

Similarly for the GenericLocalAuthenticationComponent, but in this case we need to give the authentication component the specific column name from the excel dataset to extract the value.

The forth argument in the GenericLocalAuthenticationComponent is the dataset provider which is a callback function that will be called everytime the authentication components wants to access the dataset.

The fifth argument of GenericLocalAuthenticationComponent is the default accounts that can be used by everyone from the dropdown menu.

Depends on:

@gkatrakazas gkatrakazas self-requested a review October 16, 2024 07:37
@kkmanos kkmanos merged commit 4fb3d9d into master Oct 16, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants