Scaffold libs/ui (NL Design System via Utrecht components) and libs/auth (DigiD OIDC over angular-auth-oidc-client: mockable AuthService, provider, token interceptor, authenticated guard). Failing component + axe tests for the RegistrationPage: it must show the signed-in BSN, submit to the BFF (mocked api-client) and confirm, with no WCAG 2.1 AA violations. The page is a stub, so the behaviour tests fail; green follows. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
14 lines
404 B
TypeScript
14 lines
404 B
TypeScript
import { inject } from '@angular/core';
|
|
import { CanActivateFn } from '@angular/router';
|
|
import { AuthService } from './auth.service';
|
|
|
|
/** Allow the route only when a DigiD session is active; otherwise start the login. */
|
|
export const authenticatedGuard: CanActivateFn = () => {
|
|
const auth = inject(AuthService);
|
|
if (auth.isAuthenticated()) {
|
|
return true;
|
|
}
|
|
auth.login();
|
|
return false;
|
|
};
|