@ghentcdh/authentication-vue 0.0.2-9 → 0.1.0
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/README.md +56 -15
- package/index.d.ts +3 -3
- package/index.mjs +275 -262
- package/lib/auth.const.d.ts +16 -0
- package/lib/createAuth.d.ts +2 -0
- package/lib/keycloak.adapter.d.ts +6 -1
- package/lib/request.d.ts +13 -0
- package/lib/utils.d.ts +5 -0
- package/package.json +1 -2
- package/lib/authentication.store.d.ts +0 -19
- package/lib/request.store.d.ts +0 -25
package/README.md
CHANGED
|
@@ -20,26 +20,51 @@ pnpm add @ghentcdh/auth/vue @ghentcdh/auth/backend
|
|
|
20
20
|
|
|
21
21
|
Add following environment variables to the `.env` file.
|
|
22
22
|
|
|
23
|
-
```
|
|
23
|
+
```bash
|
|
24
24
|
- VITE_KEYCLOAK_HOST=$KEYCLOAK_HOST
|
|
25
25
|
- VITE_KEYCLOAK_REALM=$KEYCLOAK_REALM
|
|
26
26
|
- VITE_KEYCLOAK_CLIENT_ID=$KEYCLOAK_CLIENT_ID
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
## Enable authentication
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
Enable the authentication plugin in your `main.ts` file.
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
```typescript
|
|
34
|
+
import { createAuth } from '@ghentcdh/authentication-vue';
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
// Other app initialisation ...o
|
|
37
|
+
|
|
38
|
+
app.use(
|
|
39
|
+
createAuth({
|
|
40
|
+
keycloak: {
|
|
41
|
+
realm: import.meta.env.VITE_KEYCLOAK_REALM,
|
|
42
|
+
url: import.meta.env.VITE_KEYCLOAK_HOST,
|
|
43
|
+
clientId: import.meta.env.VITE_KEYCLOAK_CLIENT_ID,
|
|
44
|
+
},
|
|
45
|
+
}),
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Create auth options
|
|
51
|
+
|
|
52
|
+
| Option | Default | Functionality |
|
|
53
|
+
|-----------|---------|--------------------------------------------------------------|
|
|
54
|
+
| skipAuth | false | Skip authentication by default if using HttpRequest function |
|
|
55
|
+
|
|
56
|
+
## Functions
|
|
57
|
+
|
|
58
|
+
### User related functions
|
|
59
|
+
|
|
60
|
+
```typescript
|
|
61
|
+
import { createAuth } from '@ghentcdh/authentication-vue';
|
|
38
62
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
</template>
|
|
63
|
+
// Get the user
|
|
64
|
+
await getUser();
|
|
42
65
|
|
|
66
|
+
// Check if the user is authenticated
|
|
67
|
+
await isAuthenticated();
|
|
43
68
|
```
|
|
44
69
|
|
|
45
70
|
### Perform backend requests with the token
|
|
@@ -47,20 +72,36 @@ Add following environment variables to the `.env` file.
|
|
|
47
72
|
```vue
|
|
48
73
|
|
|
49
74
|
<script setup lang="ts">
|
|
50
|
-
import {
|
|
75
|
+
import { useHttpRequest } from "@ghentcdh/authentication/vue";
|
|
51
76
|
|
|
52
|
-
const
|
|
77
|
+
const httpRequest = useHttpRequest();
|
|
53
78
|
|
|
54
|
-
|
|
79
|
+
httpRequest.post('/api/auth/login', {}).then(response => {
|
|
55
80
|
alert('login ok')
|
|
56
81
|
});
|
|
57
82
|
</script>
|
|
58
83
|
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Additional a parameter can be provided if the authentication should be skipped.
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
|
|
90
|
+
```vue
|
|
91
|
+
|
|
92
|
+
<script setup lang="ts">
|
|
93
|
+
import { useHttpRequest } from "@ghentcdh/authentication/vue";
|
|
94
|
+
|
|
95
|
+
const httpRequest = useHttpRequest();
|
|
96
|
+
|
|
97
|
+
httpRequest.post('/api/skip-auth', {}, {skipAuth: true}).then(response => {
|
|
98
|
+
alert('login ok')
|
|
99
|
+
});
|
|
100
|
+
</script>
|
|
59
101
|
|
|
60
102
|
```
|
|
61
103
|
|
|
62
104
|
> TODO list
|
|
63
105
|
> - [ ] Add roles guard to see if routes or parts of the application can be accessed by that user
|
|
64
|
-
> - [ ]
|
|
65
|
-
> - [ ] Add a
|
|
106
|
+
> - [ ] Add whitelisted routes
|
|
66
107
|
> - [ ] Add logout functionality
|
package/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './lib/
|
|
2
|
-
export * from './lib/
|
|
3
|
-
export * from './lib/
|
|
1
|
+
export * from './lib/createAuth';
|
|
2
|
+
export * from './lib/request';
|
|
3
|
+
export * from './lib/utils';
|
package/index.mjs
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
function
|
|
4
|
-
if (!(this instanceof
|
|
1
|
+
import { ref as oe, markRaw as ae, watch as se, inject as W } from "vue";
|
|
2
|
+
const F = "GHENTCDH_AUTHENTICATION";
|
|
3
|
+
function $(l) {
|
|
4
|
+
if (!(this instanceof $))
|
|
5
5
|
throw new Error("The 'Keycloak' constructor must be invoked with 'new'.");
|
|
6
|
-
if (typeof
|
|
6
|
+
if (typeof l != "string" && !V(l))
|
|
7
7
|
throw new Error("The 'Keycloak' constructor must be provided with a configuration object, or a URL to a JSON configuration file.");
|
|
8
|
-
if (
|
|
9
|
-
const r = "oidcProvider" in
|
|
8
|
+
if (V(l)) {
|
|
9
|
+
const r = "oidcProvider" in l ? ["clientId"] : ["url", "realm", "clientId"];
|
|
10
10
|
for (const t of r)
|
|
11
|
-
if (!
|
|
11
|
+
if (!l[t])
|
|
12
12
|
throw new Error(`The configuration object is missing the required '${t}' property.`);
|
|
13
13
|
}
|
|
14
|
-
var e = this,
|
|
14
|
+
var e = this, f, k = [], m, h = {
|
|
15
15
|
enable: !0,
|
|
16
16
|
callbackList: [],
|
|
17
17
|
interval: 5
|
|
18
18
|
};
|
|
19
19
|
e.didInitialize = !1;
|
|
20
|
-
var
|
|
21
|
-
globalThis.isSecureContext ||
|
|
20
|
+
var y = !0, b = X(console.info), T = X(console.warn);
|
|
21
|
+
globalThis.isSecureContext || T(
|
|
22
22
|
`[KEYCLOAK] Keycloak JS must be used in a 'secure context' to function properly as it relies on browser APIs that are otherwise not available.
|
|
23
23
|
Continuing to run your application insecurely will lead to unexpected behavior and breakage.
|
|
24
24
|
|
|
@@ -26,9 +26,9 @@ For more information see: https://developer.mozilla.org/en-US/docs/Web/Security/
|
|
|
26
26
|
), e.init = function(r = {}) {
|
|
27
27
|
if (e.didInitialize)
|
|
28
28
|
throw new Error("A 'Keycloak' instance can only be initialized once.");
|
|
29
|
-
e.didInitialize = !0, e.authenticated = !1,
|
|
29
|
+
e.didInitialize = !0, e.authenticated = !1, m = ne();
|
|
30
30
|
var t = ["default", "cordova", "cordova-native"];
|
|
31
|
-
if (t.indexOf(r.adapter) > -1 ?
|
|
31
|
+
if (t.indexOf(r.adapter) > -1 ? f = D(r.adapter) : typeof r.adapter == "object" ? f = r.adapter : window.Cordova || window.cordova ? f = D("cordova") : f = D(), typeof r.useNonce < "u" && (y = r.useNonce), typeof r.checkLoginIframe < "u" && (h.enable = r.checkLoginIframe), r.checkLoginIframeInterval && (h.interval = r.checkLoginIframeInterval), r.onLoad === "login-required" && (e.loginRequired = !0), r.responseMode)
|
|
32
32
|
if (r.responseMode === "query" || r.responseMode === "fragment")
|
|
33
33
|
e.responseMode = r.responseMode;
|
|
34
34
|
else
|
|
@@ -56,7 +56,7 @@ For more information see: https://developer.mozilla.org/en-US/docs/Web/Security/
|
|
|
56
56
|
} else
|
|
57
57
|
e.pkceMethod = "S256";
|
|
58
58
|
typeof r.enableLogging == "boolean" ? e.enableLogging = r.enableLogging : e.enableLogging = !1, r.logoutMethod === "POST" ? e.logoutMethod = "POST" : e.logoutMethod = "GET", typeof r.scope == "string" && (e.scope = r.scope), typeof r.acrValues == "string" && (e.acrValues = r.acrValues), typeof r.messageReceiveTimeout == "number" && r.messageReceiveTimeout > 0 ? e.messageReceiveTimeout = r.messageReceiveTimeout : e.messageReceiveTimeout = 1e4, e.responseMode || (e.responseMode = "fragment"), e.responseType || (e.responseType = "code", e.flow = "standard");
|
|
59
|
-
var i =
|
|
59
|
+
var i = w(), s = w();
|
|
60
60
|
s.promise.then(function() {
|
|
61
61
|
e.onReady && e.onReady(e.authenticated), i.setSuccess(e.authenticated);
|
|
62
62
|
}).catch(function(o) {
|
|
@@ -65,7 +65,7 @@ For more information see: https://developer.mozilla.org/en-US/docs/Web/Security/
|
|
|
65
65
|
var a = Z();
|
|
66
66
|
function c() {
|
|
67
67
|
var o = function(d) {
|
|
68
|
-
d || (
|
|
68
|
+
d || (p.prompt = "none"), r.locale && (p.locale = r.locale), e.login(p).then(function() {
|
|
69
69
|
s.setSuccess();
|
|
70
70
|
}).catch(function(g) {
|
|
71
71
|
s.setError(g);
|
|
@@ -73,18 +73,18 @@ For more information see: https://developer.mozilla.org/en-US/docs/Web/Security/
|
|
|
73
73
|
}, u = async function() {
|
|
74
74
|
var d = document.createElement("iframe"), g = await e.createLoginUrl({ prompt: "none", redirectUri: e.silentCheckSsoRedirectUri });
|
|
75
75
|
d.setAttribute("src", g), d.setAttribute("sandbox", "allow-storage-access-by-user-activation allow-scripts allow-same-origin"), d.setAttribute("title", "keycloak-silent-check-sso"), d.style.display = "none", document.body.appendChild(d);
|
|
76
|
-
var
|
|
77
|
-
if (!(
|
|
78
|
-
var
|
|
79
|
-
U
|
|
76
|
+
var S = function(I) {
|
|
77
|
+
if (!(I.origin !== window.location.origin || d.contentWindow !== I.source)) {
|
|
78
|
+
var U = E(I.data);
|
|
79
|
+
A(U, s), document.body.removeChild(d), window.removeEventListener("message", S);
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
|
-
window.addEventListener("message",
|
|
83
|
-
},
|
|
82
|
+
window.addEventListener("message", S);
|
|
83
|
+
}, p = {};
|
|
84
84
|
switch (r.onLoad) {
|
|
85
85
|
case "check-sso":
|
|
86
|
-
h.enable ?
|
|
87
|
-
|
|
86
|
+
h.enable ? H().then(function() {
|
|
87
|
+
P().then(function(d) {
|
|
88
88
|
d ? s.setSuccess() : e.silentCheckSsoRedirectUri ? u() : o(!1);
|
|
89
89
|
}).catch(function(d) {
|
|
90
90
|
s.setError(d);
|
|
@@ -101,14 +101,14 @@ For more information see: https://developer.mozilla.org/en-US/docs/Web/Security/
|
|
|
101
101
|
function n() {
|
|
102
102
|
var o = E(window.location.href);
|
|
103
103
|
if (o && window.history.replaceState(window.history.state, null, o.newUrl), o && o.valid)
|
|
104
|
-
return
|
|
105
|
-
|
|
104
|
+
return H().then(function() {
|
|
105
|
+
A(o, s);
|
|
106
106
|
}).catch(function(u) {
|
|
107
107
|
s.setError(u);
|
|
108
108
|
});
|
|
109
|
-
r.token && r.refreshToken ? (
|
|
110
|
-
|
|
111
|
-
u ? (e.onAuthSuccess && e.onAuthSuccess(), s.setSuccess(),
|
|
109
|
+
r.token && r.refreshToken ? (x(r.token, r.refreshToken, r.idToken), h.enable ? H().then(function() {
|
|
110
|
+
P().then(function(u) {
|
|
111
|
+
u ? (e.onAuthSuccess && e.onAuthSuccess(), s.setSuccess(), K()) : s.setSuccess();
|
|
112
112
|
}).catch(function(u) {
|
|
113
113
|
s.setError(u);
|
|
114
114
|
});
|
|
@@ -126,28 +126,28 @@ For more information see: https://developer.mozilla.org/en-US/docs/Web/Security/
|
|
|
126
126
|
i.setError(o);
|
|
127
127
|
}), i.promise;
|
|
128
128
|
}, e.login = function(r) {
|
|
129
|
-
return
|
|
129
|
+
return f.login(r);
|
|
130
130
|
};
|
|
131
131
|
function R(r) {
|
|
132
132
|
if (typeof crypto > "u" || typeof crypto.getRandomValues > "u")
|
|
133
133
|
throw new Error("Web Crypto API is not available.");
|
|
134
134
|
return crypto.getRandomValues(new Uint8Array(r));
|
|
135
135
|
}
|
|
136
|
-
function
|
|
137
|
-
return
|
|
136
|
+
function C(r) {
|
|
137
|
+
return v(r, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789");
|
|
138
138
|
}
|
|
139
|
-
function
|
|
139
|
+
function v(r, t) {
|
|
140
140
|
for (var i = R(r), s = new Array(r), a = 0; a < r; a++)
|
|
141
141
|
s[a] = t.charCodeAt(i[a] % t.length);
|
|
142
142
|
return String.fromCharCode.apply(null, s);
|
|
143
143
|
}
|
|
144
|
-
async function
|
|
144
|
+
async function M(r, t) {
|
|
145
145
|
if (r !== "S256")
|
|
146
146
|
throw new TypeError(`Invalid value for 'pkceMethod', expected 'S256' but got '${r}'.`);
|
|
147
|
-
const i = new Uint8Array(await
|
|
148
|
-
return
|
|
147
|
+
const i = new Uint8Array(await ce(t));
|
|
148
|
+
return ie(i).replace(/\+/g, "-").replace(/\//g, "_").replace(/\=/g, "");
|
|
149
149
|
}
|
|
150
|
-
function
|
|
150
|
+
function N(r) {
|
|
151
151
|
var t = {
|
|
152
152
|
id_token: {
|
|
153
153
|
acr: r
|
|
@@ -156,7 +156,7 @@ For more information see: https://developer.mozilla.org/en-US/docs/Web/Security/
|
|
|
156
156
|
return JSON.stringify(t);
|
|
157
157
|
}
|
|
158
158
|
e.createLoginUrl = async function(r) {
|
|
159
|
-
var t =
|
|
159
|
+
var t = q(), i = q(), s = f.redirectUri(r), a = {
|
|
160
160
|
state: t,
|
|
161
161
|
nonce: i,
|
|
162
162
|
redirectUri: encodeURIComponent(s),
|
|
@@ -168,34 +168,34 @@ For more information see: https://developer.mozilla.org/en-US/docs/Web/Security/
|
|
|
168
168
|
var n = r && r.scope || e.scope;
|
|
169
169
|
n ? n.indexOf("openid") === -1 && (n = "openid " + n) : n = "openid";
|
|
170
170
|
var o = c + "?client_id=" + encodeURIComponent(e.clientId) + "&redirect_uri=" + encodeURIComponent(s) + "&state=" + encodeURIComponent(t) + "&response_mode=" + encodeURIComponent(e.responseMode) + "&response_type=" + encodeURIComponent(e.responseType) + "&scope=" + encodeURIComponent(n);
|
|
171
|
-
if (
|
|
172
|
-
var u =
|
|
171
|
+
if (y && (o = o + "&nonce=" + encodeURIComponent(i)), r && r.prompt && (o += "&prompt=" + encodeURIComponent(r.prompt)), r && typeof r.maxAge == "number" && (o += "&max_age=" + encodeURIComponent(r.maxAge)), r && r.loginHint && (o += "&login_hint=" + encodeURIComponent(r.loginHint)), r && r.idpHint && (o += "&kc_idp_hint=" + encodeURIComponent(r.idpHint)), r && r.action && r.action != "register" && (o += "&kc_action=" + encodeURIComponent(r.action)), r && r.locale && (o += "&ui_locales=" + encodeURIComponent(r.locale)), r && r.acr) {
|
|
172
|
+
var u = N(r.acr);
|
|
173
173
|
o += "&claims=" + encodeURIComponent(u);
|
|
174
174
|
}
|
|
175
175
|
if ((r && r.acrValues || e.acrValues) && (o += "&acr_values=" + encodeURIComponent(r.acrValues || e.acrValues)), e.pkceMethod)
|
|
176
176
|
try {
|
|
177
|
-
const
|
|
178
|
-
a.pkceCodeVerifier =
|
|
179
|
-
} catch (
|
|
180
|
-
throw new Error("Failed to generate PKCE challenge.", { cause:
|
|
177
|
+
const p = C(96), d = await M(e.pkceMethod, p);
|
|
178
|
+
a.pkceCodeVerifier = p, o += "&code_challenge=" + d, o += "&code_challenge_method=" + e.pkceMethod;
|
|
179
|
+
} catch (p) {
|
|
180
|
+
throw new Error("Failed to generate PKCE challenge.", { cause: p });
|
|
181
181
|
}
|
|
182
|
-
return
|
|
182
|
+
return m.add(a), o;
|
|
183
183
|
}, e.logout = function(r) {
|
|
184
|
-
return
|
|
184
|
+
return f.logout(r);
|
|
185
185
|
}, e.createLogoutUrl = function(r) {
|
|
186
186
|
if (((r == null ? void 0 : r.logoutMethod) ?? e.logoutMethod) === "POST")
|
|
187
187
|
return e.endpoints.logout();
|
|
188
|
-
var i = e.endpoints.logout() + "?client_id=" + encodeURIComponent(e.clientId) + "&post_logout_redirect_uri=" + encodeURIComponent(
|
|
188
|
+
var i = e.endpoints.logout() + "?client_id=" + encodeURIComponent(e.clientId) + "&post_logout_redirect_uri=" + encodeURIComponent(f.redirectUri(r, !1));
|
|
189
189
|
return e.idToken && (i += "&id_token_hint=" + encodeURIComponent(e.idToken)), i;
|
|
190
190
|
}, e.register = function(r) {
|
|
191
|
-
return
|
|
191
|
+
return f.register(r);
|
|
192
192
|
}, e.createRegisterUrl = async function(r) {
|
|
193
193
|
return r || (r = {}), r.action = "register", await e.createLoginUrl(r);
|
|
194
194
|
}, e.createAccountUrl = function(r) {
|
|
195
195
|
var t = _(), i = void 0;
|
|
196
|
-
return typeof t < "u" && (i = t + "/account?referrer=" + encodeURIComponent(e.clientId) + "&referrer_uri=" + encodeURIComponent(
|
|
196
|
+
return typeof t < "u" && (i = t + "/account?referrer=" + encodeURIComponent(e.clientId) + "&referrer_uri=" + encodeURIComponent(f.redirectUri(r))), i;
|
|
197
197
|
}, e.accountManagement = function() {
|
|
198
|
-
return
|
|
198
|
+
return f.accountManagement();
|
|
199
199
|
}, e.hasRealmRole = function(r) {
|
|
200
200
|
var t = e.realmAccess;
|
|
201
201
|
return !!t && t.roles.indexOf(r) >= 0;
|
|
@@ -207,14 +207,14 @@ For more information see: https://developer.mozilla.org/en-US/docs/Web/Security/
|
|
|
207
207
|
}, e.loadUserProfile = function() {
|
|
208
208
|
var r = _() + "/account", t = new XMLHttpRequest();
|
|
209
209
|
t.open("GET", r, !0), t.setRequestHeader("Accept", "application/json"), t.setRequestHeader("Authorization", "bearer " + e.token);
|
|
210
|
-
var i =
|
|
210
|
+
var i = w();
|
|
211
211
|
return t.onreadystatechange = function() {
|
|
212
212
|
t.readyState == 4 && (t.status == 200 ? (e.profile = JSON.parse(t.responseText), i.setSuccess(e.profile)) : i.setError());
|
|
213
213
|
}, t.send(), i.promise;
|
|
214
214
|
}, e.loadUserInfo = function() {
|
|
215
215
|
var r = e.endpoints.userinfo(), t = new XMLHttpRequest();
|
|
216
216
|
t.open("GET", r, !0), t.setRequestHeader("Accept", "application/json"), t.setRequestHeader("Authorization", "bearer " + e.token);
|
|
217
|
-
var i =
|
|
217
|
+
var i = w();
|
|
218
218
|
return t.onreadystatechange = function() {
|
|
219
219
|
t.readyState == 4 && (t.status == 200 ? (e.userInfo = JSON.parse(t.responseText), i.setSuccess(e.userInfo)) : i.setError());
|
|
220
220
|
}, t.send(), i.promise;
|
|
@@ -222,7 +222,7 @@ For more information see: https://developer.mozilla.org/en-US/docs/Web/Security/
|
|
|
222
222
|
if (!e.tokenParsed || !e.refreshToken && e.flow != "implicit")
|
|
223
223
|
throw "Not authenticated";
|
|
224
224
|
if (e.timeSkew == null)
|
|
225
|
-
return
|
|
225
|
+
return b("[KEYCLOAK] Unable to determine if token is expired as timeskew is not set"), !0;
|
|
226
226
|
var t = e.tokenParsed.exp - Math.ceil((/* @__PURE__ */ new Date()).getTime() / 1e3) + e.timeSkew;
|
|
227
227
|
if (r) {
|
|
228
228
|
if (isNaN(r))
|
|
@@ -231,31 +231,31 @@ For more information see: https://developer.mozilla.org/en-US/docs/Web/Security/
|
|
|
231
231
|
}
|
|
232
232
|
return t < 0;
|
|
233
233
|
}, e.updateToken = function(r) {
|
|
234
|
-
var t =
|
|
234
|
+
var t = w();
|
|
235
235
|
if (!e.refreshToken)
|
|
236
236
|
return t.setError(), t.promise;
|
|
237
237
|
r = r || 5;
|
|
238
238
|
var i = function() {
|
|
239
239
|
var a = !1;
|
|
240
|
-
if (r == -1 ? (a = !0,
|
|
240
|
+
if (r == -1 ? (a = !0, b("[KEYCLOAK] Refreshing token: forced refresh")) : (!e.tokenParsed || e.isTokenExpired(r)) && (a = !0, b("[KEYCLOAK] Refreshing token: token expired")), !a)
|
|
241
241
|
t.setSuccess(!1);
|
|
242
242
|
else {
|
|
243
243
|
var c = "grant_type=refresh_token&refresh_token=" + e.refreshToken, n = e.endpoints.token();
|
|
244
|
-
if (
|
|
244
|
+
if (k.push(t), k.length == 1) {
|
|
245
245
|
var o = new XMLHttpRequest();
|
|
246
246
|
o.open("POST", n, !0), o.setRequestHeader("Content-type", "application/x-www-form-urlencoded"), o.withCredentials = !0, c += "&client_id=" + encodeURIComponent(e.clientId);
|
|
247
247
|
var u = (/* @__PURE__ */ new Date()).getTime();
|
|
248
248
|
o.onreadystatechange = function() {
|
|
249
249
|
if (o.readyState == 4)
|
|
250
250
|
if (o.status == 200) {
|
|
251
|
-
|
|
252
|
-
var
|
|
253
|
-
|
|
254
|
-
for (var d =
|
|
251
|
+
b("[KEYCLOAK] Token refreshed"), u = (u + (/* @__PURE__ */ new Date()).getTime()) / 2;
|
|
252
|
+
var p = JSON.parse(o.responseText);
|
|
253
|
+
x(p.access_token, p.refresh_token, p.id_token, u), e.onAuthRefreshSuccess && e.onAuthRefreshSuccess();
|
|
254
|
+
for (var d = k.pop(); d != null; d = k.pop())
|
|
255
255
|
d.setSuccess(!0);
|
|
256
256
|
} else {
|
|
257
|
-
|
|
258
|
-
for (var d =
|
|
257
|
+
T("[KEYCLOAK] Failed to refresh token"), o.status == 400 && e.clearToken(), e.onAuthRefreshError && e.onAuthRefreshError();
|
|
258
|
+
for (var d = k.pop(); d != null; d = k.pop())
|
|
259
259
|
d.setError("Failed to refresh token: An unexpected HTTP error occurred while attempting to refresh the token.");
|
|
260
260
|
}
|
|
261
261
|
}, o.send(c);
|
|
@@ -263,7 +263,7 @@ For more information see: https://developer.mozilla.org/en-US/docs/Web/Security/
|
|
|
263
263
|
}
|
|
264
264
|
};
|
|
265
265
|
if (h.enable) {
|
|
266
|
-
var s =
|
|
266
|
+
var s = P();
|
|
267
267
|
s.then(function() {
|
|
268
268
|
i();
|
|
269
269
|
}).catch(function(a) {
|
|
@@ -273,7 +273,7 @@ For more information see: https://developer.mozilla.org/en-US/docs/Web/Security/
|
|
|
273
273
|
i();
|
|
274
274
|
return t.promise;
|
|
275
275
|
}, e.clearToken = function() {
|
|
276
|
-
e.token && (
|
|
276
|
+
e.token && (x(null, null, null), e.onAuthLogout && e.onAuthLogout(), e.loginRequired && e.login());
|
|
277
277
|
};
|
|
278
278
|
function _() {
|
|
279
279
|
if (typeof e.authServerUrl < "u")
|
|
@@ -282,7 +282,7 @@ For more information see: https://developer.mozilla.org/en-US/docs/Web/Security/
|
|
|
282
282
|
function Q() {
|
|
283
283
|
return window.location.origin ? window.location.origin : window.location.protocol + "//" + window.location.hostname + (window.location.port ? ":" + window.location.port : "");
|
|
284
284
|
}
|
|
285
|
-
function
|
|
285
|
+
function A(r, t) {
|
|
286
286
|
var i = r.code, s = r.error, a = r.prompt, c = (/* @__PURE__ */ new Date()).getTime();
|
|
287
287
|
if (r.kc_action_status && e.onActionUpdate && e.onActionUpdate(r.kc_action_status, r.kc_action), s) {
|
|
288
288
|
if (a != "none")
|
|
@@ -297,23 +297,23 @@ For more information see: https://developer.mozilla.org/en-US/docs/Web/Security/
|
|
|
297
297
|
return;
|
|
298
298
|
} else e.flow != "standard" && (r.access_token || r.id_token) && d(r.access_token, null, r.id_token, !0);
|
|
299
299
|
if (e.flow != "implicit" && i) {
|
|
300
|
-
var o = "code=" + i + "&grant_type=authorization_code", u = e.endpoints.token(),
|
|
301
|
-
|
|
302
|
-
if (
|
|
303
|
-
if (
|
|
304
|
-
var g = JSON.parse(
|
|
305
|
-
d(g.access_token, g.refresh_token, g.id_token, e.flow === "standard"),
|
|
300
|
+
var o = "code=" + i + "&grant_type=authorization_code", u = e.endpoints.token(), p = new XMLHttpRequest();
|
|
301
|
+
p.open("POST", u, !0), p.setRequestHeader("Content-type", "application/x-www-form-urlencoded"), o += "&client_id=" + encodeURIComponent(e.clientId), o += "&redirect_uri=" + r.redirectUri, r.pkceCodeVerifier && (o += "&code_verifier=" + r.pkceCodeVerifier), p.withCredentials = !0, p.onreadystatechange = function() {
|
|
302
|
+
if (p.readyState == 4)
|
|
303
|
+
if (p.status == 200) {
|
|
304
|
+
var g = JSON.parse(p.responseText);
|
|
305
|
+
d(g.access_token, g.refresh_token, g.id_token, e.flow === "standard"), K();
|
|
306
306
|
} else
|
|
307
307
|
e.onAuthError && e.onAuthError(), t && t.setError();
|
|
308
|
-
},
|
|
308
|
+
}, p.send(o);
|
|
309
309
|
}
|
|
310
|
-
function d(g,
|
|
311
|
-
c = (c + (/* @__PURE__ */ new Date()).getTime()) / 2,
|
|
310
|
+
function d(g, S, I, U) {
|
|
311
|
+
c = (c + (/* @__PURE__ */ new Date()).getTime()) / 2, x(g, S, I, c), y && e.idTokenParsed && e.idTokenParsed.nonce != r.storedNonce ? (b("[KEYCLOAK] Invalid nonce, clearing token"), e.clearToken(), t && t.setError()) : U && (e.onAuthSuccess && e.onAuthSuccess(), t && t.setSuccess());
|
|
312
312
|
}
|
|
313
313
|
}
|
|
314
314
|
function Z() {
|
|
315
|
-
var r =
|
|
316
|
-
typeof
|
|
315
|
+
var r = w(), t;
|
|
316
|
+
typeof l == "string" && (t = l);
|
|
317
317
|
function i(n) {
|
|
318
318
|
n ? e.endpoints = {
|
|
319
319
|
authorize: function() {
|
|
@@ -368,24 +368,24 @@ For more information see: https://developer.mozilla.org/en-US/docs/Web/Security/
|
|
|
368
368
|
var s = new XMLHttpRequest();
|
|
369
369
|
s.open("GET", t, !0), s.setRequestHeader("Accept", "application/json"), s.onreadystatechange = function() {
|
|
370
370
|
if (s.readyState == 4)
|
|
371
|
-
if (s.status == 200 ||
|
|
371
|
+
if (s.status == 200 || G(s)) {
|
|
372
372
|
var n = JSON.parse(s.responseText);
|
|
373
373
|
e.authServerUrl = n["auth-server-url"], e.realm = n.realm, e.clientId = n.resource, i(null), r.setSuccess();
|
|
374
374
|
} else
|
|
375
375
|
r.setError();
|
|
376
376
|
}, s.send();
|
|
377
377
|
} else {
|
|
378
|
-
e.clientId =
|
|
379
|
-
var a =
|
|
378
|
+
e.clientId = l.clientId;
|
|
379
|
+
var a = l.oidcProvider;
|
|
380
380
|
if (!a)
|
|
381
|
-
e.authServerUrl =
|
|
381
|
+
e.authServerUrl = l.url, e.realm = l.realm, i(null), r.setSuccess();
|
|
382
382
|
else if (typeof a == "string") {
|
|
383
383
|
var c;
|
|
384
384
|
a.charAt(a.length - 1) == "/" ? c = a + ".well-known/openid-configuration" : c = a + "/.well-known/openid-configuration";
|
|
385
385
|
var s = new XMLHttpRequest();
|
|
386
386
|
s.open("GET", c, !0), s.setRequestHeader("Accept", "application/json"), s.onreadystatechange = function() {
|
|
387
387
|
if (s.readyState == 4)
|
|
388
|
-
if (s.status == 200 ||
|
|
388
|
+
if (s.status == 200 || G(s)) {
|
|
389
389
|
var o = JSON.parse(s.responseText);
|
|
390
390
|
i(o), r.setSuccess();
|
|
391
391
|
} else
|
|
@@ -396,19 +396,19 @@ For more information see: https://developer.mozilla.org/en-US/docs/Web/Security/
|
|
|
396
396
|
}
|
|
397
397
|
return r.promise;
|
|
398
398
|
}
|
|
399
|
-
function
|
|
399
|
+
function G(r) {
|
|
400
400
|
return r.status == 0 && r.responseText && r.responseURL.startsWith("file:");
|
|
401
401
|
}
|
|
402
|
-
function
|
|
403
|
-
if (e.tokenTimeoutHandle && (clearTimeout(e.tokenTimeoutHandle), e.tokenTimeoutHandle = null), t ? (e.refreshToken = t, e.refreshTokenParsed =
|
|
404
|
-
if (e.token = r, e.tokenParsed =
|
|
402
|
+
function x(r, t, i, s) {
|
|
403
|
+
if (e.tokenTimeoutHandle && (clearTimeout(e.tokenTimeoutHandle), e.tokenTimeoutHandle = null), t ? (e.refreshToken = t, e.refreshTokenParsed = J(t)) : (delete e.refreshToken, delete e.refreshTokenParsed), i ? (e.idToken = i, e.idTokenParsed = J(i)) : (delete e.idToken, delete e.idTokenParsed), r) {
|
|
404
|
+
if (e.token = r, e.tokenParsed = J(r), e.sessionId = e.tokenParsed.sid, e.authenticated = !0, e.subject = e.tokenParsed.sub, e.realmAccess = e.tokenParsed.realm_access, e.resourceAccess = e.tokenParsed.resource_access, s && (e.timeSkew = Math.floor(s / 1e3) - e.tokenParsed.iat), e.timeSkew != null && (b("[KEYCLOAK] Estimated time difference between browser and server is " + e.timeSkew + " seconds"), e.onTokenExpired)) {
|
|
405
405
|
var a = (e.tokenParsed.exp - (/* @__PURE__ */ new Date()).getTime() / 1e3 + e.timeSkew) * 1e3;
|
|
406
|
-
|
|
406
|
+
b("[KEYCLOAK] Token expires in " + Math.round(a / 1e3) + " s"), a <= 0 ? e.onTokenExpired() : e.tokenTimeoutHandle = setTimeout(e.onTokenExpired, a);
|
|
407
407
|
}
|
|
408
408
|
} else
|
|
409
409
|
delete e.token, delete e.tokenParsed, delete e.subject, delete e.realmAccess, delete e.resourceAccess, e.authenticated = !1;
|
|
410
410
|
}
|
|
411
|
-
function
|
|
411
|
+
function q() {
|
|
412
412
|
if (typeof crypto > "u" || typeof crypto.randomUUID > "u")
|
|
413
413
|
throw new Error("Web Crypto API is not available.");
|
|
414
414
|
return crypto.randomUUID();
|
|
@@ -416,7 +416,7 @@ For more information see: https://developer.mozilla.org/en-US/docs/Web/Security/
|
|
|
416
416
|
function E(r) {
|
|
417
417
|
var t = ee(r);
|
|
418
418
|
if (t) {
|
|
419
|
-
var i =
|
|
419
|
+
var i = m.get(t.state);
|
|
420
420
|
return i && (t.valid = !0, t.redirectUri = i.redirectUri, t.storedNonce = i.nonce, t.prompt = i.prompt, t.pkceCodeVerifier = i.pkceCodeVerifier, t.loginOptions = i.loginOptions), t;
|
|
421
421
|
}
|
|
422
422
|
}
|
|
@@ -435,7 +435,7 @@ For more information see: https://developer.mozilla.org/en-US/docs/Web/Security/
|
|
|
435
435
|
}
|
|
436
436
|
t.push("error"), t.push("error_description"), t.push("error_uri");
|
|
437
437
|
var i = r.indexOf("?"), s = r.indexOf("#"), a, c;
|
|
438
|
-
if (e.responseMode === "query" && i !== -1 ? (a = r.substring(0, i), c =
|
|
438
|
+
if (e.responseMode === "query" && i !== -1 ? (a = r.substring(0, i), c = B(r.substring(i + 1, s !== -1 ? s : r.length), t), c.paramsString !== "" && (a += "?" + c.paramsString), s !== -1 && (a += r.substring(s))) : e.responseMode === "fragment" && s !== -1 && (a = r.substring(0, s), c = B(r.substring(s + 1), t), c.paramsString !== "" && (a += "#" + c.paramsString)), c && c.oauthParams) {
|
|
439
439
|
if (e.flow === "standard" || e.flow === "hybrid") {
|
|
440
440
|
if ((c.oauthParams.code || c.oauthParams.error) && c.oauthParams.state)
|
|
441
441
|
return c.oauthParams.newUrl = a, c.oauthParams;
|
|
@@ -443,7 +443,7 @@ For more information see: https://developer.mozilla.org/en-US/docs/Web/Security/
|
|
|
443
443
|
return c.oauthParams.newUrl = a, c.oauthParams;
|
|
444
444
|
}
|
|
445
445
|
}
|
|
446
|
-
function
|
|
446
|
+
function B(r, t) {
|
|
447
447
|
for (var i = r.split("&"), s = {
|
|
448
448
|
paramsString: "",
|
|
449
449
|
oauthParams: {}
|
|
@@ -453,7 +453,7 @@ For more information see: https://developer.mozilla.org/en-US/docs/Web/Security/
|
|
|
453
453
|
}
|
|
454
454
|
return s;
|
|
455
455
|
}
|
|
456
|
-
function
|
|
456
|
+
function w() {
|
|
457
457
|
var r = {
|
|
458
458
|
setSuccess: function(t) {
|
|
459
459
|
r.resolve(t);
|
|
@@ -476,8 +476,8 @@ For more information see: https://developer.mozilla.org/en-US/docs/Web/Security/
|
|
|
476
476
|
clearTimeout(s);
|
|
477
477
|
});
|
|
478
478
|
}
|
|
479
|
-
function
|
|
480
|
-
var r =
|
|
479
|
+
function H() {
|
|
480
|
+
var r = w();
|
|
481
481
|
if (!h.enable || h.iframe)
|
|
482
482
|
return r.setSuccess(), r.promise;
|
|
483
483
|
var t = document.createElement("iframe");
|
|
@@ -498,15 +498,15 @@ For more information see: https://developer.mozilla.org/en-US/docs/Web/Security/
|
|
|
498
498
|
};
|
|
499
499
|
return window.addEventListener("message", s, !1), r.promise;
|
|
500
500
|
}
|
|
501
|
-
function
|
|
501
|
+
function K() {
|
|
502
502
|
h.enable && e.token && setTimeout(function() {
|
|
503
|
-
|
|
504
|
-
r &&
|
|
503
|
+
P().then(function(r) {
|
|
504
|
+
r && K();
|
|
505
505
|
});
|
|
506
506
|
}, h.interval * 1e3);
|
|
507
507
|
}
|
|
508
|
-
function
|
|
509
|
-
var r =
|
|
508
|
+
function P() {
|
|
509
|
+
var r = w();
|
|
510
510
|
if (h.iframe && h.iframeOrigin) {
|
|
511
511
|
var t = e.clientId + " " + (e.sessionId ? e.sessionId : "");
|
|
512
512
|
h.callbackList.push(r);
|
|
@@ -517,12 +517,12 @@ For more information see: https://developer.mozilla.org/en-US/docs/Web/Security/
|
|
|
517
517
|
return r.promise;
|
|
518
518
|
}
|
|
519
519
|
function te() {
|
|
520
|
-
var r =
|
|
520
|
+
var r = w();
|
|
521
521
|
if ((h.enable || e.silentCheckSsoRedirectUri) && typeof e.endpoints.thirdPartyCookiesIframe == "function") {
|
|
522
522
|
var t = document.createElement("iframe");
|
|
523
523
|
t.setAttribute("src", e.endpoints.thirdPartyCookiesIframe()), t.setAttribute("sandbox", "allow-storage-access-by-user-activation allow-scripts allow-same-origin"), t.setAttribute("title", "keycloak-3p-check-iframe"), t.style.display = "none", document.body.appendChild(t);
|
|
524
524
|
var i = function(s) {
|
|
525
|
-
t.contentWindow === s.source && (s.data !== "supported" && s.data !== "unsupported" || (s.data === "unsupported" && (
|
|
525
|
+
t.contentWindow === s.source && (s.data !== "supported" && s.data !== "unsupported" || (s.data === "unsupported" && (T(
|
|
526
526
|
`[KEYCLOAK] Your browser is blocking access to 3rd-party cookies, this means:
|
|
527
527
|
|
|
528
528
|
- It is not possible to retrieve tokens without redirecting to the Keycloak server (a.k.a. no support for silent authentication).
|
|
@@ -536,11 +536,11 @@ For more information see: https://www.keycloak.org/securing-apps/javascript-adap
|
|
|
536
536
|
r.setSuccess();
|
|
537
537
|
return re(r.promise, e.messageReceiveTimeout, "Timeout when waiting for 3rd party check iframe message.");
|
|
538
538
|
}
|
|
539
|
-
function
|
|
539
|
+
function D(r) {
|
|
540
540
|
if (!r || r == "default")
|
|
541
541
|
return {
|
|
542
542
|
login: async function(n) {
|
|
543
|
-
return window.location.assign(await e.createLoginUrl(n)),
|
|
543
|
+
return window.location.assign(await e.createLoginUrl(n)), w().promise;
|
|
544
544
|
},
|
|
545
545
|
logout: async function(n) {
|
|
546
546
|
if (((n == null ? void 0 : n.logoutMethod) ?? e.logoutMethod) === "GET") {
|
|
@@ -549,19 +549,19 @@ For more information see: https://www.keycloak.org/securing-apps/javascript-adap
|
|
|
549
549
|
}
|
|
550
550
|
const u = document.createElement("form");
|
|
551
551
|
u.setAttribute("method", "POST"), u.setAttribute("action", e.createLogoutUrl(n)), u.style.display = "none";
|
|
552
|
-
const
|
|
552
|
+
const p = {
|
|
553
553
|
id_token_hint: e.idToken,
|
|
554
554
|
client_id: e.clientId,
|
|
555
|
-
post_logout_redirect_uri:
|
|
555
|
+
post_logout_redirect_uri: f.redirectUri(n, !1)
|
|
556
556
|
};
|
|
557
|
-
for (const [d, g] of Object.entries(
|
|
558
|
-
const
|
|
559
|
-
|
|
557
|
+
for (const [d, g] of Object.entries(p)) {
|
|
558
|
+
const S = document.createElement("input");
|
|
559
|
+
S.setAttribute("type", "hidden"), S.setAttribute("name", d), S.setAttribute("value", g), u.appendChild(S);
|
|
560
560
|
}
|
|
561
561
|
document.body.appendChild(u), u.submit();
|
|
562
562
|
},
|
|
563
563
|
register: async function(n) {
|
|
564
|
-
return window.location.assign(await e.createRegisterUrl(n)),
|
|
564
|
+
return window.location.assign(await e.createRegisterUrl(n)), w().promise;
|
|
565
565
|
},
|
|
566
566
|
accountManagement: function() {
|
|
567
567
|
var n = e.createAccountUrl();
|
|
@@ -569,7 +569,7 @@ For more information see: https://www.keycloak.org/securing-apps/javascript-adap
|
|
|
569
569
|
window.location.href = n;
|
|
570
570
|
else
|
|
571
571
|
throw "Not supported by the OIDC server";
|
|
572
|
-
return
|
|
572
|
+
return w().promise;
|
|
573
573
|
},
|
|
574
574
|
redirectUri: function(n, o) {
|
|
575
575
|
return n && n.redirectUri ? n.redirectUri : e.redirectUri ? e.redirectUri : location.href;
|
|
@@ -595,44 +595,44 @@ For more information see: https://www.keycloak.org/securing-apps/javascript-adap
|
|
|
595
595
|
};
|
|
596
596
|
return {
|
|
597
597
|
login: async function(n) {
|
|
598
|
-
var o =
|
|
599
|
-
|
|
598
|
+
var o = w(), u = a(n), p = await e.createLoginUrl(n), d = t(p, "_blank", u), g = !1, S = !1, I = function() {
|
|
599
|
+
S = !0, d.close();
|
|
600
600
|
};
|
|
601
|
-
return d.addEventListener("loadstart", function(
|
|
602
|
-
if (
|
|
603
|
-
var
|
|
604
|
-
|
|
601
|
+
return d.addEventListener("loadstart", function(U) {
|
|
602
|
+
if (U.url.indexOf(c()) == 0) {
|
|
603
|
+
var z = E(U.url);
|
|
604
|
+
A(z, o), I(), g = !0;
|
|
605
605
|
}
|
|
606
|
-
}), d.addEventListener("loaderror", function(
|
|
606
|
+
}), d.addEventListener("loaderror", function(U) {
|
|
607
607
|
if (!g)
|
|
608
|
-
if (
|
|
609
|
-
var
|
|
610
|
-
|
|
608
|
+
if (U.url.indexOf(c()) == 0) {
|
|
609
|
+
var z = E(U.url);
|
|
610
|
+
A(z, o), I(), g = !0;
|
|
611
611
|
} else
|
|
612
|
-
o.setError(),
|
|
613
|
-
}), d.addEventListener("exit", function(
|
|
614
|
-
|
|
612
|
+
o.setError(), I();
|
|
613
|
+
}), d.addEventListener("exit", function(U) {
|
|
614
|
+
S || o.setError({
|
|
615
615
|
reason: "closed_by_user"
|
|
616
616
|
});
|
|
617
617
|
}), o.promise;
|
|
618
618
|
},
|
|
619
619
|
logout: function(n) {
|
|
620
|
-
var o =
|
|
621
|
-
return
|
|
622
|
-
g.url.indexOf(c()) == 0 &&
|
|
623
|
-
}),
|
|
624
|
-
g.url.indexOf(c()) == 0 || (d = !0),
|
|
625
|
-
}),
|
|
620
|
+
var o = w(), u = e.createLogoutUrl(n), p = t(u, "_blank", "location=no,hidden=yes,clearcache=yes"), d;
|
|
621
|
+
return p.addEventListener("loadstart", function(g) {
|
|
622
|
+
g.url.indexOf(c()) == 0 && p.close();
|
|
623
|
+
}), p.addEventListener("loaderror", function(g) {
|
|
624
|
+
g.url.indexOf(c()) == 0 || (d = !0), p.close();
|
|
625
|
+
}), p.addEventListener("exit", function(g) {
|
|
626
626
|
d ? o.setError() : (e.clearToken(), o.setSuccess());
|
|
627
627
|
}), o.promise;
|
|
628
628
|
},
|
|
629
629
|
register: async function(n) {
|
|
630
|
-
var o =
|
|
630
|
+
var o = w(), u = await e.createRegisterUrl(), p = a(n), d = t(u, "_blank", p);
|
|
631
631
|
return d.addEventListener("loadstart", function(g) {
|
|
632
632
|
if (g.url.indexOf(c()) == 0) {
|
|
633
633
|
d.close();
|
|
634
|
-
var
|
|
635
|
-
|
|
634
|
+
var S = E(g.url);
|
|
635
|
+
A(S, o);
|
|
636
636
|
}
|
|
637
637
|
}), o.promise;
|
|
638
638
|
},
|
|
@@ -654,25 +654,25 @@ For more information see: https://www.keycloak.org/securing-apps/javascript-adap
|
|
|
654
654
|
if (r == "cordova-native")
|
|
655
655
|
return h.enable = !1, {
|
|
656
656
|
login: async function(n) {
|
|
657
|
-
var o =
|
|
658
|
-
return universalLinks.subscribe("keycloak", function(
|
|
657
|
+
var o = w(), u = await e.createLoginUrl(n);
|
|
658
|
+
return universalLinks.subscribe("keycloak", function(p) {
|
|
659
659
|
universalLinks.unsubscribe("keycloak"), window.cordova.plugins.browsertab.close();
|
|
660
|
-
var d = E(
|
|
661
|
-
|
|
660
|
+
var d = E(p.url);
|
|
661
|
+
A(d, o);
|
|
662
662
|
}), window.cordova.plugins.browsertab.openUrl(u), o.promise;
|
|
663
663
|
},
|
|
664
664
|
logout: function(n) {
|
|
665
|
-
var o =
|
|
666
|
-
return universalLinks.subscribe("keycloak", function(
|
|
665
|
+
var o = w(), u = e.createLogoutUrl(n);
|
|
666
|
+
return universalLinks.subscribe("keycloak", function(p) {
|
|
667
667
|
universalLinks.unsubscribe("keycloak"), window.cordova.plugins.browsertab.close(), e.clearToken(), o.setSuccess();
|
|
668
668
|
}), window.cordova.plugins.browsertab.openUrl(u), o.promise;
|
|
669
669
|
},
|
|
670
670
|
register: async function(n) {
|
|
671
|
-
var o =
|
|
672
|
-
return universalLinks.subscribe("keycloak", function(
|
|
671
|
+
var o = w(), u = await e.createRegisterUrl(n);
|
|
672
|
+
return universalLinks.subscribe("keycloak", function(p) {
|
|
673
673
|
universalLinks.unsubscribe("keycloak"), window.cordova.plugins.browsertab.close();
|
|
674
|
-
var d = E(
|
|
675
|
-
|
|
674
|
+
var d = E(p.url);
|
|
675
|
+
A(d, o);
|
|
676
676
|
}), window.cordova.plugins.browsertab.openUrl(u), o.promise;
|
|
677
677
|
},
|
|
678
678
|
accountManagement: function() {
|
|
@@ -688,10 +688,10 @@ For more information see: https://www.keycloak.org/securing-apps/javascript-adap
|
|
|
688
688
|
};
|
|
689
689
|
throw "invalid adapter type: " + r;
|
|
690
690
|
}
|
|
691
|
-
const
|
|
692
|
-
var
|
|
693
|
-
if (!(this instanceof
|
|
694
|
-
return new
|
|
691
|
+
const L = "kc-callback-";
|
|
692
|
+
var j = function() {
|
|
693
|
+
if (!(this instanceof j))
|
|
694
|
+
return new j();
|
|
695
695
|
localStorage.setItem("kc-test", "test"), localStorage.removeItem("kc-test");
|
|
696
696
|
var r = this;
|
|
697
697
|
function t() {
|
|
@@ -706,7 +706,7 @@ For more information see: https://www.keycloak.org/securing-apps/javascript-adap
|
|
|
706
706
|
localStorage.removeItem(c);
|
|
707
707
|
}
|
|
708
708
|
function s() {
|
|
709
|
-
return Object.entries(localStorage).filter(([c]) => c.startsWith(
|
|
709
|
+
return Object.entries(localStorage).filter(([c]) => c.startsWith(L));
|
|
710
710
|
}
|
|
711
711
|
function a(c) {
|
|
712
712
|
let n;
|
|
@@ -715,19 +715,19 @@ For more information see: https://www.keycloak.org/securing-apps/javascript-adap
|
|
|
715
715
|
} catch {
|
|
716
716
|
return null;
|
|
717
717
|
}
|
|
718
|
-
return
|
|
718
|
+
return V(n) && "expires" in n && typeof n.expires == "number" ? n.expires : null;
|
|
719
719
|
}
|
|
720
720
|
r.get = function(c) {
|
|
721
721
|
if (c) {
|
|
722
|
-
var n =
|
|
722
|
+
var n = L + c, o = localStorage.getItem(n);
|
|
723
723
|
return o && (localStorage.removeItem(n), o = JSON.parse(o)), t(), o;
|
|
724
724
|
}
|
|
725
725
|
}, r.add = function(c) {
|
|
726
726
|
t();
|
|
727
|
-
const n =
|
|
727
|
+
const n = L + c.state, o = JSON.stringify({
|
|
728
728
|
...c,
|
|
729
729
|
// Set the expiry time to 1 hour from now.
|
|
730
|
-
expires: Date.now() +
|
|
730
|
+
expires: Date.now() + 3600 * 1e3
|
|
731
731
|
});
|
|
732
732
|
try {
|
|
733
733
|
localStorage.setItem(n, o);
|
|
@@ -735,18 +735,18 @@ For more information see: https://www.keycloak.org/securing-apps/javascript-adap
|
|
|
735
735
|
i(), localStorage.setItem(n, o);
|
|
736
736
|
}
|
|
737
737
|
};
|
|
738
|
-
},
|
|
739
|
-
if (!(this instanceof
|
|
740
|
-
return new
|
|
738
|
+
}, O = function() {
|
|
739
|
+
if (!(this instanceof O))
|
|
740
|
+
return new O();
|
|
741
741
|
var r = this;
|
|
742
742
|
r.get = function(a) {
|
|
743
743
|
if (a) {
|
|
744
|
-
var c = i(
|
|
745
|
-
if (s(
|
|
744
|
+
var c = i(L + a);
|
|
745
|
+
if (s(L + a, "", t(-100)), c)
|
|
746
746
|
return JSON.parse(c);
|
|
747
747
|
}
|
|
748
748
|
}, r.add = function(a) {
|
|
749
|
-
s(
|
|
749
|
+
s(L + a.state, JSON.stringify(a), t(60));
|
|
750
750
|
}, r.removeItem = function(a) {
|
|
751
751
|
s(a, "", t(-100));
|
|
752
752
|
};
|
|
@@ -768,45 +768,45 @@ For more information see: https://www.keycloak.org/securing-apps/javascript-adap
|
|
|
768
768
|
};
|
|
769
769
|
function ne() {
|
|
770
770
|
try {
|
|
771
|
-
return new
|
|
771
|
+
return new j();
|
|
772
772
|
} catch {
|
|
773
773
|
}
|
|
774
|
-
return new
|
|
774
|
+
return new O();
|
|
775
775
|
}
|
|
776
|
-
function
|
|
776
|
+
function X(r) {
|
|
777
777
|
return function() {
|
|
778
778
|
e.enableLogging && r.apply(console, Array.prototype.slice.call(arguments));
|
|
779
779
|
};
|
|
780
780
|
}
|
|
781
781
|
}
|
|
782
|
-
function
|
|
783
|
-
const e = String.fromCodePoint(...
|
|
782
|
+
function ie(l) {
|
|
783
|
+
const e = String.fromCodePoint(...l);
|
|
784
784
|
return btoa(e);
|
|
785
785
|
}
|
|
786
|
-
async function
|
|
787
|
-
const
|
|
786
|
+
async function ce(l) {
|
|
787
|
+
const f = new TextEncoder().encode(l);
|
|
788
788
|
if (typeof crypto > "u" || typeof crypto.subtle > "u")
|
|
789
789
|
throw new Error("Web Crypto API is not available.");
|
|
790
|
-
return await crypto.subtle.digest("SHA-256",
|
|
790
|
+
return await crypto.subtle.digest("SHA-256", f);
|
|
791
791
|
}
|
|
792
|
-
function
|
|
793
|
-
const [e,
|
|
794
|
-
if (typeof
|
|
792
|
+
function J(l) {
|
|
793
|
+
const [e, f] = l.split(".");
|
|
794
|
+
if (typeof f != "string")
|
|
795
795
|
throw new Error("Unable to decode token, payload not found.");
|
|
796
|
-
let
|
|
796
|
+
let k;
|
|
797
797
|
try {
|
|
798
|
-
|
|
799
|
-
} catch (
|
|
800
|
-
throw new Error("Unable to decode token, payload is not a valid Base64URL value.", { cause:
|
|
798
|
+
k = ue(f);
|
|
799
|
+
} catch (m) {
|
|
800
|
+
throw new Error("Unable to decode token, payload is not a valid Base64URL value.", { cause: m });
|
|
801
801
|
}
|
|
802
802
|
try {
|
|
803
|
-
return JSON.parse(
|
|
804
|
-
} catch (
|
|
805
|
-
throw new Error("Unable to decode token, payload is not a valid JSON value.", { cause:
|
|
803
|
+
return JSON.parse(k);
|
|
804
|
+
} catch (m) {
|
|
805
|
+
throw new Error("Unable to decode token, payload is not a valid JSON value.", { cause: m });
|
|
806
806
|
}
|
|
807
807
|
}
|
|
808
|
-
function
|
|
809
|
-
let e =
|
|
808
|
+
function ue(l) {
|
|
809
|
+
let e = l.replaceAll("-", "+").replaceAll("_", "/");
|
|
810
810
|
switch (e.length % 4) {
|
|
811
811
|
case 0:
|
|
812
812
|
break;
|
|
@@ -820,145 +820,158 @@ function ce(k) {
|
|
|
820
820
|
throw new Error("Input is not of the correct length.");
|
|
821
821
|
}
|
|
822
822
|
try {
|
|
823
|
-
return
|
|
823
|
+
return le(e);
|
|
824
824
|
} catch {
|
|
825
825
|
return atob(e);
|
|
826
826
|
}
|
|
827
827
|
}
|
|
828
|
-
function
|
|
829
|
-
return decodeURIComponent(atob(
|
|
830
|
-
let
|
|
831
|
-
return
|
|
828
|
+
function le(l) {
|
|
829
|
+
return decodeURIComponent(atob(l).replace(/(.)/g, (e, f) => {
|
|
830
|
+
let k = f.charCodeAt(0).toString(16).toUpperCase();
|
|
831
|
+
return k.length < 2 && (k = "0" + k), "%" + k;
|
|
832
832
|
}));
|
|
833
833
|
}
|
|
834
|
-
function
|
|
835
|
-
return typeof
|
|
834
|
+
function V(l) {
|
|
835
|
+
return typeof l == "object" && l !== null;
|
|
836
836
|
}
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
const { VITE_KEYCLOAK_REALM: e, VITE_KEYCLOAK_HOST: p, VITE_KEYCLOAK_CLIENT_ID: m } = le;
|
|
841
|
-
super({
|
|
842
|
-
url: p,
|
|
843
|
-
realm: e,
|
|
844
|
-
clientId: m
|
|
845
|
-
});
|
|
837
|
+
class Y extends $ {
|
|
838
|
+
constructor(e) {
|
|
839
|
+
super(e);
|
|
846
840
|
}
|
|
847
841
|
async initialize() {
|
|
848
842
|
try {
|
|
849
|
-
await this.init(
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
) && console.log("User is authenticated"), console.log("User is not authenticated");
|
|
843
|
+
const e = await this.init({
|
|
844
|
+
onLoad: "login-required"
|
|
845
|
+
});
|
|
846
|
+
console.log(e ? "User is authenticated" : "User is not authenticated");
|
|
854
847
|
} catch (e) {
|
|
855
848
|
console.error("Failed to initialize adapter:", e);
|
|
856
849
|
}
|
|
857
850
|
}
|
|
858
|
-
static async init() {
|
|
859
|
-
const
|
|
860
|
-
return await
|
|
851
|
+
static async init(e) {
|
|
852
|
+
const f = new Y(e);
|
|
853
|
+
return console.log("KeycloakAdapter", e), await f.initialize(), f;
|
|
861
854
|
}
|
|
862
855
|
get userInfo() {
|
|
863
856
|
return this.idTokenParsed;
|
|
864
857
|
}
|
|
865
858
|
updateToken() {
|
|
866
|
-
return
|
|
859
|
+
return console.log("update the token"), super.updateToken(30);
|
|
867
860
|
}
|
|
868
861
|
get isAuthenticated() {
|
|
869
862
|
return this.authenticated ?? !1;
|
|
870
863
|
}
|
|
871
864
|
}
|
|
872
|
-
const de =
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
865
|
+
const de = {
|
|
866
|
+
skipAuthentication: !1
|
|
867
|
+
}, pe = (l) => {
|
|
868
|
+
const e = oe(!1);
|
|
869
|
+
let f;
|
|
870
|
+
const k = { ...de, ...l }, m = async () => {
|
|
871
|
+
const v = await Y.init(l.keycloak);
|
|
872
|
+
return f = v, e.value = !0, v;
|
|
873
|
+
}, h = () => f == null ? void 0 : f.token, y = async () => {
|
|
874
|
+
if (!f)
|
|
875
|
+
return m();
|
|
876
|
+
e.value || await new Promise((v) => {
|
|
877
|
+
const M = se(e, (N) => {
|
|
878
|
+
N && (M(), v());
|
|
879
|
+
});
|
|
880
|
+
});
|
|
881
|
+
}, C = ae({
|
|
882
|
+
install(v) {
|
|
883
|
+
v.runWithContext(() => {
|
|
884
|
+
v.config.globalProperties.$auth = k, v.provide(F, C);
|
|
885
|
+
});
|
|
878
886
|
},
|
|
879
|
-
|
|
880
|
-
var
|
|
881
|
-
return (
|
|
887
|
+
updateToken: async () => {
|
|
888
|
+
var v;
|
|
889
|
+
return (v = await y()) == null ? void 0 : v.updateToken();
|
|
882
890
|
},
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
891
|
+
token: h,
|
|
892
|
+
user: async () => {
|
|
893
|
+
var v;
|
|
894
|
+
return (v = await y()) == null ? void 0 : v.userInfo;
|
|
886
895
|
},
|
|
887
|
-
logout: () => {
|
|
888
|
-
|
|
896
|
+
logout: async () => {
|
|
897
|
+
var v;
|
|
898
|
+
return (v = await y()) == null ? void 0 : v.logout();
|
|
889
899
|
},
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
};
|
|
899
|
-
}), pe = "GHENT_CDH_HTTP_REQUEST", ke = G(pe, () => {
|
|
900
|
-
const k = fe(), e = async (p, m, l = { contentType: "application/json" }) => {
|
|
901
|
-
const h = {
|
|
900
|
+
options: k
|
|
901
|
+
});
|
|
902
|
+
return C;
|
|
903
|
+
}, he = () => {
|
|
904
|
+
const l = W(F);
|
|
905
|
+
l || console.warn("No auth provided, authorized calls may not work");
|
|
906
|
+
const e = async (f, k, m = { contentType: "application/json" }) => {
|
|
907
|
+
const h = (m == null ? void 0 : m.skipAuth) ?? (l == null ? void 0 : l.options.skipAuthentication), y = {
|
|
902
908
|
accept: "application/json",
|
|
903
|
-
...
|
|
909
|
+
...k.headers ?? {}
|
|
904
910
|
};
|
|
905
|
-
|
|
906
|
-
const b = new URL(
|
|
907
|
-
if (
|
|
908
|
-
for (const [
|
|
909
|
-
b.searchParams.set(
|
|
910
|
-
const
|
|
911
|
-
...
|
|
912
|
-
headers:
|
|
911
|
+
m.contentType && (y["Content-Type"] = m.contentType), h || (await (l == null ? void 0 : l.updateToken()), y.Authorization = `Bearer ${l == null ? void 0 : l.token()}`);
|
|
912
|
+
const b = new URL(f, window.location.href);
|
|
913
|
+
if (m != null && m.queryParams)
|
|
914
|
+
for (const [R, C] of Object.entries(m.queryParams))
|
|
915
|
+
b.searchParams.set(R, C);
|
|
916
|
+
const T = await fetch(b.toString(), {
|
|
917
|
+
...k,
|
|
918
|
+
headers: y
|
|
913
919
|
});
|
|
914
|
-
return
|
|
915
|
-
content:
|
|
916
|
-
status:
|
|
920
|
+
return T.ok ? T.json() : (m != null && m.skipAuth, Promise.reject({
|
|
921
|
+
content: T.body,
|
|
922
|
+
status: T.status
|
|
917
923
|
}));
|
|
918
924
|
};
|
|
919
925
|
return {
|
|
920
|
-
get: (
|
|
921
|
-
postFile: (
|
|
922
|
-
const
|
|
923
|
-
for (const
|
|
924
|
-
|
|
925
|
-
return
|
|
926
|
-
|
|
926
|
+
get: (f, k) => e(f, { method: "GET" }, k),
|
|
927
|
+
postFile: (f, k, m = {}, h) => {
|
|
928
|
+
const y = new FormData();
|
|
929
|
+
for (const b in m)
|
|
930
|
+
y.append(b, m[b]);
|
|
931
|
+
return y.append("file", k), e(
|
|
932
|
+
f,
|
|
927
933
|
{
|
|
928
934
|
method: "POST",
|
|
929
|
-
body:
|
|
935
|
+
body: y
|
|
930
936
|
},
|
|
931
937
|
{ ...h, contentType: void 0 }
|
|
932
938
|
);
|
|
933
939
|
},
|
|
934
|
-
post: (
|
|
935
|
-
|
|
940
|
+
post: (f, k, m) => e(
|
|
941
|
+
f,
|
|
936
942
|
{
|
|
937
943
|
method: "POST",
|
|
938
|
-
body: JSON.stringify(
|
|
944
|
+
body: JSON.stringify(k)
|
|
939
945
|
},
|
|
940
|
-
|
|
946
|
+
m
|
|
941
947
|
),
|
|
942
|
-
patch: (
|
|
943
|
-
|
|
948
|
+
patch: (f, k, m) => e(
|
|
949
|
+
f,
|
|
944
950
|
{
|
|
945
951
|
method: "PATCH",
|
|
946
|
-
body: JSON.stringify(
|
|
952
|
+
body: JSON.stringify(k)
|
|
947
953
|
},
|
|
948
|
-
|
|
954
|
+
m
|
|
949
955
|
),
|
|
950
|
-
delete: (
|
|
951
|
-
|
|
956
|
+
delete: (f, k, m) => e(
|
|
957
|
+
f,
|
|
952
958
|
{
|
|
953
959
|
method: "DELETE",
|
|
954
|
-
body: JSON.stringify(
|
|
960
|
+
body: JSON.stringify(k)
|
|
955
961
|
},
|
|
956
|
-
|
|
962
|
+
m
|
|
957
963
|
)
|
|
958
964
|
};
|
|
959
|
-
})
|
|
965
|
+
}, me = () => {
|
|
966
|
+
const l = W(F);
|
|
967
|
+
return l || console.warn("No auth provided, authorized calls may not work"), {
|
|
968
|
+
isAuthenticated: () => !!(l != null && l.user()),
|
|
969
|
+
getUser: () => l == null ? void 0 : l.user(),
|
|
970
|
+
logout: () => l == null ? void 0 : l.logout()
|
|
971
|
+
};
|
|
972
|
+
};
|
|
960
973
|
export {
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
974
|
+
pe as createAuth,
|
|
975
|
+
me as useAuthenticate,
|
|
976
|
+
he as useHttpRequest
|
|
964
977
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { App } from 'vue';
|
|
2
|
+
import { KeycloakConfig } from './keycloak.adapter';
|
|
3
|
+
export declare const auth_symbol = "GHENTCDH_AUTHENTICATION";
|
|
4
|
+
export type AuthOptions = {
|
|
5
|
+
skipAuthentication?: boolean;
|
|
6
|
+
keycloak: KeycloakConfig;
|
|
7
|
+
};
|
|
8
|
+
export interface Auth {
|
|
9
|
+
install: (app: App) => void;
|
|
10
|
+
updateToken: () => Promise<void>;
|
|
11
|
+
token: () => string;
|
|
12
|
+
user: () => Promise<any>;
|
|
13
|
+
logout: () => Promise<any>;
|
|
14
|
+
isAuthenticated: () => Promise<boolean>;
|
|
15
|
+
options: AuthOptions;
|
|
16
|
+
}
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { default as Keycloak } from 'keycloak-js';
|
|
2
|
+
export type KeycloakConfig = {
|
|
3
|
+
realm: string;
|
|
4
|
+
url: string;
|
|
5
|
+
clientId: string;
|
|
6
|
+
};
|
|
2
7
|
export declare class KeycloakAdapter extends Keycloak {
|
|
3
8
|
private constructor();
|
|
4
9
|
private initialize;
|
|
5
|
-
static init(): Promise<KeycloakAdapter>;
|
|
10
|
+
static init(config: KeycloakConfig): Promise<KeycloakAdapter>;
|
|
6
11
|
get userInfo(): any;
|
|
7
12
|
updateToken(): any;
|
|
8
13
|
get isAuthenticated(): any;
|
package/lib/request.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
type RequestOptions = {
|
|
2
|
+
skipAuth?: boolean;
|
|
3
|
+
queryParams?: Record<string, any>;
|
|
4
|
+
contentType?: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const useHttpRequest: () => {
|
|
7
|
+
get: <T>(url: string, options?: RequestOptions) => Promise<T>;
|
|
8
|
+
postFile: <T>(url: string, file: File, data?: any, options?: RequestOptions) => Promise<T>;
|
|
9
|
+
post: <T>(url: string, data: any, options?: RequestOptions) => Promise<T>;
|
|
10
|
+
patch: <T>(url: string, data: any, options?: RequestOptions) => Promise<T>;
|
|
11
|
+
delete: <T>(url: string, data?: any, options?: RequestOptions) => Promise<T>;
|
|
12
|
+
};
|
|
13
|
+
export {};
|
package/lib/utils.d.ts
ADDED
package/package.json
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ghentcdh/authentication-vue",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "0.0
|
|
4
|
+
"version": "0.1.0",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"types": "./index.d.ts",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"vue": "^3.5.13",
|
|
9
|
-
"pinia": "^3.0.1",
|
|
10
9
|
"keycloak-js": "^26.1.2"
|
|
11
10
|
},
|
|
12
11
|
"exports": {
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export declare const useAuthenticationStore: import('pinia').StoreDefinition<"GHENT_CDH_AUTH_STORE", Pick<{
|
|
2
|
-
token: () => any;
|
|
3
|
-
user: () => any;
|
|
4
|
-
isAuthenticated: () => any;
|
|
5
|
-
logout: () => void;
|
|
6
|
-
updateToken: () => Promise<any>;
|
|
7
|
-
}, never>, Pick<{
|
|
8
|
-
token: () => any;
|
|
9
|
-
user: () => any;
|
|
10
|
-
isAuthenticated: () => any;
|
|
11
|
-
logout: () => void;
|
|
12
|
-
updateToken: () => Promise<any>;
|
|
13
|
-
}, never>, Pick<{
|
|
14
|
-
token: () => any;
|
|
15
|
-
user: () => any;
|
|
16
|
-
isAuthenticated: () => any;
|
|
17
|
-
logout: () => void;
|
|
18
|
-
updateToken: () => Promise<any>;
|
|
19
|
-
}, "token" | "user" | "isAuthenticated" | "logout" | "updateToken">>;
|
package/lib/request.store.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
type RequestOptions = {
|
|
2
|
-
skipAuth?: boolean;
|
|
3
|
-
queryParams?: Record<string, any>;
|
|
4
|
-
contentType?: string;
|
|
5
|
-
};
|
|
6
|
-
export declare const useHttpStore: import('pinia').StoreDefinition<"GHENT_CDH_HTTP_REQUEST", Pick<{
|
|
7
|
-
get: <T>(url: string, options?: RequestOptions) => Promise<T>;
|
|
8
|
-
postFile: <T>(url: string, file: File, data?: any, options?: RequestOptions) => Promise<T>;
|
|
9
|
-
post: <T>(url: string, data: any, options?: RequestOptions) => Promise<T>;
|
|
10
|
-
patch: <T>(url: string, data: any, options?: RequestOptions) => Promise<T>;
|
|
11
|
-
delete: <T>(url: string, data?: any, options?: RequestOptions) => Promise<T>;
|
|
12
|
-
}, never>, Pick<{
|
|
13
|
-
get: <T>(url: string, options?: RequestOptions) => Promise<T>;
|
|
14
|
-
postFile: <T>(url: string, file: File, data?: any, options?: RequestOptions) => Promise<T>;
|
|
15
|
-
post: <T>(url: string, data: any, options?: RequestOptions) => Promise<T>;
|
|
16
|
-
patch: <T>(url: string, data: any, options?: RequestOptions) => Promise<T>;
|
|
17
|
-
delete: <T>(url: string, data?: any, options?: RequestOptions) => Promise<T>;
|
|
18
|
-
}, never>, Pick<{
|
|
19
|
-
get: <T>(url: string, options?: RequestOptions) => Promise<T>;
|
|
20
|
-
postFile: <T>(url: string, file: File, data?: any, options?: RequestOptions) => Promise<T>;
|
|
21
|
-
post: <T>(url: string, data: any, options?: RequestOptions) => Promise<T>;
|
|
22
|
-
patch: <T>(url: string, data: any, options?: RequestOptions) => Promise<T>;
|
|
23
|
-
delete: <T>(url: string, data?: any, options?: RequestOptions) => Promise<T>;
|
|
24
|
-
}, "get" | "postFile" | "post" | "patch" | "delete">>;
|
|
25
|
-
export {};
|