okta-oidc-js icon indicating copy to clipboard operation
okta-oidc-js copied to clipboard

okta-angular: Implement CanLoad in OktaAuthGuard to be able to guard lazy loaded routes

Open jschwarty opened this issue 6 years ago • 2 comments

Feature request

To block a lazy loaded route from being loaded in Angular, a guard can be used for the canLoad route entry property:

{
  path: 'admin-tools',
  loadChildren: './admin-tools/admin-tools.module#AdminToolsModule',
  canLoad: [MyCanLoadGuard],
}

This will stop the bundle from being loaded by the browser if the canLoad returns false.

Can the OktaAuthGuard get updated (or a new class created) to implement CanLoad?

jschwarty avatar Mar 20 '18 22:03 jschwarty

I too facing the same issue, i need to block the lazy loaded modules as canLoad is not available in OktaAuthGuard Should we have to override the method in OktaAuthGuard or should we need to create the class with canLoad ?

hemantha87 avatar Nov 11 '20 10:11 hemantha87

internal ref: OKTA-408692

aarongranick-okta avatar Jun 30 '21 17:06 aarongranick-okta