@ts-core/oauth 3.0.29 → 3.0.31
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/keycloak/{KeyCloakAuth.d.ts → KeycloakAuth.d.ts} +6 -6
- package/cjs/keycloak/{KeyCloakAuth.js → KeycloakAuth.js} +7 -8
- package/{esm/keycloak/KeyCloakUser.d.ts → cjs/keycloak/KeycloakUser.d.ts} +1 -1
- package/cjs/keycloak/{KeyCloakUser.js → KeycloakUser.js} +3 -3
- package/cjs/public-api.d.ts +2 -2
- package/cjs/public-api.js +2 -2
- package/esm/keycloak/{KeyCloakAuth.d.ts → KeycloakAuth.d.ts} +6 -6
- package/esm/keycloak/{KeyCloakAuth.js → KeycloakAuth.js} +4 -5
- package/{cjs/keycloak/KeyCloakUser.d.ts → esm/keycloak/KeycloakUser.d.ts} +1 -1
- package/esm/keycloak/{KeyCloakUser.js → KeycloakUser.js} +1 -1
- package/esm/public-api.d.ts +2 -2
- package/esm/public-api.js +2 -2
- package/package.json +1 -1
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { ILogger } from "@ts-core/common";
|
|
2
2
|
import { IOAuthDto, IOAuthToken, OAuthBase } from "../OAuthBase";
|
|
3
|
-
import {
|
|
4
|
-
export declare class
|
|
5
|
-
protected _settings:
|
|
6
|
-
constructor(logger: ILogger, settings:
|
|
3
|
+
import { KeycloakUser } from "./KeycloakUser";
|
|
4
|
+
export declare class KeycloakAuth<T extends KeycloakUser = KeycloakUser> extends OAuthBase<T> {
|
|
5
|
+
protected _settings: IKeycloakAuthSettings;
|
|
6
|
+
constructor(logger: ILogger, settings: IKeycloakAuthSettings, window?: Window);
|
|
7
7
|
protected getBaseUrl(): string;
|
|
8
8
|
getPopUpUrl(): string;
|
|
9
9
|
getProfile(token: string): Promise<T>;
|
|
10
10
|
getTokenByCode(dto: IOAuthDto, secret: string): Promise<IOAuthToken>;
|
|
11
11
|
destroy(): void;
|
|
12
|
-
get settings():
|
|
12
|
+
get settings(): IKeycloakAuthSettings;
|
|
13
13
|
}
|
|
14
|
-
export interface
|
|
14
|
+
export interface IKeycloakAuthSettings {
|
|
15
15
|
url: string;
|
|
16
16
|
realm: string;
|
|
17
17
|
applicationId: string;
|
|
@@ -9,13 +9,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
exports.KeycloakAuth = void 0;
|
|
13
13
|
const common_1 = require("@ts-core/common");
|
|
14
|
-
const _ = require("lodash");
|
|
15
14
|
const OAuthBase_1 = require("../OAuthBase");
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
class
|
|
15
|
+
const KeycloakUser_1 = require("./KeycloakUser");
|
|
16
|
+
const _ = require("lodash");
|
|
17
|
+
class KeycloakAuth extends OAuthBase_1.OAuthBase {
|
|
19
18
|
constructor(logger, settings, window) {
|
|
20
19
|
super(logger, settings.applicationId, window);
|
|
21
20
|
this._settings = settings;
|
|
@@ -31,7 +30,7 @@ class KeyCloakAuth extends OAuthBase_1.OAuthBase {
|
|
|
31
30
|
}
|
|
32
31
|
getProfile(token) {
|
|
33
32
|
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
-
let item = new
|
|
33
|
+
let item = new KeycloakUser_1.KeycloakUser();
|
|
35
34
|
item.parse(yield this.http.call(`${this.getBaseUrl()}/userinfo`, { headers: { Authorization: `Bearer ${token}` } }));
|
|
36
35
|
return item;
|
|
37
36
|
});
|
|
@@ -39,7 +38,7 @@ class KeyCloakAuth extends OAuthBase_1.OAuthBase {
|
|
|
39
38
|
getTokenByCode(dto, secret) {
|
|
40
39
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41
40
|
let item = yield this.http.call(`${this.getBaseUrl()}/token`, {
|
|
42
|
-
data: new
|
|
41
|
+
data: new URLSearchParams({
|
|
43
42
|
code: dto.codeOrToken,
|
|
44
43
|
client_id: this.applicationId,
|
|
45
44
|
client_secret: secret,
|
|
@@ -74,4 +73,4 @@ class KeyCloakAuth extends OAuthBase_1.OAuthBase {
|
|
|
74
73
|
return this._settings;
|
|
75
74
|
}
|
|
76
75
|
}
|
|
77
|
-
exports.
|
|
76
|
+
exports.KeycloakAuth = KeycloakAuth;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.KeycloakUser = void 0;
|
|
4
4
|
const OAuthUser_1 = require("../OAuthUser");
|
|
5
|
-
class
|
|
5
|
+
class KeycloakUser extends OAuthUser_1.OAuthUser {
|
|
6
6
|
parse(item) {
|
|
7
7
|
this.id = item.sub;
|
|
8
8
|
this.name = item.name;
|
|
@@ -13,4 +13,4 @@ class KeyCloakUser extends OAuthUser_1.OAuthUser {
|
|
|
13
13
|
this.familyName = item.family_name;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
exports.
|
|
16
|
+
exports.KeycloakUser = KeycloakUser;
|
package/cjs/public-api.d.ts
CHANGED
|
@@ -9,8 +9,8 @@ export * from './ya/YaUser';
|
|
|
9
9
|
export * from './ya/YaAuth';
|
|
10
10
|
export * from './ma/MaAuth';
|
|
11
11
|
export * from './ma/MaUser';
|
|
12
|
-
export * from './keycloak/
|
|
13
|
-
export * from './keycloak/
|
|
12
|
+
export * from './keycloak/KeycloakAuth';
|
|
13
|
+
export * from './keycloak/KeycloakUser';
|
|
14
14
|
export * from './external/browser';
|
|
15
15
|
export * from './external/cordovaOAuthPlugin';
|
|
16
16
|
export * from './external/cordovaInAppBrowserPlugin';
|
package/cjs/public-api.js
CHANGED
|
@@ -25,8 +25,8 @@ __exportStar(require("./ya/YaUser"), exports);
|
|
|
25
25
|
__exportStar(require("./ya/YaAuth"), exports);
|
|
26
26
|
__exportStar(require("./ma/MaAuth"), exports);
|
|
27
27
|
__exportStar(require("./ma/MaUser"), exports);
|
|
28
|
-
__exportStar(require("./keycloak/
|
|
29
|
-
__exportStar(require("./keycloak/
|
|
28
|
+
__exportStar(require("./keycloak/KeycloakAuth"), exports);
|
|
29
|
+
__exportStar(require("./keycloak/KeycloakUser"), exports);
|
|
30
30
|
__exportStar(require("./external/browser"), exports);
|
|
31
31
|
__exportStar(require("./external/cordovaOAuthPlugin"), exports);
|
|
32
32
|
__exportStar(require("./external/cordovaInAppBrowserPlugin"), exports);
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { ILogger } from "@ts-core/common";
|
|
2
2
|
import { IOAuthDto, IOAuthToken, OAuthBase } from "../OAuthBase";
|
|
3
|
-
import {
|
|
4
|
-
export declare class
|
|
5
|
-
protected _settings:
|
|
6
|
-
constructor(logger: ILogger, settings:
|
|
3
|
+
import { KeycloakUser } from "./KeycloakUser";
|
|
4
|
+
export declare class KeycloakAuth<T extends KeycloakUser = KeycloakUser> extends OAuthBase<T> {
|
|
5
|
+
protected _settings: IKeycloakAuthSettings;
|
|
6
|
+
constructor(logger: ILogger, settings: IKeycloakAuthSettings, window?: Window);
|
|
7
7
|
protected getBaseUrl(): string;
|
|
8
8
|
getPopUpUrl(): string;
|
|
9
9
|
getProfile(token: string): Promise<T>;
|
|
10
10
|
getTokenByCode(dto: IOAuthDto, secret: string): Promise<IOAuthToken>;
|
|
11
11
|
destroy(): void;
|
|
12
|
-
get settings():
|
|
12
|
+
get settings(): IKeycloakAuthSettings;
|
|
13
13
|
}
|
|
14
|
-
export interface
|
|
14
|
+
export interface IKeycloakAuthSettings {
|
|
15
15
|
url: string;
|
|
16
16
|
realm: string;
|
|
17
17
|
applicationId: string;
|
|
@@ -8,11 +8,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { ExtendedError, RandomUtil } from "@ts-core/common";
|
|
11
|
-
import * as _ from 'lodash';
|
|
12
11
|
import { OAuthBase } from "../OAuthBase";
|
|
13
|
-
import {
|
|
14
|
-
import
|
|
15
|
-
export class
|
|
12
|
+
import { KeycloakUser } from "./KeycloakUser";
|
|
13
|
+
import * as _ from 'lodash';
|
|
14
|
+
export class KeycloakAuth extends OAuthBase {
|
|
16
15
|
constructor(logger, settings, window) {
|
|
17
16
|
super(logger, settings.applicationId, window);
|
|
18
17
|
this._settings = settings;
|
|
@@ -28,7 +27,7 @@ export class KeyCloakAuth extends OAuthBase {
|
|
|
28
27
|
}
|
|
29
28
|
getProfile(token) {
|
|
30
29
|
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
let item = new
|
|
30
|
+
let item = new KeycloakUser();
|
|
32
31
|
item.parse(yield this.http.call(`${this.getBaseUrl()}/userinfo`, { headers: { Authorization: `Bearer ${token}` } }));
|
|
33
32
|
return item;
|
|
34
33
|
});
|
package/esm/public-api.d.ts
CHANGED
|
@@ -9,8 +9,8 @@ export * from './ya/YaUser';
|
|
|
9
9
|
export * from './ya/YaAuth';
|
|
10
10
|
export * from './ma/MaAuth';
|
|
11
11
|
export * from './ma/MaUser';
|
|
12
|
-
export * from './keycloak/
|
|
13
|
-
export * from './keycloak/
|
|
12
|
+
export * from './keycloak/KeycloakAuth';
|
|
13
|
+
export * from './keycloak/KeycloakUser';
|
|
14
14
|
export * from './external/browser';
|
|
15
15
|
export * from './external/cordovaOAuthPlugin';
|
|
16
16
|
export * from './external/cordovaInAppBrowserPlugin';
|
package/esm/public-api.js
CHANGED
|
@@ -9,8 +9,8 @@ export * from './ya/YaUser';
|
|
|
9
9
|
export * from './ya/YaAuth';
|
|
10
10
|
export * from './ma/MaAuth';
|
|
11
11
|
export * from './ma/MaUser';
|
|
12
|
-
export * from './keycloak/
|
|
13
|
-
export * from './keycloak/
|
|
12
|
+
export * from './keycloak/KeycloakAuth';
|
|
13
|
+
export * from './keycloak/KeycloakUser';
|
|
14
14
|
export * from './external/browser';
|
|
15
15
|
export * from './external/cordovaOAuthPlugin';
|
|
16
16
|
export * from './external/cordovaInAppBrowserPlugin';
|