initial
This commit is contained in:
commit
12759342cc
24
.gitignore
vendored
Normal file
24
.gitignore
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
lerna-debug.log*
|
||||
|
||||
node_modules
|
||||
dist
|
||||
dist-ssr
|
||||
*.local
|
||||
|
||||
# Editor directories and files
|
||||
.vscode/*
|
||||
!.vscode/extensions.json
|
||||
.idea
|
||||
.DS_Store
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
3
.vscode/extensions.json
vendored
Normal file
3
.vscode/extensions.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"recommendations": ["Vue.volar", "Vue.vscode-typescript-vue-plugin"]
|
||||
}
|
7
README.md
Normal file
7
README.md
Normal file
@ -0,0 +1,7 @@
|
||||
# Vue 3 + Vite
|
||||
|
||||
This template should help get you started developing with Vue 3 in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
|
||||
|
||||
## Recommended IDE Setup
|
||||
|
||||
- [VS Code](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).
|
31
package.json
Normal file
31
package.json
Normal file
@ -0,0 +1,31 @@
|
||||
{
|
||||
"name": "vue3-keycloak",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
"repository": "",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"main": "./dist/umd.js",
|
||||
"module": "./dist/es.js",
|
||||
"exports": {
|
||||
".": {
|
||||
"import": "./dist/es.js",
|
||||
"require": "./dist/umd.js"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"keycloak-js": "^21.0.1",
|
||||
"vue": "^3.2.45"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vitejs/plugin-vue": "^4.0.0",
|
||||
"vite": "^4.1.0"
|
||||
}
|
||||
}
|
503
pnpm-lock.yaml
generated
Normal file
503
pnpm-lock.yaml
generated
Normal file
@ -0,0 +1,503 @@
|
||||
lockfileVersion: 5.4
|
||||
|
||||
specifiers:
|
||||
'@vitejs/plugin-vue': ^4.0.0
|
||||
keycloak-js: ^21.0.1
|
||||
vite: ^4.1.0
|
||||
vue: ^3.2.45
|
||||
|
||||
dependencies:
|
||||
keycloak-js: 21.0.1
|
||||
vue: 3.2.47
|
||||
|
||||
devDependencies:
|
||||
'@vitejs/plugin-vue': 4.0.0_vite@4.1.4+vue@3.2.47
|
||||
vite: 4.1.4
|
||||
|
||||
packages:
|
||||
|
||||
/@babel/helper-string-parser/7.19.4:
|
||||
resolution: {integrity: sha512-nHtDoQcuqFmwYNYPz3Rah5ph2p8PFeFCsZk9A/48dPc/rGocJ5J3hAAZ7pb76VWX3fZKu+uEr/FhH5jLx7umrw==}
|
||||
engines: {node: '>=6.9.0'}
|
||||
|
||||
/@babel/helper-validator-identifier/7.19.1:
|
||||
resolution: {integrity: sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==}
|
||||
engines: {node: '>=6.9.0'}
|
||||
|
||||
/@babel/parser/7.21.2:
|
||||
resolution: {integrity: sha512-URpaIJQwEkEC2T9Kn+Ai6Xe/02iNaVCuT/PtoRz3GPVJVDpPd7mLo+VddTbhCRU9TXqW5mSrQfXZyi8kDKOVpQ==}
|
||||
engines: {node: '>=6.0.0'}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
'@babel/types': 7.21.2
|
||||
|
||||
/@babel/types/7.21.2:
|
||||
resolution: {integrity: sha512-3wRZSs7jiFaB8AjxiiD+VqN5DTG2iRvJGQ+qYFrs/654lg6kGTQWIOFjlBo5RaXuAZjBmP3+OQH4dmhqiiyYxw==}
|
||||
engines: {node: '>=6.9.0'}
|
||||
dependencies:
|
||||
'@babel/helper-string-parser': 7.19.4
|
||||
'@babel/helper-validator-identifier': 7.19.1
|
||||
to-fast-properties: 2.0.0
|
||||
|
||||
/@esbuild/android-arm/0.16.17:
|
||||
resolution: {integrity: sha512-N9x1CMXVhtWEAMS7pNNONyA14f71VPQN9Cnavj1XQh6T7bskqiLLrSca4O0Vr8Wdcga943eThxnVp3JLnBMYtw==}
|
||||
engines: {node: '>=12'}
|
||||
cpu: [arm]
|
||||
os: [android]
|
||||
requiresBuild: true
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/@esbuild/android-arm64/0.16.17:
|
||||
resolution: {integrity: sha512-MIGl6p5sc3RDTLLkYL1MyL8BMRN4tLMRCn+yRJJmEDvYZ2M7tmAf80hx1kbNEUX2KJ50RRtxZ4JHLvCfuB6kBg==}
|
||||
engines: {node: '>=12'}
|
||||
cpu: [arm64]
|
||||
os: [android]
|
||||
requiresBuild: true
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/@esbuild/android-x64/0.16.17:
|
||||
resolution: {integrity: sha512-a3kTv3m0Ghh4z1DaFEuEDfz3OLONKuFvI4Xqczqx4BqLyuFaFkuaG4j2MtA6fuWEFeC5x9IvqnX7drmRq/fyAQ==}
|
||||
engines: {node: '>=12'}
|
||||
cpu: [x64]
|
||||
os: [android]
|
||||
requiresBuild: true
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/@esbuild/darwin-arm64/0.16.17:
|
||||
resolution: {integrity: sha512-/2agbUEfmxWHi9ARTX6OQ/KgXnOWfsNlTeLcoV7HSuSTv63E4DqtAc+2XqGw1KHxKMHGZgbVCZge7HXWX9Vn+w==}
|
||||
engines: {node: '>=12'}
|
||||
cpu: [arm64]
|
||||
os: [darwin]
|
||||
requiresBuild: true
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/@esbuild/darwin-x64/0.16.17:
|
||||
resolution: {integrity: sha512-2By45OBHulkd9Svy5IOCZt376Aa2oOkiE9QWUK9fe6Tb+WDr8hXL3dpqi+DeLiMed8tVXspzsTAvd0jUl96wmg==}
|
||||
engines: {node: '>=12'}
|
||||
cpu: [x64]
|
||||
os: [darwin]
|
||||
requiresBuild: true
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/@esbuild/freebsd-arm64/0.16.17:
|
||||
resolution: {integrity: sha512-mt+cxZe1tVx489VTb4mBAOo2aKSnJ33L9fr25JXpqQqzbUIw/yzIzi+NHwAXK2qYV1lEFp4OoVeThGjUbmWmdw==}
|
||||
engines: {node: '>=12'}
|
||||
cpu: [arm64]
|
||||
os: [freebsd]
|
||||
requiresBuild: true
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/@esbuild/freebsd-x64/0.16.17:
|
||||
resolution: {integrity: sha512-8ScTdNJl5idAKjH8zGAsN7RuWcyHG3BAvMNpKOBaqqR7EbUhhVHOqXRdL7oZvz8WNHL2pr5+eIT5c65kA6NHug==}
|
||||
engines: {node: '>=12'}
|
||||
cpu: [x64]
|
||||
os: [freebsd]
|
||||
requiresBuild: true
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/@esbuild/linux-arm/0.16.17:
|
||||
resolution: {integrity: sha512-iihzrWbD4gIT7j3caMzKb/RsFFHCwqqbrbH9SqUSRrdXkXaygSZCZg1FybsZz57Ju7N/SHEgPyaR0LZ8Zbe9gQ==}
|
||||
engines: {node: '>=12'}
|
||||
cpu: [arm]
|
||||
os: [linux]
|
||||
requiresBuild: true
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/@esbuild/linux-arm64/0.16.17:
|
||||
resolution: {integrity: sha512-7S8gJnSlqKGVJunnMCrXHU9Q8Q/tQIxk/xL8BqAP64wchPCTzuM6W3Ra8cIa1HIflAvDnNOt2jaL17vaW+1V0g==}
|
||||
engines: {node: '>=12'}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
requiresBuild: true
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/@esbuild/linux-ia32/0.16.17:
|
||||
resolution: {integrity: sha512-kiX69+wcPAdgl3Lonh1VI7MBr16nktEvOfViszBSxygRQqSpzv7BffMKRPMFwzeJGPxcio0pdD3kYQGpqQ2SSg==}
|
||||
engines: {node: '>=12'}
|
||||
cpu: [ia32]
|
||||
os: [linux]
|
||||
requiresBuild: true
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/@esbuild/linux-loong64/0.16.17:
|
||||
resolution: {integrity: sha512-dTzNnQwembNDhd654cA4QhbS9uDdXC3TKqMJjgOWsC0yNCbpzfWoXdZvp0mY7HU6nzk5E0zpRGGx3qoQg8T2DQ==}
|
||||
engines: {node: '>=12'}
|
||||
cpu: [loong64]
|
||||
os: [linux]
|
||||
requiresBuild: true
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/@esbuild/linux-mips64el/0.16.17:
|
||||
resolution: {integrity: sha512-ezbDkp2nDl0PfIUn0CsQ30kxfcLTlcx4Foz2kYv8qdC6ia2oX5Q3E/8m6lq84Dj/6b0FrkgD582fJMIfHhJfSw==}
|
||||
engines: {node: '>=12'}
|
||||
cpu: [mips64el]
|
||||
os: [linux]
|
||||
requiresBuild: true
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/@esbuild/linux-ppc64/0.16.17:
|
||||
resolution: {integrity: sha512-dzS678gYD1lJsW73zrFhDApLVdM3cUF2MvAa1D8K8KtcSKdLBPP4zZSLy6LFZ0jYqQdQ29bjAHJDgz0rVbLB3g==}
|
||||
engines: {node: '>=12'}
|
||||
cpu: [ppc64]
|
||||
os: [linux]
|
||||
requiresBuild: true
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/@esbuild/linux-riscv64/0.16.17:
|
||||
resolution: {integrity: sha512-ylNlVsxuFjZK8DQtNUwiMskh6nT0vI7kYl/4fZgV1llP5d6+HIeL/vmmm3jpuoo8+NuXjQVZxmKuhDApK0/cKw==}
|
||||
engines: {node: '>=12'}
|
||||
cpu: [riscv64]
|
||||
os: [linux]
|
||||
requiresBuild: true
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/@esbuild/linux-s390x/0.16.17:
|
||||
resolution: {integrity: sha512-gzy7nUTO4UA4oZ2wAMXPNBGTzZFP7mss3aKR2hH+/4UUkCOyqmjXiKpzGrY2TlEUhbbejzXVKKGazYcQTZWA/w==}
|
||||
engines: {node: '>=12'}
|
||||
cpu: [s390x]
|
||||
os: [linux]
|
||||
requiresBuild: true
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/@esbuild/linux-x64/0.16.17:
|
||||
resolution: {integrity: sha512-mdPjPxfnmoqhgpiEArqi4egmBAMYvaObgn4poorpUaqmvzzbvqbowRllQ+ZgzGVMGKaPkqUmPDOOFQRUFDmeUw==}
|
||||
engines: {node: '>=12'}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
requiresBuild: true
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/@esbuild/netbsd-x64/0.16.17:
|
||||
resolution: {integrity: sha512-/PzmzD/zyAeTUsduZa32bn0ORug+Jd1EGGAUJvqfeixoEISYpGnAezN6lnJoskauoai0Jrs+XSyvDhppCPoKOA==}
|
||||
engines: {node: '>=12'}
|
||||
cpu: [x64]
|
||||
os: [netbsd]
|
||||
requiresBuild: true
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/@esbuild/openbsd-x64/0.16.17:
|
||||
resolution: {integrity: sha512-2yaWJhvxGEz2RiftSk0UObqJa/b+rIAjnODJgv2GbGGpRwAfpgzyrg1WLK8rqA24mfZa9GvpjLcBBg8JHkoodg==}
|
||||
engines: {node: '>=12'}
|
||||
cpu: [x64]
|
||||
os: [openbsd]
|
||||
requiresBuild: true
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/@esbuild/sunos-x64/0.16.17:
|
||||
resolution: {integrity: sha512-xtVUiev38tN0R3g8VhRfN7Zl42YCJvyBhRKw1RJjwE1d2emWTVToPLNEQj/5Qxc6lVFATDiy6LjVHYhIPrLxzw==}
|
||||
engines: {node: '>=12'}
|
||||
cpu: [x64]
|
||||
os: [sunos]
|
||||
requiresBuild: true
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/@esbuild/win32-arm64/0.16.17:
|
||||
resolution: {integrity: sha512-ga8+JqBDHY4b6fQAmOgtJJue36scANy4l/rL97W+0wYmijhxKetzZdKOJI7olaBaMhWt8Pac2McJdZLxXWUEQw==}
|
||||
engines: {node: '>=12'}
|
||||
cpu: [arm64]
|
||||
os: [win32]
|
||||
requiresBuild: true
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/@esbuild/win32-ia32/0.16.17:
|
||||
resolution: {integrity: sha512-WnsKaf46uSSF/sZhwnqE4L/F89AYNMiD4YtEcYekBt9Q7nj0DiId2XH2Ng2PHM54qi5oPrQ8luuzGszqi/veig==}
|
||||
engines: {node: '>=12'}
|
||||
cpu: [ia32]
|
||||
os: [win32]
|
||||
requiresBuild: true
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/@esbuild/win32-x64/0.16.17:
|
||||
resolution: {integrity: sha512-y+EHuSchhL7FjHgvQL/0fnnFmO4T1bhvWANX6gcnqTjtnKWbTvUMCpGnv2+t+31d7RzyEAYAd4u2fnIhHL6N/Q==}
|
||||
engines: {node: '>=12'}
|
||||
cpu: [x64]
|
||||
os: [win32]
|
||||
requiresBuild: true
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/@vitejs/plugin-vue/4.0.0_vite@4.1.4+vue@3.2.47:
|
||||
resolution: {integrity: sha512-e0X4jErIxAB5oLtDqbHvHpJe/uWNkdpYV83AOG2xo2tEVSzCzewgJMtREZM30wXnM5ls90hxiOtAuVU6H5JgbA==}
|
||||
engines: {node: ^14.18.0 || >=16.0.0}
|
||||
peerDependencies:
|
||||
vite: ^4.0.0
|
||||
vue: ^3.2.25
|
||||
dependencies:
|
||||
vite: 4.1.4
|
||||
vue: 3.2.47
|
||||
dev: true
|
||||
|
||||
/@vue/compiler-core/3.2.47:
|
||||
resolution: {integrity: sha512-p4D7FDnQb7+YJmO2iPEv0SQNeNzcbHdGByJDsT4lynf63AFkOTFN07HsiRSvjGo0QrxR/o3d0hUyNCUnBU2Tig==}
|
||||
dependencies:
|
||||
'@babel/parser': 7.21.2
|
||||
'@vue/shared': 3.2.47
|
||||
estree-walker: 2.0.2
|
||||
source-map: 0.6.1
|
||||
|
||||
/@vue/compiler-dom/3.2.47:
|
||||
resolution: {integrity: sha512-dBBnEHEPoftUiS03a4ggEig74J2YBZ2UIeyfpcRM2tavgMWo4bsEfgCGsu+uJIL/vax9S+JztH8NmQerUo7shQ==}
|
||||
dependencies:
|
||||
'@vue/compiler-core': 3.2.47
|
||||
'@vue/shared': 3.2.47
|
||||
|
||||
/@vue/compiler-sfc/3.2.47:
|
||||
resolution: {integrity: sha512-rog05W+2IFfxjMcFw10tM9+f7i/+FFpZJJ5XHX72NP9eC2uRD+42M3pYcQqDXVYoj74kHMSEdQ/WmCjt8JFksQ==}
|
||||
dependencies:
|
||||
'@babel/parser': 7.21.2
|
||||
'@vue/compiler-core': 3.2.47
|
||||
'@vue/compiler-dom': 3.2.47
|
||||
'@vue/compiler-ssr': 3.2.47
|
||||
'@vue/reactivity-transform': 3.2.47
|
||||
'@vue/shared': 3.2.47
|
||||
estree-walker: 2.0.2
|
||||
magic-string: 0.25.9
|
||||
postcss: 8.4.21
|
||||
source-map: 0.6.1
|
||||
|
||||
/@vue/compiler-ssr/3.2.47:
|
||||
resolution: {integrity: sha512-wVXC+gszhulcMD8wpxMsqSOpvDZ6xKXSVWkf50Guf/S+28hTAXPDYRTbLQ3EDkOP5Xz/+SY37YiwDquKbJOgZw==}
|
||||
dependencies:
|
||||
'@vue/compiler-dom': 3.2.47
|
||||
'@vue/shared': 3.2.47
|
||||
|
||||
/@vue/reactivity-transform/3.2.47:
|
||||
resolution: {integrity: sha512-m8lGXw8rdnPVVIdIFhf0LeQ/ixyHkH5plYuS83yop5n7ggVJU+z5v0zecwEnX7fa7HNLBhh2qngJJkxpwEEmYA==}
|
||||
dependencies:
|
||||
'@babel/parser': 7.21.2
|
||||
'@vue/compiler-core': 3.2.47
|
||||
'@vue/shared': 3.2.47
|
||||
estree-walker: 2.0.2
|
||||
magic-string: 0.25.9
|
||||
|
||||
/@vue/reactivity/3.2.47:
|
||||
resolution: {integrity: sha512-7khqQ/75oyyg+N/e+iwV6lpy1f5wq759NdlS1fpAhFXa8VeAIKGgk2E/C4VF59lx5b+Ezs5fpp/5WsRYXQiKxQ==}
|
||||
dependencies:
|
||||
'@vue/shared': 3.2.47
|
||||
|
||||
/@vue/runtime-core/3.2.47:
|
||||
resolution: {integrity: sha512-RZxbLQIRB/K0ev0K9FXhNbBzT32H9iRtYbaXb0ZIz2usLms/D55dJR2t6cIEUn6vyhS3ALNvNthI+Q95C+NOpA==}
|
||||
dependencies:
|
||||
'@vue/reactivity': 3.2.47
|
||||
'@vue/shared': 3.2.47
|
||||
|
||||
/@vue/runtime-dom/3.2.47:
|
||||
resolution: {integrity: sha512-ArXrFTjS6TsDei4qwNvgrdmHtD930KgSKGhS5M+j8QxXrDJYLqYw4RRcDy1bz1m1wMmb6j+zGLifdVHtkXA7gA==}
|
||||
dependencies:
|
||||
'@vue/runtime-core': 3.2.47
|
||||
'@vue/shared': 3.2.47
|
||||
csstype: 2.6.21
|
||||
|
||||
/@vue/server-renderer/3.2.47_vue@3.2.47:
|
||||
resolution: {integrity: sha512-dN9gc1i8EvmP9RCzvneONXsKfBRgqFeFZLurmHOveL7oH6HiFXJw5OGu294n1nHc/HMgTy6LulU/tv5/A7f/LA==}
|
||||
peerDependencies:
|
||||
vue: 3.2.47
|
||||
dependencies:
|
||||
'@vue/compiler-ssr': 3.2.47
|
||||
'@vue/shared': 3.2.47
|
||||
vue: 3.2.47
|
||||
|
||||
/@vue/shared/3.2.47:
|
||||
resolution: {integrity: sha512-BHGyyGN3Q97EZx0taMQ+OLNuZcW3d37ZEVmEAyeoA9ERdGvm9Irc/0Fua8SNyOtV1w6BS4q25wbMzJujO9HIfQ==}
|
||||
|
||||
/base64-js/1.5.1:
|
||||
resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==}
|
||||
dev: false
|
||||
|
||||
/csstype/2.6.21:
|
||||
resolution: {integrity: sha512-Z1PhmomIfypOpoMjRQB70jfvy/wxT50qW08YXO5lMIJkrdq4yOTR+AW7FqutScmB9NkLwxo+jU+kZLbofZZq/w==}
|
||||
|
||||
/esbuild/0.16.17:
|
||||
resolution: {integrity: sha512-G8LEkV0XzDMNwXKgM0Jwu3nY3lSTwSGY6XbxM9cr9+s0T/qSV1q1JVPBGzm3dcjhCic9+emZDmMffkwgPeOeLg==}
|
||||
engines: {node: '>=12'}
|
||||
hasBin: true
|
||||
requiresBuild: true
|
||||
optionalDependencies:
|
||||
'@esbuild/android-arm': 0.16.17
|
||||
'@esbuild/android-arm64': 0.16.17
|
||||
'@esbuild/android-x64': 0.16.17
|
||||
'@esbuild/darwin-arm64': 0.16.17
|
||||
'@esbuild/darwin-x64': 0.16.17
|
||||
'@esbuild/freebsd-arm64': 0.16.17
|
||||
'@esbuild/freebsd-x64': 0.16.17
|
||||
'@esbuild/linux-arm': 0.16.17
|
||||
'@esbuild/linux-arm64': 0.16.17
|
||||
'@esbuild/linux-ia32': 0.16.17
|
||||
'@esbuild/linux-loong64': 0.16.17
|
||||
'@esbuild/linux-mips64el': 0.16.17
|
||||
'@esbuild/linux-ppc64': 0.16.17
|
||||
'@esbuild/linux-riscv64': 0.16.17
|
||||
'@esbuild/linux-s390x': 0.16.17
|
||||
'@esbuild/linux-x64': 0.16.17
|
||||
'@esbuild/netbsd-x64': 0.16.17
|
||||
'@esbuild/openbsd-x64': 0.16.17
|
||||
'@esbuild/sunos-x64': 0.16.17
|
||||
'@esbuild/win32-arm64': 0.16.17
|
||||
'@esbuild/win32-ia32': 0.16.17
|
||||
'@esbuild/win32-x64': 0.16.17
|
||||
dev: true
|
||||
|
||||
/estree-walker/2.0.2:
|
||||
resolution: {integrity: sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==}
|
||||
|
||||
/fsevents/2.3.2:
|
||||
resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==}
|
||||
engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
|
||||
os: [darwin]
|
||||
requiresBuild: true
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/function-bind/1.1.1:
|
||||
resolution: {integrity: sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==}
|
||||
dev: true
|
||||
|
||||
/has/1.0.3:
|
||||
resolution: {integrity: sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==}
|
||||
engines: {node: '>= 0.4.0'}
|
||||
dependencies:
|
||||
function-bind: 1.1.1
|
||||
dev: true
|
||||
|
||||
/is-core-module/2.11.0:
|
||||
resolution: {integrity: sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==}
|
||||
dependencies:
|
||||
has: 1.0.3
|
||||
dev: true
|
||||
|
||||
/js-sha256/0.9.0:
|
||||
resolution: {integrity: sha512-sga3MHh9sgQN2+pJ9VYZ+1LPwXOxuBJBA5nrR5/ofPfuiJBE2hnjsaN8se8JznOmGLN2p49Pe5U/ttafcs/apA==}
|
||||
dev: false
|
||||
|
||||
/keycloak-js/21.0.1:
|
||||
resolution: {integrity: sha512-ot0KW4qyDHl5AyDZNV0CkEkuvIZi+37y3BReNvqqfag7wqJeV13R/PcgECvbbd05+0NSOQjhBL8S+a4A++vNQw==}
|
||||
dependencies:
|
||||
base64-js: 1.5.1
|
||||
js-sha256: 0.9.0
|
||||
dev: false
|
||||
|
||||
/magic-string/0.25.9:
|
||||
resolution: {integrity: sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==}
|
||||
dependencies:
|
||||
sourcemap-codec: 1.4.8
|
||||
|
||||
/nanoid/3.3.4:
|
||||
resolution: {integrity: sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==}
|
||||
engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
|
||||
hasBin: true
|
||||
|
||||
/path-parse/1.0.7:
|
||||
resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==}
|
||||
dev: true
|
||||
|
||||
/picocolors/1.0.0:
|
||||
resolution: {integrity: sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==}
|
||||
|
||||
/postcss/8.4.21:
|
||||
resolution: {integrity: sha512-tP7u/Sn/dVxK2NnruI4H9BG+x+Wxz6oeZ1cJ8P6G/PZY0IKk4k/63TDsQf2kQq3+qoJeLm2kIBUNlZe3zgb4Zg==}
|
||||
engines: {node: ^10 || ^12 || >=14}
|
||||
dependencies:
|
||||
nanoid: 3.3.4
|
||||
picocolors: 1.0.0
|
||||
source-map-js: 1.0.2
|
||||
|
||||
/resolve/1.22.1:
|
||||
resolution: {integrity: sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
is-core-module: 2.11.0
|
||||
path-parse: 1.0.7
|
||||
supports-preserve-symlinks-flag: 1.0.0
|
||||
dev: true
|
||||
|
||||
/rollup/3.18.0:
|
||||
resolution: {integrity: sha512-J8C6VfEBjkvYPESMQYxKHxNOh4A5a3FlP+0BETGo34HEcE4eTlgCrO2+eWzlu2a/sHs2QUkZco+wscH7jhhgWg==}
|
||||
engines: {node: '>=14.18.0', npm: '>=8.0.0'}
|
||||
hasBin: true
|
||||
optionalDependencies:
|
||||
fsevents: 2.3.2
|
||||
dev: true
|
||||
|
||||
/source-map-js/1.0.2:
|
||||
resolution: {integrity: sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
||||
/source-map/0.6.1:
|
||||
resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
||||
/sourcemap-codec/1.4.8:
|
||||
resolution: {integrity: sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==}
|
||||
deprecated: Please use @jridgewell/sourcemap-codec instead
|
||||
|
||||
/supports-preserve-symlinks-flag/1.0.0:
|
||||
resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==}
|
||||
engines: {node: '>= 0.4'}
|
||||
dev: true
|
||||
|
||||
/to-fast-properties/2.0.0:
|
||||
resolution: {integrity: sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==}
|
||||
engines: {node: '>=4'}
|
||||
|
||||
/vite/4.1.4:
|
||||
resolution: {integrity: sha512-3knk/HsbSTKEin43zHu7jTwYWv81f8kgAL99G5NWBcA1LKvtvcVAC4JjBH1arBunO9kQka+1oGbrMKOjk4ZrBg==}
|
||||
engines: {node: ^14.18.0 || >=16.0.0}
|
||||
hasBin: true
|
||||
peerDependencies:
|
||||
'@types/node': '>= 14'
|
||||
less: '*'
|
||||
sass: '*'
|
||||
stylus: '*'
|
||||
sugarss: '*'
|
||||
terser: ^5.4.0
|
||||
peerDependenciesMeta:
|
||||
'@types/node':
|
||||
optional: true
|
||||
less:
|
||||
optional: true
|
||||
sass:
|
||||
optional: true
|
||||
stylus:
|
||||
optional: true
|
||||
sugarss:
|
||||
optional: true
|
||||
terser:
|
||||
optional: true
|
||||
dependencies:
|
||||
esbuild: 0.16.17
|
||||
postcss: 8.4.21
|
||||
resolve: 1.22.1
|
||||
rollup: 3.18.0
|
||||
optionalDependencies:
|
||||
fsevents: 2.3.2
|
||||
dev: true
|
||||
|
||||
/vue/3.2.47:
|
||||
resolution: {integrity: sha512-60188y/9Dc9WVrAZeUVSDxRQOZ+z+y5nO2ts9jWXSTkMvayiWxCWOWtBQoYjLeccfXkiiPZWAHcV+WTPhkqJHQ==}
|
||||
dependencies:
|
||||
'@vue/compiler-dom': 3.2.47
|
||||
'@vue/compiler-sfc': 3.2.47
|
||||
'@vue/runtime-dom': 3.2.47
|
||||
'@vue/server-renderer': 3.2.47_vue@3.2.47
|
||||
'@vue/shared': 3.2.47
|
1
public/vite.svg
Normal file
1
public/vite.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
After Width: | Height: | Size: 1.5 KiB |
231
src/index.js
Normal file
231
src/index.js
Normal file
@ -0,0 +1,231 @@
|
||||
import Keycloak from 'keycloak-js'
|
||||
|
||||
let installed = false
|
||||
|
||||
export const KeycloakSymbol = Symbol('keycloak')
|
||||
import * as vue from 'vue'
|
||||
|
||||
export default {
|
||||
install: async function() {
|
||||
if (installed) return
|
||||
installed = true
|
||||
|
||||
const defaultParams = {
|
||||
config: window.__BASEURL__ ? `${window.__BASEURL__}/config` : '/config',
|
||||
init: { onLoad: 'login-required' },
|
||||
}
|
||||
const options = Object.assign({}, defaultParams, params)
|
||||
if (assertOptions(options).hasError)
|
||||
throw new Error(`Invalid options given: ${assertOptions(options).error}`)
|
||||
const watch = await vue2AndVue3Reactive(
|
||||
app,
|
||||
defaultEmptyVueKeycloakInstance()
|
||||
)
|
||||
|
||||
getConfig(options.config)
|
||||
.then((config) => {
|
||||
init(config, watch, options)
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err)
|
||||
})
|
||||
},
|
||||
KeycloakSymbol
|
||||
}
|
||||
|
||||
function defaultEmptyVueKeycloakInstance() {
|
||||
return {
|
||||
ready: false,
|
||||
authenticated: false,
|
||||
userName: undefined,
|
||||
fullName: undefined,
|
||||
token: undefined,
|
||||
tokenParsed: undefined,
|
||||
logoutFn: undefined,
|
||||
loginFn: undefined,
|
||||
login: undefined,
|
||||
createLoginUrl: undefined,
|
||||
createLogoutUrl: undefined,
|
||||
createRegisterUrl: undefined,
|
||||
register: undefined,
|
||||
accountManagement: undefined,
|
||||
createAccountUrl: undefined,
|
||||
loadUserProfile: undefined,
|
||||
subject: undefined,
|
||||
idToken: undefined,
|
||||
idTokenParsed: undefined,
|
||||
realmAccess: undefined,
|
||||
resourceAccess: undefined,
|
||||
refreshToken: undefined,
|
||||
refreshTokenParsed: undefined,
|
||||
timeSkew: undefined,
|
||||
responseMode: undefined,
|
||||
responseType: undefined,
|
||||
hasRealmRole: undefined,
|
||||
hasResourceRole: undefined,
|
||||
keycloak: undefined,
|
||||
}
|
||||
}
|
||||
|
||||
function vue2AndVue3Reactive(app, object) {
|
||||
return new Promise((resolve, reject) => {
|
||||
// Vue 3
|
||||
// Assign an object immediately to allow usage of $keycloak in view
|
||||
|
||||
//const vue = await import('vue')
|
||||
// Async load module to allow vue 2 to not have the dependency.
|
||||
const reactiveObj = vue.reactive(object)
|
||||
// Override the existing reactiveObj so references contains the new reactive values
|
||||
app.config.globalProperties.$keycloak = reactiveObj
|
||||
// Use provide/inject in Vue3 apps
|
||||
app.provide(KeycloakSymbol, reactiveObj)
|
||||
resolve(reactiveObj)
|
||||
})
|
||||
}
|
||||
|
||||
function init(config, watch, options) {
|
||||
const keycloak = new Keycloak(config)
|
||||
const { updateInterval } = options
|
||||
|
||||
keycloak.onReady = function (authenticated) {
|
||||
updateWatchVariables(authenticated)
|
||||
watch.ready = true
|
||||
typeof options.onReady === 'function' && options.onReady(keycloak, watch)
|
||||
}
|
||||
keycloak.onAuthSuccess = function () {
|
||||
// Check token validity every 10 seconds (10 000 ms) and, if necessary, update the token.
|
||||
// Refresh token if it's valid for less than 60 seconds
|
||||
const updateTokenInterval = setInterval(
|
||||
() =>
|
||||
keycloak.updateToken(60).catch(() => {
|
||||
keycloak.clearToken()
|
||||
}),
|
||||
updateInterval ?? 10000
|
||||
)
|
||||
watch.logoutFn = () => {
|
||||
clearInterval(updateTokenInterval)
|
||||
keycloak.logout(options.logout)
|
||||
}
|
||||
}
|
||||
keycloak.onAuthRefreshSuccess = function () {
|
||||
updateWatchVariables(true)
|
||||
typeof options.onAuthRefreshSuccess === 'function' &&
|
||||
options.onAuthRefreshSuccess(keycloak)
|
||||
}
|
||||
keycloak.onAuthRefreshError = function () {
|
||||
updateWatchVariables(false)
|
||||
typeof options.onAuthRefreshError === 'function' &&
|
||||
options.onAuthRefreshError(keycloak)
|
||||
}
|
||||
keycloak
|
||||
.init(options.init)
|
||||
.then((authenticated) => {
|
||||
updateWatchVariables(authenticated)
|
||||
typeof options.onInitSuccess === 'function' &&
|
||||
options.onInitSuccess(authenticated)
|
||||
})
|
||||
.catch((err) => {
|
||||
updateWatchVariables(false)
|
||||
const error = Error('Failure during initialization of keycloak-js adapter')
|
||||
typeof options.onInitError === 'function'
|
||||
? options.onInitError(error, err)
|
||||
: console.error(error, err)
|
||||
})
|
||||
|
||||
function updateWatchVariables(isAuthenticated = false) {
|
||||
watch.authenticated = isAuthenticated
|
||||
watch.loginFn = keycloak.login
|
||||
watch.login = keycloak.login
|
||||
watch.createLoginUrl = keycloak.createLoginUrl
|
||||
watch.createLogoutUrl = keycloak.createLogoutUrl
|
||||
watch.createRegisterUrl = keycloak.createRegisterUrl
|
||||
watch.register = keycloak.register
|
||||
watch.keycloak = keycloak
|
||||
if (isAuthenticated) {
|
||||
watch.accountManagement = keycloak.accountManagement
|
||||
watch.createAccountUrl = keycloak.createAccountUrl
|
||||
watch.hasRealmRole = keycloak.hasRealmRole
|
||||
watch.hasResourceRole = keycloak.hasResourceRole
|
||||
watch.loadUserProfile = keycloak.loadUserProfile
|
||||
watch.token = keycloak.token
|
||||
watch.subject = keycloak.subject
|
||||
watch.idToken = keycloak.idToken
|
||||
watch.idTokenParsed = keycloak.idTokenParsed
|
||||
watch.realmAccess = keycloak.realmAccess
|
||||
watch.resourceAccess = keycloak.resourceAccess
|
||||
watch.refreshToken = keycloak.refreshToken
|
||||
watch.refreshTokenParsed = keycloak.refreshTokenParsed
|
||||
watch.timeSkew = keycloak.timeSkew
|
||||
watch.responseMode = keycloak.responseMode
|
||||
watch.responseType = keycloak.responseType
|
||||
watch.tokenParsed = keycloak.tokenParsed
|
||||
watch.userName = (keycloak.tokenParsed)['preferred_username']
|
||||
watch.fullName = (keycloak.tokenParsed)['name']
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function assertOptions(options) {
|
||||
const { config, init, onReady, onInitError, onAuthRefreshError } = options
|
||||
if (typeof config !== 'string' && !_isObject(config)) {
|
||||
return {
|
||||
hasError: true,
|
||||
error: `'config' option must be a string or an object. Found: '${config}'`,
|
||||
}
|
||||
}
|
||||
if (!_isObject(init) || typeof init.onLoad !== 'string') {
|
||||
return {
|
||||
hasError: true,
|
||||
error: `'init' option must be an object with an 'onLoad' property. Found: '${init}'`,
|
||||
}
|
||||
}
|
||||
if (onReady && typeof onReady !== 'function') {
|
||||
return {
|
||||
hasError: true,
|
||||
error: `'onReady' option must be a function. Found: '${onReady}'`,
|
||||
}
|
||||
}
|
||||
if (onInitError && typeof onInitError !== 'function') {
|
||||
return {
|
||||
hasError: true,
|
||||
error: `'onInitError' option must be a function. Found: '${onInitError}'`,
|
||||
}
|
||||
}
|
||||
if (onAuthRefreshError && typeof onAuthRefreshError !== 'function') {
|
||||
return {
|
||||
hasError: true,
|
||||
error: `'onAuthRefreshError' option must be a function. Found: '${onAuthRefreshError}'`,
|
||||
}
|
||||
}
|
||||
return {
|
||||
hasError: false,
|
||||
error: null,
|
||||
}
|
||||
}
|
||||
|
||||
function _isObject(obj) {
|
||||
return (
|
||||
obj !== null &&
|
||||
typeof obj === 'object' &&
|
||||
Object.prototype.toString.call(obj) !== '[object Array]'
|
||||
)
|
||||
}
|
||||
|
||||
function getConfig(config) {
|
||||
if (_isObject(config)) return Promise.resolve(config)
|
||||
return new Promise((resolve, reject) => {
|
||||
const xhr = new XMLHttpRequest()
|
||||
xhr.open('GET', config)
|
||||
xhr.setRequestHeader('Accept', 'application/json')
|
||||
xhr.onreadystatechange = () => {
|
||||
if (xhr.readyState === 4) {
|
||||
if (xhr.status === 200) {
|
||||
resolve(JSON.parse(xhr.responseText))
|
||||
} else {
|
||||
reject(Error(xhr.statusText))
|
||||
}
|
||||
}
|
||||
}
|
||||
xhr.send()
|
||||
})
|
||||
}
|
24
vite.config.js
Normal file
24
vite.config.js
Normal file
@ -0,0 +1,24 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import * as path from 'path';
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
build: {
|
||||
lib: {
|
||||
entry: path.resolve(__dirname, "src/index.js"),
|
||||
name: "vue3-kc",
|
||||
fileName: format => `${format}.js`
|
||||
},
|
||||
rollupOptions: {
|
||||
external: ["vue"],
|
||||
output: {
|
||||
globals: {
|
||||
vue: "Vue",
|
||||
},
|
||||
exports: 'named'
|
||||
}
|
||||
}
|
||||
},
|
||||
plugins: [vue()],
|
||||
})
|
Loading…
Reference in New Issue
Block a user