NARIK
Search…
10.-Authentication-and-Authorization-Service

Authentication Service

Narik Authentication Service helps you to do everything related to Authentication.
1
export abstract class AuthenticationService {
2
/**
3
* Current user value of authentication service
4
*/
5
readonly currentUserValue: ApplicationUser;
6
7
/**
8
* Current user of authentication service
9
*
10
* An `Observable` that emit whenever currentUser changed.
11
*/
12
readonly currentUser: Observable<ApplicationUser>;
13
14
/**
15
* Logins authentication service
16
* @param loginmodel Information needed for login
17
* @returns login
18
*/
19
abstract login(loginmodel: LoginModel): Promise<LoginResult>;
20
21
22
/**
23
* Logouts authentication service
24
* @returns logout
25
*/
26
abstract logout(): Promise<boolean>;
27
28
29
/**
30
* Refreshs authentication service
31
* @returns refresh
32
*/
33
abstract refresh(): Promise<ApplicationUser>;
34
}
Copied!
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.
1
NarikJwtAuthenticationModule.forRoot({
2
loginEndPoint: "api/account/Authenticate",
3
logoutEndPoint: "api/account/Logout",
4
refreshEndPoint: "api/account/Authenticate",
5
tokenStorage: "localStorage",
6
loginPageUrl: "/"
7
})
Copied!
If you want, You can extend AuthenticationService and use your own AuthenticationService.

Authorization Service

Narik Authorization Service is under development.
Last modified 7mo ago