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/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 6de4aea..d49396e 100644 --- a/wallet-enterprise-configurations/ehic-issuer/src/configuration/authentication/VIDAuthenticationComponent.ts +++ b/wallet-enterprise-configurations/ehic-issuer/src/configuration/authentication/VIDAuthenticationComponent.ts @@ -178,8 +178,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/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/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()); }