NARIK
Search
K
Comment on page

10.-Authentication-and-Authorization-Service

Authentication Service

Narik Authentication Service helps you to do everything related to Authentication.
export abstract class AuthenticationService {
/**
* Current user value of authentication service
*/
readonly currentUserValue: ApplicationUser;
/**
* Current user of authentication service
*
* An `Observable` that emit whenever currentUser changed.
*/
readonly currentUser: Observable<ApplicationUser>;
/**
* Logins authentication service
* @param loginmodel Information needed for login
* @returns login
*/
abstract login(loginmodel: LoginModel): Promise<LoginResult>;
/**
* Logouts authentication service
* @returns logout
*/
abstract logout(): Promise<boolean>;
/**
* Refreshs authentication service
* @returns refresh
*/
abstract refresh(): Promise<ApplicationUser>;
}
Currently Narik created NarikJwtAuthentication. a Authentication Service based on JWT. This service is in narik-jwt-authentication. To use it you should import it on your module.
NarikJwtAuthenticationModule.forRoot({
loginEndPoint: "api/account/Authenticate",
logoutEndPoint: "api/account/Logout",
refreshEndPoint: "api/account/Authenticate",
tokenStorage: "localStorage",
loginPageUrl: "/"
})
If you want, You can extend AuthenticationService and use your own AuthenticationService.

Authorization Service

Narik Authorization Service is under development.