@tapni/auth 1.0.11 → 1.0.13
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/.vite/manifest.json +12 -12
- package/dist/{Apps-D903yvip.js → Apps-DeRIQjBx.js} +1 -1
- package/dist/{Billing-CQp6b4tB.js → Billing-DsilesKo.js} +1 -1
- package/dist/{CustomApp-h6WA5um0.js → CustomApp-CEzhE2YM.js} +1 -1
- package/dist/{General-DA3IgC3X.js → General-C9CUD54h.js} +1 -1
- package/dist/{QR-BxHBi2nV.js → QR-ShTn8gSL.js} +1 -1
- package/dist/TapniAuth.es.js +1 -1
- package/dist/TapniAuth.umd.js +2 -2
- package/dist/{install-DfWX9rnL.js → install-A3lGv2lC.js} +3 -3
- package/package.json +1 -1
- package/src/mixins/saml.mixin.js +90 -40
|
@@ -1397,7 +1397,7 @@ function pa(n, e, t, r, o, i) {
|
|
|
1397
1397
|
const ao = /* @__PURE__ */ _t(oa, [["render", pa], ["__scopeId", "data-v-7aad6400"]]), ha = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1398
1398
|
__proto__: null,
|
|
1399
1399
|
default: ao
|
|
1400
|
-
}, Symbol.toStringTag, { value: "Module" })), fa = "1.0.
|
|
1400
|
+
}, Symbol.toStringTag, { value: "Module" })), fa = "1.0.12", cr = {
|
|
1401
1401
|
getMe() {
|
|
1402
1402
|
return le().get("/users/me");
|
|
1403
1403
|
},
|
|
@@ -5563,7 +5563,7 @@ Tanıştığınız herkesi etkileyin 😎 <br> Kendinize bir tane ayırın 👇`
|
|
|
5563
5563
|
choose_other_login_methods: "다른 로그인 방법 선택하기",
|
|
5564
5564
|
no_sso_logins: "귀하의 회사는 SSO 로그인을 사용하지 않습니다. 관리자에게 문의하십시오."
|
|
5565
5565
|
}
|
|
5566
|
-
}, To = () => Promise.resolve().then(() => ha), ma = () => Promise.resolve().then(() => mc), _a = () => Promise.resolve().then(() => cl), va = () => Promise.resolve().then(() => Xu), ya = () => Promise.resolve().then(() => zc), wa = () => Promise.resolve().then(() => Cl), ba = () => Promise.resolve().then(() => od), ka = () => import("./QR-
|
|
5566
|
+
}, To = () => Promise.resolve().then(() => ha), ma = () => Promise.resolve().then(() => mc), _a = () => Promise.resolve().then(() => cl), va = () => Promise.resolve().then(() => Xu), ya = () => Promise.resolve().then(() => zc), wa = () => Promise.resolve().then(() => Cl), ba = () => Promise.resolve().then(() => od), ka = () => import("./QR-ShTn8gSL.js"), Ca = () => Promise.resolve().then(() => Cu), Ea = () => import("./Apps-DeRIQjBx.js"), Ta = () => import("./Billing-DsilesKo.js"), Sa = () => import("./CustomApp-CEzhE2YM.js"), Ia = () => import("./General-C9CUD54h.js"), Aa = [
|
|
5567
5567
|
{
|
|
5568
5568
|
path: "/welcome",
|
|
5569
5569
|
name: "AuthWelcome",
|
|
@@ -15218,7 +15218,7 @@ const xs = Ir("MsAuthPlugin", {
|
|
|
15218
15218
|
let o = this;
|
|
15219
15219
|
window.addEventListener("message", async (i) => {
|
|
15220
15220
|
var a;
|
|
15221
|
-
if (!this.allowedOriginsAuth.includes(i.origin)) return console.log("Origin is not allowed!");
|
|
15221
|
+
if (!this.allowedOriginsAuth.includes(i.origin)) return console.log("Origin is not allowed! " + i.origin);
|
|
15222
15222
|
if (i.data.type === "saml" && i.data.code) {
|
|
15223
15223
|
if (this.display === "popup")
|
|
15224
15224
|
return (a = window.parent) == null ? void 0 : a.postMessage({ code: i.data.code, state: this.$route.query.state, code_verifier: localStorage.getItem("pkce_code_verifier") }, "*");
|
package/package.json
CHANGED
package/src/mixins/saml.mixin.js
CHANGED
|
@@ -6,21 +6,30 @@ export default {
|
|
|
6
6
|
data () {
|
|
7
7
|
return {
|
|
8
8
|
code_verifier: '',
|
|
9
|
-
code_challenge: ''
|
|
10
|
-
|
|
9
|
+
code_challenge: '',
|
|
10
|
+
shouldCloseWindow: false,
|
|
11
|
+
popupWindow: null,
|
|
12
|
+
checkInterval: null
|
|
13
|
+
};
|
|
11
14
|
},
|
|
12
15
|
computed: {
|
|
13
16
|
},
|
|
14
17
|
watch: {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
'$route.path' (nv) {
|
|
19
|
+
if (nv === '/callback/saml') {
|
|
20
|
+
this.handleSamlRedirect(nv)
|
|
21
|
+
}
|
|
18
22
|
}
|
|
19
|
-
*/
|
|
20
23
|
},
|
|
21
24
|
methods: {
|
|
22
|
-
|
|
23
|
-
|
|
25
|
+
closeWindow() {
|
|
26
|
+
try {
|
|
27
|
+
window.close()
|
|
28
|
+
} catch (e) {
|
|
29
|
+
console.log('Window close error', e);
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
async samlLogin(loginUrl) {
|
|
24
33
|
// Create and store a new PKCE code_verifier (the plaintext random secret)
|
|
25
34
|
this.code_verifier = UtilService.generateRandomString(28);
|
|
26
35
|
localStorage.setItem("pkce_code_verifier", this.code_verifier);
|
|
@@ -31,57 +40,98 @@ export default {
|
|
|
31
40
|
const platform = Capacitor.getPlatform();
|
|
32
41
|
|
|
33
42
|
// append public key as relayState
|
|
34
|
-
let dataString = `code_challenge=${this.code_challenge}&platform=${platform}&redirect_uri=${
|
|
43
|
+
let dataString = `code_challenge=${this.code_challenge}&platform=${platform}&redirect_uri=${location.origin + '/callback/saml'}&realm=${this.realm}&display=${this.display}`;
|
|
35
44
|
let relayState = btoa(dataString);
|
|
36
45
|
|
|
37
46
|
loginUrl = `${loginUrl}&RelayState=${relayState}`
|
|
38
47
|
|
|
39
48
|
let self = this;
|
|
40
49
|
|
|
41
|
-
window.addEventListener(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
if (this.
|
|
45
|
-
|
|
50
|
+
window.addEventListener(
|
|
51
|
+
'message',
|
|
52
|
+
async (message) => {
|
|
53
|
+
if (!this.allowedOriginsAuth.includes(message.origin)) return console.log('Origin is not allowed! ' + message.origin);
|
|
54
|
+
if (message.data.code) {
|
|
55
|
+
console.log('post message from opener', message.data, self.display);
|
|
56
|
+
|
|
57
|
+
if (self.display === 'popup') {
|
|
58
|
+
return window.parent?.postMessage({ code: message.data.code, state: message.data.state, code_verifier: localStorage.getItem('pkce_code_verifier') }, '*');
|
|
59
|
+
}
|
|
60
|
+
await self.exchangeAuthCode({ code: message.data.code, code_verifier: localStorage.getItem('pkce_code_verifier') });
|
|
61
|
+
localStorage.removeItem('pkce_code_verifier');
|
|
46
62
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
63
|
+
},
|
|
64
|
+
{ once: true }
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
if (this.isNative) {
|
|
68
|
+
this.popupWindow = await Browser.open({ url: loginUrl, presentationStyle: 'popover' });
|
|
69
|
+
} else {
|
|
70
|
+
this.checkInterval = setInterval(() => {
|
|
71
|
+
// check localStorage
|
|
72
|
+
const code = localStorage.getItem('auth_code');
|
|
73
|
+
const pkce = localStorage.getItem('pkce_code_verifier');
|
|
51
74
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
75
|
+
console.log('interval', code, pkce);
|
|
76
|
+
|
|
77
|
+
if (code) {
|
|
78
|
+
clearInterval(this.checkInterval);
|
|
79
|
+
localStorage.removeItem('auth_code');
|
|
80
|
+
localStorage.removeItem('pkce_code_verifier');
|
|
81
|
+
|
|
82
|
+
// handle code exchange
|
|
83
|
+
window.parent?.postMessage({ code: code, state: this.$route.query.state, code_verifier: pkce }, '*');
|
|
84
|
+
|
|
85
|
+
// attempt to close child if possible
|
|
86
|
+
// if (this.popupWindow?.closed === false) this.popupWindow.close();
|
|
87
|
+
}
|
|
88
|
+
}, 500);
|
|
89
|
+
|
|
90
|
+
this.popupWindow = window.open('https://auth.tapni.com/callback/redirect?uri=' + btoa(loginUrl), 'popup', 'width=600,height=600');
|
|
55
91
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
92
|
+
|
|
93
|
+
if (this.popupWindow) {
|
|
94
|
+
this.popupWindow.addEventListener('beforeunload', () => {
|
|
95
|
+
console.log('popup window closed');
|
|
96
|
+
})
|
|
97
|
+
}
|
|
98
|
+
|
|
62
99
|
},
|
|
63
100
|
async handleSamlRedirect() {
|
|
64
101
|
let code;
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
102
|
+
if (this.$route.query.code) {
|
|
103
|
+
code = this.$route.query.code
|
|
104
|
+
}
|
|
105
|
+
console.log('window1', window.opener);
|
|
106
|
+
console.log('window2', window.parent);
|
|
107
|
+
if (window.opener) {
|
|
108
|
+
window.opener.postMessage({ type: 'saml', code }, '*');
|
|
109
|
+
this.closeWindow();
|
|
70
110
|
} else {
|
|
71
|
-
if(this.isNative && this.isiOS) await Browser.close();
|
|
72
|
-
EventBus.$emit('ssoEvent', {name: 'setLoading', data: true})
|
|
73
|
-
if (this.$route.query.code) code = this.$route.query.code
|
|
111
|
+
if (this.isNative && this.isiOS) await Browser.close();
|
|
112
|
+
EventBus.$emit('ssoEvent', { name: 'setLoading', data: true });
|
|
74
113
|
|
|
75
|
-
console.log(this.display, {code});
|
|
114
|
+
console.log(this.display, { code }, window.parent, window.opener);
|
|
76
115
|
|
|
77
116
|
if (code) {
|
|
78
117
|
if (this.display === 'popup') {
|
|
79
|
-
|
|
118
|
+
localStorage.setItem('auth_code', code);
|
|
119
|
+
this.shouldCloseWindow = true;
|
|
120
|
+
window.parent?.postMessage({ code: code, state: this.$route.query.state }, '*');
|
|
121
|
+
this.closeWindow()
|
|
122
|
+
}
|
|
123
|
+
// TODO: Replace URLs with .env variables to support staging
|
|
124
|
+
if (this.display === 'redirect' || location.host === 'auth.tapni.com') {
|
|
125
|
+
let redirect_url = 'https://auth.tapni.com/callback/auth';
|
|
126
|
+
if (this.realm === 'dashboard') {
|
|
127
|
+
redirect_url = 'https://business.tapni.com/login'
|
|
128
|
+
}
|
|
129
|
+
return location.href = redirect_url + '?code=' + code + '&code_verifier=' + localStorage.getItem('pkce_code_verifier');
|
|
80
130
|
}
|
|
81
|
-
await this.exchangeAuthCode({code, code_verifier: localStorage.getItem(
|
|
131
|
+
await this.exchangeAuthCode({ code, code_verifier: localStorage.getItem('pkce_code_verifier') });
|
|
82
132
|
}
|
|
83
|
-
localStorage.removeItem(
|
|
84
|
-
EventBus.$emit('ssoEvent', {name: 'setLoading', data: false})
|
|
133
|
+
// localStorage.removeItem('pkce_code_verifier');
|
|
134
|
+
EventBus.$emit('ssoEvent', { name: 'setLoading', data: false });
|
|
85
135
|
}
|
|
86
136
|
}
|
|
87
137
|
},
|