@ts-core/oauth 3.0.2 → 3.0.3
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/cjs/OAuthBase.d.ts +4 -2
- package/cjs/go/GoOAuth.d.ts +2 -0
- package/cjs/go/GoOAuth.js +4 -1
- package/cjs/go/GoUser.d.ts +2 -0
- package/cjs/go/GoUser.js +2 -0
- package/cjs/ya/YaOAuth.js +6 -1
- package/cjs/ya/YaUser.d.ts +6 -0
- package/cjs/ya/YaUser.js +6 -0
- package/esm/OAuthBase.d.ts +4 -2
- package/esm/go/GoOAuth.d.ts +2 -0
- package/esm/go/GoOAuth.js +4 -1
- package/esm/go/GoUser.d.ts +2 -0
- package/esm/go/GoUser.js +2 -0
- package/esm/ya/YaOAuth.js +6 -1
- package/esm/ya/YaUser.d.ts +6 -0
- package/esm/ya/YaUser.js +6 -0
- package/package.json +1 -1
package/cjs/OAuthBase.d.ts
CHANGED
|
@@ -34,10 +34,12 @@ export interface IOAuthPopUpDto {
|
|
|
34
34
|
oAuthError: string;
|
|
35
35
|
}
|
|
36
36
|
export interface IOAuthToken {
|
|
37
|
-
type?: string;
|
|
38
37
|
state?: string;
|
|
39
38
|
scope?: string;
|
|
40
|
-
userId
|
|
39
|
+
userId?: number;
|
|
40
|
+
tokenType?: string;
|
|
41
|
+
idToken?: string;
|
|
42
|
+
refreshToken?: string;
|
|
41
43
|
expiresIn: number;
|
|
42
44
|
accessToken: string;
|
|
43
45
|
}
|
package/cjs/go/GoOAuth.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { GoUser } from './GoUser';
|
|
2
2
|
import { IOAuthDto, IOAuthToken, OAuthBase } from '../OAuthBase';
|
|
3
|
+
import { ILogger } from '@ts-core/common';
|
|
3
4
|
export declare class GoOAuth<T extends GoUser = GoUser> extends OAuthBase<T> {
|
|
5
|
+
constructor(logger: ILogger, window: Window, applicationId: string, scope: string);
|
|
4
6
|
protected getAuthUrl(): string;
|
|
5
7
|
getProfile(token: string): Promise<T>;
|
|
6
8
|
getTokenByCode(dto: IOAuthDto, secret: string): Promise<IOAuthToken>;
|
package/cjs/go/GoOAuth.js
CHANGED
|
@@ -14,6 +14,9 @@ const _ = require("lodash");
|
|
|
14
14
|
const GoUser_1 = require("./GoUser");
|
|
15
15
|
const OAuthBase_1 = require("../OAuthBase");
|
|
16
16
|
class GoOAuth extends OAuthBase_1.OAuthBase {
|
|
17
|
+
constructor(logger, window, applicationId, scope) {
|
|
18
|
+
super(logger, window, applicationId, scope);
|
|
19
|
+
}
|
|
17
20
|
getAuthUrl() {
|
|
18
21
|
let params = new URLSearchParams();
|
|
19
22
|
params.append('display', 'popup');
|
|
@@ -43,7 +46,7 @@ class GoOAuth extends OAuthBase_1.OAuthBase {
|
|
|
43
46
|
grant_type: 'authorization_code'
|
|
44
47
|
}
|
|
45
48
|
});
|
|
46
|
-
return {
|
|
49
|
+
return { idToken: item.id_token, tokenType: item.token_type, expiresIn: item.expires_in, accessToken: item.access_token, scope: item.scope };
|
|
47
50
|
});
|
|
48
51
|
}
|
|
49
52
|
}
|
package/cjs/go/GoUser.d.ts
CHANGED
package/cjs/go/GoUser.js
CHANGED
package/cjs/ya/YaOAuth.js
CHANGED
|
@@ -45,7 +45,12 @@ class YaOAuth extends OAuthBase_1.OAuthBase {
|
|
|
45
45
|
client_secret: secret,
|
|
46
46
|
grant_type: 'authorization_code'
|
|
47
47
|
});
|
|
48
|
-
return {
|
|
48
|
+
return {
|
|
49
|
+
tokenType: data.token_type,
|
|
50
|
+
expiresIn: data.expires_in,
|
|
51
|
+
accessToken: data.access_token,
|
|
52
|
+
refreshToken: data.refresh_token,
|
|
53
|
+
};
|
|
49
54
|
});
|
|
50
55
|
}
|
|
51
56
|
}
|
package/cjs/ya/YaUser.d.ts
CHANGED
package/cjs/ya/YaUser.js
CHANGED
|
@@ -7,8 +7,14 @@ class YaUser extends OAuthUser_1.OAuthUser {
|
|
|
7
7
|
parse(item) {
|
|
8
8
|
this.id = item.id;
|
|
9
9
|
this.name = item.display_name;
|
|
10
|
+
this.login = item.login;
|
|
11
|
+
this.psuid = item.psuid;
|
|
10
12
|
this.email = item.default_email;
|
|
11
13
|
this.phone = _.get(item, 'default_phone.number');
|
|
14
|
+
this.emails = item.emails;
|
|
15
|
+
this.clientId = item.client_id;
|
|
16
|
+
this.realName = item.real_name;
|
|
17
|
+
this.displayName = item.display_name;
|
|
12
18
|
if (!_.isNil(item.sex)) {
|
|
13
19
|
this.isMale = item.sex === 'male';
|
|
14
20
|
}
|
package/esm/OAuthBase.d.ts
CHANGED
|
@@ -34,10 +34,12 @@ export interface IOAuthPopUpDto {
|
|
|
34
34
|
oAuthError: string;
|
|
35
35
|
}
|
|
36
36
|
export interface IOAuthToken {
|
|
37
|
-
type?: string;
|
|
38
37
|
state?: string;
|
|
39
38
|
scope?: string;
|
|
40
|
-
userId
|
|
39
|
+
userId?: number;
|
|
40
|
+
tokenType?: string;
|
|
41
|
+
idToken?: string;
|
|
42
|
+
refreshToken?: string;
|
|
41
43
|
expiresIn: number;
|
|
42
44
|
accessToken: string;
|
|
43
45
|
}
|
package/esm/go/GoOAuth.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { GoUser } from './GoUser';
|
|
2
2
|
import { IOAuthDto, IOAuthToken, OAuthBase } from '../OAuthBase';
|
|
3
|
+
import { ILogger } from '@ts-core/common';
|
|
3
4
|
export declare class GoOAuth<T extends GoUser = GoUser> extends OAuthBase<T> {
|
|
5
|
+
constructor(logger: ILogger, window: Window, applicationId: string, scope: string);
|
|
4
6
|
protected getAuthUrl(): string;
|
|
5
7
|
getProfile(token: string): Promise<T>;
|
|
6
8
|
getTokenByCode(dto: IOAuthDto, secret: string): Promise<IOAuthToken>;
|
package/esm/go/GoOAuth.js
CHANGED
|
@@ -11,6 +11,9 @@ import * as _ from 'lodash';
|
|
|
11
11
|
import { GoUser } from './GoUser';
|
|
12
12
|
import { OAuthBase } from '../OAuthBase';
|
|
13
13
|
export class GoOAuth extends OAuthBase {
|
|
14
|
+
constructor(logger, window, applicationId, scope) {
|
|
15
|
+
super(logger, window, applicationId, scope);
|
|
16
|
+
}
|
|
14
17
|
getAuthUrl() {
|
|
15
18
|
let params = new URLSearchParams();
|
|
16
19
|
params.append('display', 'popup');
|
|
@@ -40,7 +43,7 @@ export class GoOAuth extends OAuthBase {
|
|
|
40
43
|
grant_type: 'authorization_code'
|
|
41
44
|
}
|
|
42
45
|
});
|
|
43
|
-
return {
|
|
46
|
+
return { idToken: item.id_token, tokenType: item.token_type, expiresIn: item.expires_in, accessToken: item.access_token, scope: item.scope };
|
|
44
47
|
});
|
|
45
48
|
}
|
|
46
49
|
}
|
package/esm/go/GoUser.d.ts
CHANGED
package/esm/go/GoUser.js
CHANGED
package/esm/ya/YaOAuth.js
CHANGED
|
@@ -42,7 +42,12 @@ export class YaOAuth extends OAuthBase {
|
|
|
42
42
|
client_secret: secret,
|
|
43
43
|
grant_type: 'authorization_code'
|
|
44
44
|
});
|
|
45
|
-
return {
|
|
45
|
+
return {
|
|
46
|
+
tokenType: data.token_type,
|
|
47
|
+
expiresIn: data.expires_in,
|
|
48
|
+
accessToken: data.access_token,
|
|
49
|
+
refreshToken: data.refresh_token,
|
|
50
|
+
};
|
|
46
51
|
});
|
|
47
52
|
}
|
|
48
53
|
}
|
package/esm/ya/YaUser.d.ts
CHANGED
package/esm/ya/YaUser.js
CHANGED
|
@@ -4,8 +4,14 @@ export class YaUser extends OAuthUser {
|
|
|
4
4
|
parse(item) {
|
|
5
5
|
this.id = item.id;
|
|
6
6
|
this.name = item.display_name;
|
|
7
|
+
this.login = item.login;
|
|
8
|
+
this.psuid = item.psuid;
|
|
7
9
|
this.email = item.default_email;
|
|
8
10
|
this.phone = _.get(item, 'default_phone.number');
|
|
11
|
+
this.emails = item.emails;
|
|
12
|
+
this.clientId = item.client_id;
|
|
13
|
+
this.realName = item.real_name;
|
|
14
|
+
this.displayName = item.display_name;
|
|
9
15
|
if (!_.isNil(item.sex)) {
|
|
10
16
|
this.isMale = item.sex === 'male';
|
|
11
17
|
}
|