webledger-auth-plugin 2.0.5 → 2.0.7
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.
|
@@ -15,9 +15,9 @@ declare module '@ioc:AuthService' {
|
|
|
15
15
|
logoutURL(): string;
|
|
16
16
|
checkLoginURL(): string;
|
|
17
17
|
forgotPasswordMobile(params: any): Promise<any>;
|
|
18
|
-
createRegisterWebAuthnChallenge(uuid: string): Promise<any>;
|
|
18
|
+
createRegisterWebAuthnChallenge(uuid: string, origin: string): Promise<any>;
|
|
19
19
|
registerWebAuthnCredential(uuid: string, params: any): Promise<any>;
|
|
20
|
-
createLoginWebAuthnChallenge(): Promise<any>;
|
|
20
|
+
createLoginWebAuthnChallenge(origin: string): Promise<any>;
|
|
21
21
|
loginWithWebAuthnCredential(params: any): Promise<any>;
|
|
22
22
|
deleteWebAuthnCredential(uuid: string, id: string): Promise<any>;
|
|
23
23
|
listWebAuthnCredentials(uuid: string): Promise<any>;
|
|
@@ -32,7 +32,7 @@ declare module '@ioc:AuthService' {
|
|
|
32
32
|
client: string;
|
|
33
33
|
secret: string;
|
|
34
34
|
env?: string;
|
|
35
|
-
|
|
35
|
+
type?: string;
|
|
36
36
|
expiry?: string;
|
|
37
37
|
timeout?: number;
|
|
38
38
|
paths?: {
|
|
@@ -67,9 +67,9 @@ export default class AuthService implements AuthServiceI {
|
|
|
67
67
|
forgotPasswordMobile(params: any): Promise<import("axios").AxiosResponse<any, any>>;
|
|
68
68
|
logoutURL(): string;
|
|
69
69
|
checkLoginURL(): string;
|
|
70
|
-
createRegisterWebAuthnChallenge(uuid: string): Promise<import("axios").AxiosResponse<any, any>>;
|
|
70
|
+
createRegisterWebAuthnChallenge(uuid: string, origin: string): Promise<import("axios").AxiosResponse<any, any>>;
|
|
71
71
|
registerWebAuthnCredential(uuid: string, params: any): Promise<import("axios").AxiosResponse<any, any>>;
|
|
72
|
-
createLoginWebAuthnChallenge(): Promise<import("axios").AxiosResponse<any, any>>;
|
|
72
|
+
createLoginWebAuthnChallenge(origin: string): Promise<import("axios").AxiosResponse<any, any>>;
|
|
73
73
|
loginWithWebAuthnCredential(params: any): Promise<import("axios").AxiosResponse<any, any>>;
|
|
74
74
|
deleteWebAuthnCredential(uuid: string, id: string): Promise<import("axios").AxiosResponse<any, any>>;
|
|
75
75
|
listWebAuthnCredentials(uuid: string): Promise<import("axios").AxiosResponse<any, any>>;
|
package/build/src/AuthService.js
CHANGED
|
@@ -28,20 +28,20 @@ class AuthService {
|
|
|
28
28
|
'Content-Type': 'application/json',
|
|
29
29
|
'x-auth-client': config.client,
|
|
30
30
|
};
|
|
31
|
-
const [
|
|
31
|
+
const [type, env] = config.client.split('_');
|
|
32
32
|
config.env = env;
|
|
33
|
-
config.
|
|
33
|
+
config.type = type;
|
|
34
34
|
for (const key in headers) {
|
|
35
35
|
this.client.defaults.headers.common[key] = headers[key];
|
|
36
36
|
}
|
|
37
|
-
this.client.defaults.headers.common['x-product-type'] = config.
|
|
37
|
+
this.client.defaults.headers.common['x-product-type'] = config.type;
|
|
38
38
|
this.client.defaults.headers.common['x-auth-env'] = config.env;
|
|
39
39
|
this.paths = { ...this.paths, ...config.paths };
|
|
40
40
|
}
|
|
41
41
|
createToken(sub) {
|
|
42
42
|
const payload = {
|
|
43
43
|
env: this.config.env,
|
|
44
|
-
|
|
44
|
+
type: this.config.type,
|
|
45
45
|
iss: this.config.iss,
|
|
46
46
|
sub,
|
|
47
47
|
};
|
|
@@ -166,24 +166,24 @@ class AuthService {
|
|
|
166
166
|
return this.client.post(this.paths[subject], params);
|
|
167
167
|
}
|
|
168
168
|
logoutURL() {
|
|
169
|
-
const url = `${this.config.host}/sso/${this.config.env}/logout?product=${this.config.
|
|
169
|
+
const url = `${this.config.host}/sso/${this.config.env}/logout?product=${this.config.type}`;
|
|
170
170
|
return url;
|
|
171
171
|
}
|
|
172
172
|
checkLoginURL() {
|
|
173
|
-
const url = `${this.config.host}/sso/${this.config.env}/jump/${this.config.
|
|
173
|
+
const url = `${this.config.host}/sso/${this.config.env}/jump/${this.config.type}`;
|
|
174
174
|
return url;
|
|
175
175
|
}
|
|
176
|
-
createRegisterWebAuthnChallenge(uuid) {
|
|
176
|
+
createRegisterWebAuthnChallenge(uuid, origin) {
|
|
177
177
|
this.setAuthToken('webauthn_users');
|
|
178
|
-
return this.client.get(`${this.paths.webauthn_users}/${uuid}/webauthn/challenge`);
|
|
178
|
+
return this.client.get(`${this.paths.webauthn_users}/${uuid}/webauthn/challenge?origin=${origin}`);
|
|
179
179
|
}
|
|
180
180
|
registerWebAuthnCredential(uuid, params) {
|
|
181
181
|
this.setAuthToken('webauthn_users');
|
|
182
182
|
return this.client.post(`${this.paths.webauthn_users}/${uuid}/webauthn/register`, params);
|
|
183
183
|
}
|
|
184
|
-
createLoginWebAuthnChallenge() {
|
|
184
|
+
createLoginWebAuthnChallenge(origin) {
|
|
185
185
|
this.setAuthToken('webauthn_login');
|
|
186
|
-
return this.client.get(`${this.paths.webauthn_login}/challenge`);
|
|
186
|
+
return this.client.get(`${this.paths.webauthn_login}/challenge?origin=${origin}`);
|
|
187
187
|
}
|
|
188
188
|
loginWithWebAuthnCredential(params) {
|
|
189
189
|
this.setAuthToken('webauthn_login');
|