@hemia/auth-sdk 0.0.12 → 0.0.13

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.
@@ -143,7 +143,8 @@ let AuthService = class AuthService {
143
143
  state: state,
144
144
  code_challenge: codeChallenge,
145
145
  code_challenge_method: 'S256',
146
- auto: auto
146
+ auto: auto,
147
+ aud: this.config.aud || ''
147
148
  });
148
149
  const loginUrl = `${this.config.ssoBaseUrl}${this.config.ssoAuthUrl}?${params.toString()}`;
149
150
  const tempState = {
@@ -262,7 +263,10 @@ let AuthService = class AuthService {
262
263
  }
263
264
  }
264
265
  try {
265
- const verify = this.jwtManager.verify(session.accessToken);
266
+ const verify = this.jwtManager.verify(session.accessToken, this.config.clientSecret, {
267
+ issuer: this.config.iss,
268
+ audience: this.config.aud
269
+ });
266
270
  if (!verify) {
267
271
  throw new SessionInvalidError();
268
272
  }
@@ -350,7 +354,8 @@ let AuthService = class AuthService {
350
354
  clientId: this.config.clientId,
351
355
  clientSecret: this.config.clientSecret,
352
356
  refreshToken: session.refreshToken,
353
- sessionId: session.sessionId
357
+ sessionId: session.sessionId,
358
+ aud: this.config.aud || ''
354
359
  });
355
360
  if (response.status !== 200) {
356
361
  throw new CustomHttpError('Token refresh failed', response.status, 'token_refresh_failed');
@@ -145,7 +145,8 @@ exports.AuthService = class AuthService {
145
145
  state: state,
146
146
  code_challenge: codeChallenge,
147
147
  code_challenge_method: 'S256',
148
- auto: auto
148
+ auto: auto,
149
+ aud: this.config.aud || ''
149
150
  });
150
151
  const loginUrl = `${this.config.ssoBaseUrl}${this.config.ssoAuthUrl}?${params.toString()}`;
151
152
  const tempState = {
@@ -264,7 +265,10 @@ exports.AuthService = class AuthService {
264
265
  }
265
266
  }
266
267
  try {
267
- const verify = this.jwtManager.verify(session.accessToken);
268
+ const verify = this.jwtManager.verify(session.accessToken, this.config.clientSecret, {
269
+ issuer: this.config.iss,
270
+ audience: this.config.aud
271
+ });
268
272
  if (!verify) {
269
273
  throw new SessionInvalidError();
270
274
  }
@@ -352,7 +356,8 @@ exports.AuthService = class AuthService {
352
356
  clientId: this.config.clientId,
353
357
  clientSecret: this.config.clientSecret,
354
358
  refreshToken: session.refreshToken,
355
- sessionId: session.sessionId
359
+ sessionId: session.sessionId,
360
+ aud: this.config.aud || ''
356
361
  });
357
362
  if (response.status !== 200) {
358
363
  throw new common.CustomHttpError('Token refresh failed', response.status, 'token_refresh_failed');
@@ -9,4 +9,6 @@ export interface IAuthConfig {
9
9
  uiBaseUrl?: string;
10
10
  cookieDomain?: string;
11
11
  isProduction: boolean;
12
+ iss?: string;
13
+ aud?: string;
12
14
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hemia/auth-sdk",
3
- "version": "0.0.12",
3
+ "version": "0.0.13",
4
4
  "description": "Hemia SDK for authentication",
5
5
  "main": "dist/hemia-auth-sdk.js",
6
6
  "module": "dist/hemia-auth-sdk.esm.js",
@@ -16,8 +16,8 @@
16
16
  },
17
17
  "devDependencies": {
18
18
  "@hemia/cache-manager": "^0.0.5",
19
- "@hemia/common": "^0.0.12",
20
- "@hemia/jwt-manager": "^0.0.4",
19
+ "@hemia/common": "^0.0.14",
20
+ "@hemia/jwt-manager": "^0.0.6",
21
21
  "@hemia/network-services": "^0.0.3",
22
22
  "@rollup/plugin-commonjs": "^26.0.1",
23
23
  "@rollup/plugin-json": "^6.1.0",
@@ -44,8 +44,8 @@
44
44
  ],
45
45
  "peerDependencies": {
46
46
  "@hemia/cache-manager": "^0.0.5",
47
- "@hemia/common": "^0.0.12",
48
- "@hemia/jwt-manager": "^0.0.5",
47
+ "@hemia/common": "^0.0.14",
48
+ "@hemia/jwt-manager": "^0.0.6",
49
49
  "@hemia/network-services": "^0.0.3",
50
50
  "inversify": "^7.11.0",
51
51
  "reflect-metadata": "^0.2.2"