Simple API
Intuitive, composable middleware pattern that's easy to understand and use
Route and HTTP request protection through a composable middleware pattern
Install the library:
npm install ngxsmk-gatekeeperUse in your Angular app:
import { provideGatekeeper, gatekeeperGuard } from 'ngxsmk-gatekeeper';
import { createAuthMiddleware } from 'ngxsmk-gatekeeper/lib/middlewares';
export const appConfig: ApplicationConfig = {
providers: [
provideRouter(routes),
provideHttpClient(),
provideGatekeeper({
middlewares: [createAuthMiddleware()],
onFail: '/login',
}),
],
};Protect your routes:
const routes: Routes = [
{
path: 'dashboard',
component: DashboardComponent,
canActivate: [gatekeeperGuard],
},
];Angular applications often need to protect routes and HTTP requests based on authentication, authorization, feature flags, or other business logic. ngxsmk-gatekeeper provides:
ngxsmk-gatekeeper is 100% open source and completely free to use. All features are available without any restrictions: