π
#angular #guard #keycloak #mapToCanActivate
π© > Angular v16
Add the guard function to your routeβs canActivate property.
β οΈ Using mapToCanActivate Helper
If youβre not ready to fully migrate to functional guards, Angular 16 provides a helper function,
β Article link: https://medium.com/@kapincev/migrating-keycloakauthguard-to-angular-16-functional-guards-01bf2a20fc09
KeycloakAuthGuard in Angular#angular #guard #keycloak #mapToCanActivate
π© > Angular v16
Add the guard function to your routeβs canActivate property.
// In your routing module
{
path: 'protected-route',
canActivate: [keycloakFunctionalGuard],
component: ProtectedComponent
}
β οΈ Using mapToCanActivate Helper
If youβre not ready to fully migrate to functional guards, Angular 16 provides a helper function,
mapToCanActivate, that allows you to continue using your class-based guards.{
path: 'protected-route',
canActivate: mapToCanActivate([wrappedAuthGuard]),
component: ProtectedComponent
}β Article link: https://medium.com/@kapincev/migrating-keycloakauthguard-to-angular-16-functional-guards-01bf2a20fc09
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
π1