@cloudbase/oauth 2.0.0-beta.0 → 2.4.0-alpha.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/oauth",
3
- "version": "2.0.0-beta.0",
3
+ "version": "2.4.0-alpha.0",
4
4
  "description": "cloudbase javascript sdk auth componets",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -27,5 +27,5 @@
27
27
  "rimraf": "^3.0.0",
28
28
  "typescript": "^3.8.3"
29
29
  },
30
- "gitHead": "c462902b6702463670d27acb88ebccf93dbd51cd"
30
+ "gitHead": "060aa0783ef4e68ffc49db6fb7944559d1b10106"
31
31
  }
package/src/auth/apis.ts CHANGED
@@ -630,6 +630,10 @@ export class Auth {
630
630
  return this._config.credentialsClient.getScope()
631
631
  }
632
632
 
633
+ public async loginGroups(): Promise<string[]> {
634
+ return this._config.credentialsClient.getGroups()
635
+ }
636
+
633
637
  private static parseParamsToSearch(params: any): string {
634
638
  for (let key in params) {
635
639
  if (!params[key]) {
@@ -10,6 +10,7 @@ export interface Credentials {
10
10
  expires_in?: number | null;
11
11
  expires_at?: Date | null;
12
12
  sub?: string | null;
13
+ groups?: string[] | null;
13
14
  }
14
15
 
15
16
  /** An Error For all concern **/
@@ -585,6 +585,13 @@ export class OAuth2Client implements AuthClient {
585
585
  return credentials.scope;
586
586
  }
587
587
 
588
+ public async getGroups(): Promise<string[]> {
589
+ let credentials: Credentials = await this._localCredentials.getCredentials();
590
+ if (credentials == null) {
591
+ return this._unAuthenticatedError("credentials not found")
592
+ }
593
+ return credentials.groups;
594
+ }
588
595
 
589
596
 
590
597
  /**