@annalib/anna-cognito-lib 2.0.12 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,6 +14,7 @@ export declare class LoginComponent implements OnInit {
14
14
  ngOnInit(): void;
15
15
  onIntialiseForm(): void;
16
16
  OnLogin(): void;
17
+ signInWithOKTA(): void;
17
18
  static ɵfac: i0.ɵɵFactoryDeclaration<LoginComponent, never>;
18
19
  static ɵcmp: i0.ɵɵComponentDeclaration<LoginComponent, "anna-cognito-lib-login", never, {}, {}, never, never, false, never>;
19
20
  }
@@ -13,4 +13,5 @@ export interface IAuthService {
13
13
  sendRegenerationEmail(userCode: string): void;
14
14
  onPasswordUpdate(userName: string): void;
15
15
  newPasswordSetThenUpdateToBackend(userCode: string): void;
16
+ signInWithOKTA(): void;
16
17
  }
@@ -1,10 +1,9 @@
1
1
  import { HttpClient } from "@angular/common/http";
2
2
  import { Router } from "@angular/router";
3
- import { AuthenticationDetails, CognitoUser, CognitoUserPool, CognitoUserSession } from "amazon-cognito-identity-js";
3
+ import { AuthTokens, SignInInput } from "aws-amplify/auth";
4
4
  import { ToastrService } from 'ngx-toastr';
5
5
  import { IAuthService } from '../config/auth-service.token';
6
6
  import { IConfigService } from '../config/config-service.token';
7
- import { UserPoolInformation } from "../models/auth.model";
8
7
  import { AnnaLibAclService } from './acl.service';
9
8
  import * as i0 from "@angular/core";
10
9
  export declare class AnnaLibAuthService {
@@ -14,13 +13,8 @@ export declare class AnnaLibAuthService {
14
13
  private toastr;
15
14
  consumingProjectAuthService: IAuthService;
16
15
  consumingProjectConfigService: IConfigService;
17
- poolData: UserPoolInformation;
18
- userPool: CognitoUserPool;
19
- cognitoUser: CognitoUser;
20
- authenticationDetails: AuthenticationDetails;
21
- tokenValid: boolean;
22
16
  accessToken: string;
23
- userAttribute: any;
17
+ IdToken: any;
24
18
  loginErrorMessage: string | null;
25
19
  setNewPasswordErrorMessage: string;
26
20
  setNewPasswordButtonMessage: string;
@@ -31,32 +25,27 @@ export declare class AnnaLibAuthService {
31
25
  sessionLocked: boolean;
32
26
  userName: any;
33
27
  accessTokenTimerId: any;
34
- IdToken: any;
35
28
  forgotPasswordAndGlobalSignoutLoader: boolean;
29
+ userPassword: any;
36
30
  constructor(router: Router, aclService: AnnaLibAclService, httpClient: HttpClient, toastr: ToastrService, consumingProjectAuthService: IAuthService, consumingProjectConfigService: IConfigService);
37
31
  ngOnInit(): void;
38
- /***
39
- 1. takes user pool data (userPool ID and client ID)
40
- 2. if current user is null then it means user already logged out then simply return Promise<false>
41
- 3. if current user present check if token is valid for it.
42
- */
43
32
  isUserLoggedIn(): Promise<boolean>;
44
33
  sessionTimeout(): void;
45
- refreshAccessToken(): void;
46
34
  computeTokenExpiration(token: any): number;
47
- getCurrentUserDetails(): CognitoUser;
48
- getCognitoUserDetails(email: string): CognitoUser;
49
- authenticate(email: string, password: string): void;
50
- CognitoAuthentication(authenticationDetails: AuthenticationDetails): void;
51
- setNewPassword(newPassword: any): void;
52
- onForgotPasswordGenerateOTP(email: string): void;
53
- verifyCode(verificationCode: string, newPassword: string): void;
35
+ getCurrentSession(): Promise<any>;
36
+ handleSignIn({ username, password }: SignInInput): Promise<void>;
37
+ getAllCognitoTokenAndGroups(token: AuthTokens): Promise<void>;
38
+ refreshAccessToken(): void;
39
+ changePassword(newPassword: string): Promise<void>;
40
+ onForgotPasswordGenerateOTP(email: string): Promise<void>;
41
+ verifyCode(confirmationCode: string, newPassword: string): Promise<void>;
54
42
  forgotPasswordError(err: any, noOfAttempts: number): string;
55
- getAllCognitoTokenAndGroups(token: CognitoUserSession): void;
56
- expiryAllExistingCurrentSession(newPassword: string): void;
57
- setUserDetails(username: string, newPassword: string): void;
58
- onLoginInCogntioToGetAccessToken(): void;
59
- onCallGlobalSignout(): void;
43
+ signInWithOKTA(): void;
44
+ handleSignOut(): Promise<void>;
45
+ expiryAllExistingCurrentSession(username: string, newPassword: string): void;
46
+ setUserDetails(): void;
47
+ onLoginInCogntioToGetAccessToken(username: string, password: string): Promise<void>;
48
+ onCallGlobalSignout(): Promise<void>;
60
49
  static ɵfac: i0.ɵɵFactoryDeclaration<AnnaLibAuthService, never>;
61
50
  static ɵprov: i0.ɵɵInjectableDeclaration<AnnaLibAuthService>;
62
51
  }
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "@annalib/anna-cognito-lib",
3
- "version": "2.0.12",
3
+ "version": "2.1.0",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^15.2.9",
6
6
  "@angular/core": "^15.2.9",
7
7
  "@mdi/font": "^5.9.55",
8
8
  "@ng-bootstrap/ng-bootstrap": "^14.1.1",
9
9
  "@types/node": "^12.11.1",
10
- "amazon-cognito-identity-js": "^4.5.3",
10
+ "@aws-amplify/ui-angular": "^5.0.2",
11
+ "aws-amplify": "^6.0.4",
11
12
  "bootstrap": "^5.2.3",
12
13
  "ngx-toastr": "^15.2.2"
13
14
  },