@studiohyperdrive/ngx-auth
Version:
A library of core authentication functionality used with @studiohyperdrive/types-auth.
38 lines (37 loc) • 1.34 kB
TypeScript
import { Route } from '@angular/router';
/**
* An interface for the routes used in an application that has uses the NgxAuthenticationAbstractService
*/
export interface NgxAuthenticatedRoute<FeatureType extends string = string, PermissionType extends string = string> extends Route {
data?: {
/**
* The features for the NgxHasFeatureGuard
*/
feature?: FeatureType | FeatureType[];
/**
* Whether all features should be provided, by default true, for the NgxHasFeatureGuard
*/
shouldHaveAllFeatures?: boolean;
/**
* The permissions for the NgxHasPermissionGuard
*/
permission?: PermissionType | PermissionType[];
/**
* Whether all permissions should be provided, by default true, for the NgxHasPermissionGuard
*/
shouldHaveAllPermissions?: boolean;
/**
* Whether the user should be authenticated, for the NgxIsAuthenticatedGuard
*/
shouldBeAuthenticated?: boolean;
/**
* The location to redirect to if one of the guards conditions isn't met
*/
redirect?: string[];
/**
* Remaining additional properties
*/
[key: string]: unknown;
};
}
export type NgxAuthenticatedRoutes = NgxAuthenticatedRoute[];