attlaz-client 1.13.12 → 1.13.14
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/dist/Http/OAuthClient.js
CHANGED
|
@@ -177,7 +177,14 @@ export class OAuthClient {
|
|
|
177
177
|
return typeof process !== 'undefined' && process.versions != null && process.versions.node != null;
|
|
178
178
|
}
|
|
179
179
|
tokenToOauthClientToken(oauthToken) {
|
|
180
|
-
|
|
180
|
+
let scopes = '';
|
|
181
|
+
if (Object.prototype.hasOwnProperty.call(oauthToken.data, 'scopes')) {
|
|
182
|
+
scopes = oauthToken.data.scopes;
|
|
183
|
+
}
|
|
184
|
+
else if (Object.prototype.hasOwnProperty.call(oauthToken.data, 'scope')) {
|
|
185
|
+
scopes = oauthToken.data.scope;
|
|
186
|
+
}
|
|
187
|
+
const token = new OAuthClientToken(oauthToken.accessToken, oauthToken.tokenType, oauthToken.refreshToken, scopes);
|
|
181
188
|
const rawTokenExpires = oauthToken.expires;
|
|
182
189
|
if (rawTokenExpires !== null && rawTokenExpires !== undefined) {
|
|
183
190
|
token.expires = rawTokenExpires;
|
|
@@ -4,10 +4,6 @@ import { User } from '../Model/User.js';
|
|
|
4
4
|
import { CollectionResult } from '../Model/Result/CollectionResult.js';
|
|
5
5
|
export declare class UserEndpoint extends Endpoint {
|
|
6
6
|
getUser(): Promise<User | null>;
|
|
7
|
-
createAuthProvider(providerType: string, data: {
|
|
8
|
-
code: string;
|
|
9
|
-
state: string;
|
|
10
|
-
}): Promise<boolean>;
|
|
11
7
|
removeAuthProvider(providerId: number): Promise<boolean>;
|
|
12
8
|
getAuthProviders(): Promise<CollectionResult<UserAuthProvider>>;
|
|
13
9
|
getPermissions(): Promise<CollectionResult<{
|
|
@@ -7,26 +7,27 @@ export class UserEndpoint extends Endpoint {
|
|
|
7
7
|
const rawUser = await this.requestObject(cmd, null, User.parse);
|
|
8
8
|
return rawUser.getData();
|
|
9
9
|
}
|
|
10
|
-
async createAuthProvider(providerType, data) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
10
|
+
// public async createAuthProvider(providerType: string, data: { code: string; state: string }): Promise<boolean> {
|
|
11
|
+
// try {
|
|
12
|
+
// const parser = (raw: any): { created: boolean } => raw;
|
|
13
|
+
// const result: ObjectResult<{
|
|
14
|
+
// created: boolean
|
|
15
|
+
// }> = await this.requestObject('/users/auth/providers', {
|
|
16
|
+
// provider_type: providerType, code: data.code, state: data.state
|
|
17
|
+
// }, parser, 'POST');
|
|
18
|
+
// const re: { created: boolean } | null = result.getData();
|
|
19
|
+
// if (re === null) {
|
|
20
|
+
// console.log('create auth provider wrong data', {result, parsed: re});
|
|
21
|
+
// throw new Error('Unable to create auth provider: wrong response from API');
|
|
22
|
+
// }
|
|
23
|
+
// return re.created;
|
|
24
|
+
// } catch (e) {
|
|
25
|
+
// if (this.httpClient.isDebugEnabled()) {
|
|
26
|
+
// console.error('Failed to assign auth provider: ', e);
|
|
27
|
+
// }
|
|
28
|
+
// throw e;
|
|
29
|
+
// }
|
|
30
|
+
// }
|
|
30
31
|
async removeAuthProvider(providerId) {
|
|
31
32
|
try {
|
|
32
33
|
const parser = (raw) => ({ deleted: raw.deleted });
|