@arv-bedrock/auth-sso 0.0.2 → 0.1.1
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/cjs/auth.js +21 -18
- package/dist/cjs/index.js +3 -7
- package/dist/cjs/types/auth.d.ts +8 -5
- package/dist/cjs/types/auth.d.ts.map +1 -1
- package/dist/cjs/types/index.d.ts +2 -4
- package/dist/cjs/types/index.d.ts.map +1 -1
- package/dist/esm/auth.js +20 -19
- package/dist/esm/index.mjs +2 -4
- package/dist/esm/types/auth.d.ts +8 -5
- package/dist/esm/types/auth.d.ts.map +1 -1
- package/dist/esm/types/index.d.ts +2 -4
- package/dist/esm/types/index.d.ts.map +1 -1
- package/package.json +1 -2
package/dist/cjs/auth.js
CHANGED
|
@@ -18,12 +18,10 @@ class Auth {
|
|
|
18
18
|
constructor() {
|
|
19
19
|
this.doLogout = () => __awaiter(this, void 0, void 0, function* () {
|
|
20
20
|
try {
|
|
21
|
-
|
|
21
|
+
yield (0, _fetch_1.default)(`${this.authHost}/api/v1/oauth/logout?client_id=${this.clientId}`, {
|
|
22
22
|
method: "POST"
|
|
23
23
|
});
|
|
24
|
-
|
|
25
|
-
const homeUrl = result.data || '/';
|
|
26
|
-
this.doLogin(homeUrl);
|
|
24
|
+
window.location.href = this.clientInit.url;
|
|
27
25
|
}
|
|
28
26
|
catch (error) {
|
|
29
27
|
this.doLogin();
|
|
@@ -35,9 +33,9 @@ class Auth {
|
|
|
35
33
|
this.clientSecret = "";
|
|
36
34
|
this.frontendHost = "";
|
|
37
35
|
this.defaultCallback = "";
|
|
38
|
-
this.homeUrl = '';
|
|
39
36
|
this.user = { userId: '', email: '' };
|
|
40
37
|
this.queryString = '';
|
|
38
|
+
this.clientInit = { url: '' };
|
|
41
39
|
}
|
|
42
40
|
isCitizen() {
|
|
43
41
|
return this.userType === "citizen";
|
|
@@ -71,9 +69,8 @@ class Auth {
|
|
|
71
69
|
}
|
|
72
70
|
window.location.replace(target);
|
|
73
71
|
}
|
|
74
|
-
doRegister(
|
|
75
|
-
const
|
|
76
|
-
const callbackURL = encodeURIComponent(url);
|
|
72
|
+
doRegister() {
|
|
73
|
+
const callbackURL = window.location.origin;
|
|
77
74
|
let location = `${this.authHost}/auth/register?redirectUri=${callbackURL}&client_id=${this.clientId}`;
|
|
78
75
|
if (this.isCitizen()) {
|
|
79
76
|
location = `${this.authHost}/auth/${constant_1.CITIZEN}/main-register?redirectUri=${callbackURL}&client_id=${this.clientId}`;
|
|
@@ -97,18 +94,17 @@ class Auth {
|
|
|
97
94
|
'client_id': this.clientId,
|
|
98
95
|
'user_type': this.userType
|
|
99
96
|
});
|
|
97
|
+
const res = yield this.getClientInit();
|
|
98
|
+
if (res.code != '200') {
|
|
99
|
+
return this.doLogin();
|
|
100
|
+
}
|
|
101
|
+
this.clientInit = res.data;
|
|
100
102
|
});
|
|
101
103
|
}
|
|
102
|
-
doResetPassword() {
|
|
103
|
-
window.location.replace(`${this.authHost}/auth/change-password?redirectUri=${window.location.href}&client_id=${this.clientId}&user_type=${this.userType}`);
|
|
104
|
-
}
|
|
105
|
-
doForgotPassword() {
|
|
106
|
-
window.location.replace(`${this.authHost}/auth/forgot-password?redirectUri=${window.location.href}&client_id=${this.clientId}&user_type=${this.userType}`);
|
|
107
|
-
}
|
|
108
104
|
setCookie(code) {
|
|
109
105
|
return __awaiter(this, void 0, void 0, function* () {
|
|
110
|
-
const codeParam =
|
|
111
|
-
yield (0, _fetch_1.default)(`${this.authHost}/api/v1/oauth/cookies?${this.queryString}
|
|
106
|
+
const codeParam = `${constant_1.CODE}=${code}`;
|
|
107
|
+
yield (0, _fetch_1.default)(`${this.authHost}/api/v1/oauth/cookies?${this.queryString}&${codeParam}`, {
|
|
112
108
|
method: "POST",
|
|
113
109
|
body: JSON.stringify({ code })
|
|
114
110
|
});
|
|
@@ -121,6 +117,13 @@ class Auth {
|
|
|
121
117
|
return result;
|
|
122
118
|
});
|
|
123
119
|
}
|
|
120
|
+
getClientInit() {
|
|
121
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
122
|
+
const secretParam = `${constant_1.CLIENT_SECRET}=${this.clientSecret}`;
|
|
123
|
+
const result = yield (0, _fetch_1.default)(`${this.authHost}/api/v1/oauth/clientInit?${this.queryString}&${secretParam}`);
|
|
124
|
+
return result;
|
|
125
|
+
});
|
|
126
|
+
}
|
|
124
127
|
clearCookie() {
|
|
125
128
|
return __awaiter(this, void 0, void 0, function* () {
|
|
126
129
|
yield (0, _fetch_1.default)(`${this.authHost}/api/v1/oauth/cookies?${this.queryString}`, {
|
|
@@ -142,8 +145,8 @@ class Auth {
|
|
|
142
145
|
}
|
|
143
146
|
});
|
|
144
147
|
}
|
|
145
|
-
doPortal(
|
|
146
|
-
window.location.replace(`${
|
|
148
|
+
doPortal() {
|
|
149
|
+
window.location.replace(`${this.clientInit.url}?client_id=${this.clientId}&user_type=${this.userType}`);
|
|
147
150
|
}
|
|
148
151
|
}
|
|
149
152
|
const bedRockAuth = new Auth();
|
package/dist/cjs/index.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.doPortal = exports.getCode = exports.clearCookie = exports.getClientInfo = exports.getProfile = exports.setCookie = exports.
|
|
6
|
+
exports.doPortal = exports.getCode = exports.clearCookie = exports.getClientInfo = exports.getProfile = exports.setCookie = exports.doRegister = exports.doLogout = exports.doLogin = exports.initBedrockAuth = void 0;
|
|
7
7
|
const auth_1 = __importDefault(require("./auth"));
|
|
8
8
|
const initBedrockAuth = ({ authUri, clientId, clientSecret, callback, userType, }) => {
|
|
9
9
|
auth_1.default.init({
|
|
@@ -22,12 +22,8 @@ const doLogin = (redirectUrl) => auth_1.default.doLogin(redirectUrl);
|
|
|
22
22
|
exports.doLogin = doLogin;
|
|
23
23
|
const doLogout = () => auth_1.default.doLogout();
|
|
24
24
|
exports.doLogout = doLogout;
|
|
25
|
-
const doRegister = (
|
|
25
|
+
const doRegister = () => auth_1.default.doRegister();
|
|
26
26
|
exports.doRegister = doRegister;
|
|
27
|
-
const doResetPassword = () => auth_1.default.doResetPassword();
|
|
28
|
-
exports.doResetPassword = doResetPassword;
|
|
29
|
-
const doForgotPassword = () => auth_1.default.doForgotPassword();
|
|
30
|
-
exports.doForgotPassword = doForgotPassword;
|
|
31
27
|
const setCookie = (code) => auth_1.default.setCookie(code);
|
|
32
28
|
exports.setCookie = setCookie;
|
|
33
29
|
const getProfile = () => auth_1.default.getProfile();
|
|
@@ -38,5 +34,5 @@ const clearCookie = () => auth_1.default.clearCookie();
|
|
|
38
34
|
exports.clearCookie = clearCookie;
|
|
39
35
|
const getCode = () => auth_1.default.getCode();
|
|
40
36
|
exports.getCode = getCode;
|
|
41
|
-
const doPortal = (
|
|
37
|
+
const doPortal = () => auth_1.default.doPortal();
|
|
42
38
|
exports.doPortal = doPortal;
|
package/dist/cjs/types/auth.d.ts
CHANGED
|
@@ -21,6 +21,10 @@ export interface AuthServiceRequest {
|
|
|
21
21
|
}
|
|
22
22
|
export interface ClientInfo {
|
|
23
23
|
url: string;
|
|
24
|
+
isPortal: string;
|
|
25
|
+
}
|
|
26
|
+
export interface ClientInit {
|
|
27
|
+
url: string;
|
|
24
28
|
}
|
|
25
29
|
declare class Auth {
|
|
26
30
|
private userType;
|
|
@@ -29,9 +33,9 @@ declare class Auth {
|
|
|
29
33
|
private defaultCallback;
|
|
30
34
|
private clientId;
|
|
31
35
|
private clientSecret;
|
|
32
|
-
private homeUrl;
|
|
33
36
|
private user;
|
|
34
37
|
private queryString;
|
|
38
|
+
private clientInit;
|
|
35
39
|
constructor();
|
|
36
40
|
isCitizen(): boolean;
|
|
37
41
|
getCode(): string;
|
|
@@ -39,16 +43,15 @@ declare class Auth {
|
|
|
39
43
|
private removeUrlParam;
|
|
40
44
|
doLogin(redirectUrl?: string): void;
|
|
41
45
|
doLogout: () => Promise<void>;
|
|
42
|
-
doRegister(
|
|
46
|
+
doRegister(): void;
|
|
43
47
|
private createQueryParam;
|
|
44
48
|
init(options: Options): Promise<void>;
|
|
45
|
-
doResetPassword(): void;
|
|
46
|
-
doForgotPassword(): void;
|
|
47
49
|
setCookie(code: string): Promise<void>;
|
|
48
50
|
getClientInfo(): Promise<ResponseData<ClientInfo>>;
|
|
51
|
+
private getClientInit;
|
|
49
52
|
clearCookie(): Promise<void>;
|
|
50
53
|
getProfile(): Promise<AuthServiceResponse | undefined>;
|
|
51
|
-
doPortal(
|
|
54
|
+
doPortal(): void;
|
|
52
55
|
}
|
|
53
56
|
declare const bedRockAuth: Auth;
|
|
54
57
|
export default bedRockAuth;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../auth.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;AAM7C,UAAU,OAAO;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED,MAAM,WAAW,YAAY,CAAC,CAAC;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,CAAC,CAAC;IACR,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,kBAAkB;IACjC,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../auth.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;AAM7C,UAAU,OAAO;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED,MAAM,WAAW,YAAY,CAAC,CAAC;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,CAAC,CAAC;IACR,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,kBAAkB;IACjC,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAG,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,UAAU;IACzB,GAAG,EAAG,MAAM,CAAC;CACd;AAQD,cAAM,IAAI;IACR,OAAO,CAAC,QAAQ,CAAW;IAE3B,OAAO,CAAC,QAAQ,CAAS;IAEzB,OAAO,CAAC,YAAY,CAAS;IAE7B,OAAO,CAAC,eAAe,CAAS;IAEhC,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,YAAY,CAAS;IAE7B,OAAO,CAAC,IAAI,CAAQ;IACpB,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,UAAU,CAAc;;IAchC,SAAS;IAIF,OAAO;IAKd,OAAO,CAAC,OAAO;IAKf,OAAO,CAAC,cAAc;IAUf,OAAO,CAAC,WAAW,GAAE,MAA6B;IAalD,QAAQ,sBASb;IAEK,UAAU;IAUjB,OAAO,CAAC,gBAAgB;IAQX,IAAI,CAAC,OAAO,EAAE,OAAO;IAkBrB,SAAS,CAAC,IAAI,EAAE,MAAM;IAWtB,aAAa;YAKZ,aAAa;IAMd,WAAW;IAOX,UAAU;IAYhB,QAAQ;CAOhB;AAED,QAAA,MAAM,WAAW,MAAa,CAAC;AAE/B,eAAe,WAAW,CAAC"}
|
|
@@ -9,13 +9,11 @@ export type AuthProps = {
|
|
|
9
9
|
export declare const initBedrockAuth: ({ authUri, clientId, clientSecret, callback, userType, }: AuthProps) => void;
|
|
10
10
|
export declare const doLogin: (redirectUrl?: string) => void;
|
|
11
11
|
export declare const doLogout: () => Promise<void>;
|
|
12
|
-
export declare const doRegister: (
|
|
13
|
-
export declare const doResetPassword: () => void;
|
|
14
|
-
export declare const doForgotPassword: () => void;
|
|
12
|
+
export declare const doRegister: () => void;
|
|
15
13
|
export declare const setCookie: (code: string) => Promise<void>;
|
|
16
14
|
export declare const getProfile: () => Promise<import("./auth").AuthServiceResponse | undefined>;
|
|
17
15
|
export declare const getClientInfo: () => Promise<import("./auth").ResponseData<import("./auth").ClientInfo>>;
|
|
18
16
|
export declare const clearCookie: () => Promise<void>;
|
|
19
17
|
export declare const getCode: () => string;
|
|
20
|
-
export declare const doPortal: (
|
|
18
|
+
export declare const doPortal: () => void;
|
|
21
19
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../index.ts"],"names":[],"mappings":"AAAA,OAAW,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAEtC,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAG,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,eAAe,6DAMzB,SAAS,SAWX,CAAC;AAEF,eAAO,MAAM,OAAO,iBAAkB,MAAM,SAA4B,CAAC;AAEzE,eAAO,MAAM,QAAQ,qBAAsB,CAAC;AAE5C,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../index.ts"],"names":[],"mappings":"AAAA,OAAW,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAEtC,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAG,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,eAAe,6DAMzB,SAAS,SAWX,CAAC;AAEF,eAAO,MAAM,OAAO,iBAAkB,MAAM,SAA4B,CAAC;AAEzE,eAAO,MAAM,QAAQ,qBAAsB,CAAC;AAE5C,eAAO,MAAM,UAAU,YAAwB,CAAC;AAEhD,eAAO,MAAM,SAAS,SAAW,MAAM,kBAAuB,CAAC;AAE/D,eAAO,MAAM,UAAU,iEAAwB,CAAC;AAEhD,eAAO,MAAM,aAAa,2EAA2B,CAAC;AAEtD,eAAO,MAAM,WAAW,qBAAyB,CAAC;AAElD,eAAO,MAAM,OAAO,cAAoB,CAAC;AAEzC,eAAO,MAAM,QAAQ,YAAoB,CAAA"}
|
package/dist/esm/auth.js
CHANGED
|
@@ -7,9 +7,9 @@ class Auth {
|
|
|
7
7
|
defaultCallback;
|
|
8
8
|
clientId;
|
|
9
9
|
clientSecret;
|
|
10
|
-
homeUrl;
|
|
11
10
|
user;
|
|
12
11
|
queryString;
|
|
12
|
+
clientInit;
|
|
13
13
|
constructor() {
|
|
14
14
|
this.userType = "officer";
|
|
15
15
|
this.authHost = "";
|
|
@@ -17,9 +17,9 @@ class Auth {
|
|
|
17
17
|
this.clientSecret = "";
|
|
18
18
|
this.frontendHost = "";
|
|
19
19
|
this.defaultCallback = "";
|
|
20
|
-
this.homeUrl = '';
|
|
21
20
|
this.user = { userId: '', email: '' };
|
|
22
21
|
this.queryString = '';
|
|
22
|
+
this.clientInit = { url: '' };
|
|
23
23
|
}
|
|
24
24
|
isCitizen() {
|
|
25
25
|
return this.userType === "citizen";
|
|
@@ -55,20 +55,17 @@ class Auth {
|
|
|
55
55
|
}
|
|
56
56
|
doLogout = async () => {
|
|
57
57
|
try {
|
|
58
|
-
|
|
58
|
+
await customFetch(`${this.authHost}/api/v1/oauth/logout?client_id=${this.clientId}`, {
|
|
59
59
|
method: "POST"
|
|
60
60
|
});
|
|
61
|
-
|
|
62
|
-
const homeUrl = result.data || '/';
|
|
63
|
-
this.doLogin(homeUrl);
|
|
61
|
+
window.location.href = this.clientInit.url;
|
|
64
62
|
}
|
|
65
63
|
catch (error) {
|
|
66
64
|
this.doLogin();
|
|
67
65
|
}
|
|
68
66
|
};
|
|
69
|
-
doRegister(
|
|
70
|
-
const
|
|
71
|
-
const callbackURL = encodeURIComponent(url);
|
|
67
|
+
doRegister() {
|
|
68
|
+
const callbackURL = window.location.origin;
|
|
72
69
|
let location = `${this.authHost}/auth/register?redirectUri=${callbackURL}&client_id=${this.clientId}`;
|
|
73
70
|
if (this.isCitizen()) {
|
|
74
71
|
location = `${this.authHost}/auth/${CITIZEN}/main-register?redirectUri=${callbackURL}&client_id=${this.clientId}`;
|
|
@@ -91,16 +88,15 @@ class Auth {
|
|
|
91
88
|
'client_id': this.clientId,
|
|
92
89
|
'user_type': this.userType
|
|
93
90
|
});
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
window.location.replace(`${this.authHost}/auth/forgot-password?redirectUri=${window.location.href}&client_id=${this.clientId}&user_type=${this.userType}`);
|
|
91
|
+
const res = await this.getClientInit();
|
|
92
|
+
if (res.code != '200') {
|
|
93
|
+
return this.doLogin();
|
|
94
|
+
}
|
|
95
|
+
this.clientInit = res.data;
|
|
100
96
|
}
|
|
101
97
|
async setCookie(code) {
|
|
102
|
-
const codeParam =
|
|
103
|
-
await customFetch(`${this.authHost}/api/v1/oauth/cookies?${this.queryString}
|
|
98
|
+
const codeParam = `${CODE}=${code}`;
|
|
99
|
+
await customFetch(`${this.authHost}/api/v1/oauth/cookies?${this.queryString}&${codeParam}`, {
|
|
104
100
|
method: "POST",
|
|
105
101
|
body: JSON.stringify({ code })
|
|
106
102
|
});
|
|
@@ -110,6 +106,11 @@ class Auth {
|
|
|
110
106
|
const result = await customFetch(`${this.authHost}/api/v1/oauth/clientInfo?${this.queryString}`);
|
|
111
107
|
return result;
|
|
112
108
|
}
|
|
109
|
+
async getClientInit() {
|
|
110
|
+
const secretParam = `${CLIENT_SECRET}=${this.clientSecret}`;
|
|
111
|
+
const result = await customFetch(`${this.authHost}/api/v1/oauth/clientInit?${this.queryString}&${secretParam}`);
|
|
112
|
+
return result;
|
|
113
|
+
}
|
|
113
114
|
async clearCookie() {
|
|
114
115
|
await customFetch(`${this.authHost}/api/v1/oauth/cookies?${this.queryString}`, {
|
|
115
116
|
method: "DELETE"
|
|
@@ -127,8 +128,8 @@ class Auth {
|
|
|
127
128
|
console.log('error', error);
|
|
128
129
|
}
|
|
129
130
|
}
|
|
130
|
-
doPortal(
|
|
131
|
-
window.location.replace(`${
|
|
131
|
+
doPortal() {
|
|
132
|
+
window.location.replace(`${this.clientInit.url}?client_id=${this.clientId}&user_type=${this.userType}`);
|
|
132
133
|
}
|
|
133
134
|
}
|
|
134
135
|
const bedRockAuth = new Auth();
|
package/dist/esm/index.mjs
CHANGED
|
@@ -13,12 +13,10 @@ export const initBedrockAuth = ({ authUri, clientId, clientSecret, callback, use
|
|
|
13
13
|
};
|
|
14
14
|
export const doLogin = (redirectUrl) => BR.doLogin(redirectUrl);
|
|
15
15
|
export const doLogout = () => BR.doLogout();
|
|
16
|
-
export const doRegister = (
|
|
17
|
-
export const doResetPassword = () => BR.doResetPassword();
|
|
18
|
-
export const doForgotPassword = () => BR.doForgotPassword();
|
|
16
|
+
export const doRegister = () => BR.doRegister();
|
|
19
17
|
export const setCookie = (code) => BR.setCookie(code);
|
|
20
18
|
export const getProfile = () => BR.getProfile();
|
|
21
19
|
export const getClientInfo = () => BR.getClientInfo();
|
|
22
20
|
export const clearCookie = () => BR.clearCookie();
|
|
23
21
|
export const getCode = () => BR.getCode();
|
|
24
|
-
export const doPortal = (
|
|
22
|
+
export const doPortal = () => BR.doPortal();
|
package/dist/esm/types/auth.d.ts
CHANGED
|
@@ -21,6 +21,10 @@ export interface AuthServiceRequest {
|
|
|
21
21
|
}
|
|
22
22
|
export interface ClientInfo {
|
|
23
23
|
url: string;
|
|
24
|
+
isPortal: string;
|
|
25
|
+
}
|
|
26
|
+
export interface ClientInit {
|
|
27
|
+
url: string;
|
|
24
28
|
}
|
|
25
29
|
declare class Auth {
|
|
26
30
|
private userType;
|
|
@@ -29,9 +33,9 @@ declare class Auth {
|
|
|
29
33
|
private defaultCallback;
|
|
30
34
|
private clientId;
|
|
31
35
|
private clientSecret;
|
|
32
|
-
private homeUrl;
|
|
33
36
|
private user;
|
|
34
37
|
private queryString;
|
|
38
|
+
private clientInit;
|
|
35
39
|
constructor();
|
|
36
40
|
isCitizen(): boolean;
|
|
37
41
|
getCode(): string;
|
|
@@ -39,16 +43,15 @@ declare class Auth {
|
|
|
39
43
|
private removeUrlParam;
|
|
40
44
|
doLogin(redirectUrl?: string): void;
|
|
41
45
|
doLogout: () => Promise<void>;
|
|
42
|
-
doRegister(
|
|
46
|
+
doRegister(): void;
|
|
43
47
|
private createQueryParam;
|
|
44
48
|
init(options: Options): Promise<void>;
|
|
45
|
-
doResetPassword(): void;
|
|
46
|
-
doForgotPassword(): void;
|
|
47
49
|
setCookie(code: string): Promise<void>;
|
|
48
50
|
getClientInfo(): Promise<ResponseData<ClientInfo>>;
|
|
51
|
+
private getClientInit;
|
|
49
52
|
clearCookie(): Promise<void>;
|
|
50
53
|
getProfile(): Promise<AuthServiceResponse | undefined>;
|
|
51
|
-
doPortal(
|
|
54
|
+
doPortal(): void;
|
|
52
55
|
}
|
|
53
56
|
declare const bedRockAuth: Auth;
|
|
54
57
|
export default bedRockAuth;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../auth.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;AAM7C,UAAU,OAAO;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED,MAAM,WAAW,YAAY,CAAC,CAAC;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,CAAC,CAAC;IACR,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,kBAAkB;IACjC,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../auth.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;AAM7C,UAAU,OAAO;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED,MAAM,WAAW,YAAY,CAAC,CAAC;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,CAAC,CAAC;IACR,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,kBAAkB;IACjC,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAG,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,UAAU;IACzB,GAAG,EAAG,MAAM,CAAC;CACd;AAQD,cAAM,IAAI;IACR,OAAO,CAAC,QAAQ,CAAW;IAE3B,OAAO,CAAC,QAAQ,CAAS;IAEzB,OAAO,CAAC,YAAY,CAAS;IAE7B,OAAO,CAAC,eAAe,CAAS;IAEhC,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,YAAY,CAAS;IAE7B,OAAO,CAAC,IAAI,CAAQ;IACpB,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,UAAU,CAAc;;IAchC,SAAS;IAIF,OAAO;IAKd,OAAO,CAAC,OAAO;IAKf,OAAO,CAAC,cAAc;IAUf,OAAO,CAAC,WAAW,GAAE,MAA6B;IAalD,QAAQ,sBASb;IAEK,UAAU;IAUjB,OAAO,CAAC,gBAAgB;IAQX,IAAI,CAAC,OAAO,EAAE,OAAO;IAkBrB,SAAS,CAAC,IAAI,EAAE,MAAM;IAWtB,aAAa;YAKZ,aAAa;IAMd,WAAW;IAOX,UAAU;IAYhB,QAAQ;CAOhB;AAED,QAAA,MAAM,WAAW,MAAa,CAAC;AAE/B,eAAe,WAAW,CAAC"}
|
|
@@ -9,13 +9,11 @@ export type AuthProps = {
|
|
|
9
9
|
export declare const initBedrockAuth: ({ authUri, clientId, clientSecret, callback, userType, }: AuthProps) => void;
|
|
10
10
|
export declare const doLogin: (redirectUrl?: string) => void;
|
|
11
11
|
export declare const doLogout: () => Promise<void>;
|
|
12
|
-
export declare const doRegister: (
|
|
13
|
-
export declare const doResetPassword: () => void;
|
|
14
|
-
export declare const doForgotPassword: () => void;
|
|
12
|
+
export declare const doRegister: () => void;
|
|
15
13
|
export declare const setCookie: (code: string) => Promise<void>;
|
|
16
14
|
export declare const getProfile: () => Promise<import("./auth").AuthServiceResponse | undefined>;
|
|
17
15
|
export declare const getClientInfo: () => Promise<import("./auth").ResponseData<import("./auth").ClientInfo>>;
|
|
18
16
|
export declare const clearCookie: () => Promise<void>;
|
|
19
17
|
export declare const getCode: () => string;
|
|
20
|
-
export declare const doPortal: (
|
|
18
|
+
export declare const doPortal: () => void;
|
|
21
19
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../index.ts"],"names":[],"mappings":"AAAA,OAAW,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAEtC,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAG,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,eAAe,6DAMzB,SAAS,SAWX,CAAC;AAEF,eAAO,MAAM,OAAO,iBAAkB,MAAM,SAA4B,CAAC;AAEzE,eAAO,MAAM,QAAQ,qBAAsB,CAAC;AAE5C,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../index.ts"],"names":[],"mappings":"AAAA,OAAW,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAEtC,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAG,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,eAAe,6DAMzB,SAAS,SAWX,CAAC;AAEF,eAAO,MAAM,OAAO,iBAAkB,MAAM,SAA4B,CAAC;AAEzE,eAAO,MAAM,QAAQ,qBAAsB,CAAC;AAE5C,eAAO,MAAM,UAAU,YAAwB,CAAC;AAEhD,eAAO,MAAM,SAAS,SAAW,MAAM,kBAAuB,CAAC;AAE/D,eAAO,MAAM,UAAU,iEAAwB,CAAC;AAEhD,eAAO,MAAM,aAAa,2EAA2B,CAAC;AAEtD,eAAO,MAAM,WAAW,qBAAyB,CAAC;AAElD,eAAO,MAAM,OAAO,cAAoB,CAAC;AAEzC,eAAO,MAAM,QAAQ,YAAoB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arv-bedrock/auth-sso",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"main": "./dist/cjs/index.js",
|
|
5
5
|
"types": "./dist/cjs/types/index.d.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
"build:esm": "tsc -p ./configs/tsconfig.esm.json && mv dist/esm/index.js dist/esm/index.mjs",
|
|
10
10
|
"build:cjs": "tsc -p ./configs/tsconfig.cjs.json",
|
|
11
11
|
"prepack": "npm run build",
|
|
12
|
-
"publish": "",
|
|
13
12
|
"prepublish": "npm run build",
|
|
14
13
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
15
14
|
"semantic-release": "semantic-release"
|