attlaz-client 1.13.10 → 1.13.12
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.
|
@@ -4,7 +4,7 @@ export class CodeSourceAccount {
|
|
|
4
4
|
key;
|
|
5
5
|
name;
|
|
6
6
|
userId;
|
|
7
|
-
|
|
7
|
+
workspaceId;
|
|
8
8
|
type;
|
|
9
9
|
// public access_token: string;
|
|
10
10
|
// public refresh_token: string;
|
|
@@ -16,7 +16,7 @@ export class CodeSourceAccount {
|
|
|
16
16
|
sourcesAccount.key = rawSourcesAccount.key;
|
|
17
17
|
sourcesAccount.name = rawSourcesAccount.name;
|
|
18
18
|
sourcesAccount.userId = rawSourcesAccount.user;
|
|
19
|
-
|
|
19
|
+
sourcesAccount.workspaceId = rawSourcesAccount.workspace;
|
|
20
20
|
sourcesAccount.type = rawSourcesAccount.type;
|
|
21
21
|
// sourcesAccount.access_token = rawSourcesAccount.access_token;
|
|
22
22
|
// sourcesAccount.refresh_token = rawSourcesAccount.refresh_token;
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import { UserAuthProvider } from '../Model/User/UserAuthProvider.js';
|
|
2
|
-
import { OAuthClientToken } from '../Http/OAuthClientToken.js';
|
|
3
2
|
import { Endpoint } from './Endpoint.js';
|
|
4
3
|
import { User } from '../Model/User.js';
|
|
5
4
|
import { CollectionResult } from '../Model/Result/CollectionResult.js';
|
|
6
5
|
export declare class UserEndpoint extends Endpoint {
|
|
7
6
|
getUser(): Promise<User | null>;
|
|
8
|
-
authenticateByAuthProvider(providerType: string, data: {
|
|
9
|
-
code: string;
|
|
10
|
-
state: string;
|
|
11
|
-
}): Promise<OAuthClientToken>;
|
|
12
7
|
createAuthProvider(providerType: string, data: {
|
|
13
8
|
code: string;
|
|
14
9
|
state: string;
|
|
@@ -1,40 +1,12 @@
|
|
|
1
1
|
import { UserAuthProvider } from '../Model/User/UserAuthProvider.js';
|
|
2
|
-
import { OAuthClientToken } from '../Http/OAuthClientToken.js';
|
|
3
2
|
import { Endpoint } from './Endpoint.js';
|
|
4
3
|
import { User } from '../Model/User.js';
|
|
5
|
-
import { Utils } from '../Utils.js';
|
|
6
4
|
export class UserEndpoint extends Endpoint {
|
|
7
5
|
async getUser() {
|
|
8
6
|
const cmd = '/users';
|
|
9
7
|
const rawUser = await this.requestObject(cmd, null, User.parse);
|
|
10
8
|
return rawUser.getData();
|
|
11
9
|
}
|
|
12
|
-
async authenticateByAuthProvider(providerType, data) {
|
|
13
|
-
try {
|
|
14
|
-
const parser = (raw) => {
|
|
15
|
-
const { access_token } = raw;
|
|
16
|
-
const { token_type } = raw;
|
|
17
|
-
const { refresh_token } = raw;
|
|
18
|
-
const { scope } = raw;
|
|
19
|
-
const token = new OAuthClientToken(access_token, token_type, refresh_token, scope);
|
|
20
|
-
token.expires = Utils.parseRawDate(raw.expires);
|
|
21
|
-
return token;
|
|
22
|
-
};
|
|
23
|
-
const result = await this.requestObject('/auth/providers/' + providerType, data, parser, 'POST', false);
|
|
24
|
-
const token = result.getData();
|
|
25
|
-
if (token === null) {
|
|
26
|
-
console.log('auth by auth provider wrong data', { result, parsed: token });
|
|
27
|
-
throw new Error('Unable to authenticate by auth provider: wrong response from API');
|
|
28
|
-
}
|
|
29
|
-
return token;
|
|
30
|
-
}
|
|
31
|
-
catch (e) {
|
|
32
|
-
if (this.httpClient.isDebugEnabled()) {
|
|
33
|
-
console.error('Failed to perform social auth: ', e);
|
|
34
|
-
}
|
|
35
|
-
throw e;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
10
|
async createAuthProvider(providerType, data) {
|
|
39
11
|
try {
|
|
40
12
|
const parser = (raw) => raw;
|