@dsb-norge/vue-keycloak-js
Advanced tools
Comparing version 1.3.2 to 2.0.0-beta
{ | ||
"name": "@dsb-norge/vue-keycloak-js", | ||
"version": "1.3.2", | ||
"version": "2.0.0-beta", | ||
"author": "Nils Lien <nils.lien@gmail.com>", | ||
@@ -9,2 +9,3 @@ "description": "A Keycloak plugin for Vue >= 2.x", | ||
"browser": "dist/dsb-vue-keycloak.umd.js", | ||
"typings": "dist/index.d.ts", | ||
"license": "ISC", | ||
@@ -29,7 +30,18 @@ "repository": { | ||
"@babel/preset-env": "^7.11.0", | ||
"rollup": "^2.26.8", | ||
"@rollup/plugin-babel": "^5.2.0", | ||
"@rollup/plugin-commonjs": "^15.0.0", | ||
"@rollup/plugin-node-resolve": "^9.0.0" | ||
"@rollup/plugin-node-resolve": "^9.0.0", | ||
"@typescript-eslint/eslint-plugin": "^4.21.0", | ||
"@typescript-eslint/parser": "^4.21.0", | ||
"babel-eslint": "^10.1.0", | ||
"eslint": "^7.23.0", | ||
"rollup": "^2.26.8", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"rollup-plugin-typescript2": "^0.30.0", | ||
"typescript": "^4.2.3", | ||
"vue": "^3.0.9" | ||
}, | ||
"peerDependencies": { | ||
"vue": "^2.6.0 || >=3.0.0-rc.0" | ||
}, | ||
"scripts": { | ||
@@ -39,3 +51,5 @@ "build": "rollup -c", | ||
"version": "npm run build && git add -A", | ||
"postversion": "git push -u --follow-tags origin master && npm publish" | ||
"postversion": "git push -u --follow-tags origin master && npm publish", | ||
"lint": "eslint --ext .ts src", | ||
"lint:fix": "eslint --ext .ts src --fix" | ||
}, | ||
@@ -42,0 +56,0 @@ "files": [ |
@@ -45,2 +45,4 @@ vue-keycloak plugin | ||
### Vue 2 | ||
> `Vue.use(VueKeyCloak, [options])` | ||
@@ -60,7 +62,47 @@ | ||
### Vue 3 | ||
> `createApp(App).use(VueKeycloak, [options])` | ||
Tell Vue to install the plugin, and optionally pass in a JavaScript object additional | ||
configuration. | ||
```javascript | ||
import VueKeyCloak from '@dsb-norge/vue-keycloak-js' | ||
createApp(App).use(VueKeycloak) | ||
// You can also pass in options. Check options reference below. | ||
createApp(App).use(VueKeycloak, options) | ||
``` | ||
```typescript | ||
import VueKeyCloak from '@dsb-norge/vue-keycloak-js' | ||
import { VueKeycloakInstance } from "@dsb-norge/vue-keycloak-js/dist/types"; | ||
createApp(App).use(VueKeycloak) | ||
// You can also pass in options. Check options reference below. | ||
createApp(App).use(VueKeycloak, options) | ||
// Allow usage of this.$keycloak in components | ||
declare module '@vue/runtime-core' { | ||
interface ComponentCustomProperties { | ||
$keycloak: VueKeycloakInstance | ||
} | ||
} | ||
``` | ||
The plugin adds a `$keycloak` property to the global Vue instance. | ||
This is actually a [Vue.observable](https://vuejs.org/v2/api/#Vue-observable) instance and can be used as such. | ||
It shadows most of the keycloak instance's properties and functions. All other variables & functions can be found | ||
on `$keycloak.keycloak` attribute | ||
This shadows most of the keycloak instance's properties and functions. | ||
All other variables & functions can be found on `$keycloak.keycloak` attribute | ||
Internally for Vue 2: | ||
* [Vue.observable](https://vuejs.org/v2/api/#Vue-observable) | ||
Internally for Vue 3 | ||
* [reactive](https://v3.vuejs.org/guide/reactivity-fundamentals.html#declaring-reactive-state) | ||
This object is reactive and will update with new tokens and other information | ||
These properties/functions are exposed: | ||
@@ -84,3 +126,2 @@ | ||
loadUserProfile: Function, // Keycloak loadUserProfile function | ||
loadUserInfo: Function, // Keycloak loadUserInfo function | ||
subject: String, // The user id | ||
@@ -118,22 +159,5 @@ idToken: String, // The base64 encoded ID token. | ||
**IMPORTANT NOTE** | ||
Currently, the plugin accepts a config object like this: | ||
``` | ||
{ | ||
authRealm: String, | ||
authUrl: String, | ||
authClientId: String, | ||
logoutRedirectUri: String | ||
} | ||
``` | ||
**This will be deprecated in the next major release.** | ||
Thereafter, the config object, either returned from an endpoint (string) or | ||
The config object, either returned from an endpoint (string) or | ||
set directly (object), must be compatible with the [Keycloak JS adapter](https://www.keycloak.org/docs/latest/securing_apps/#_javascript_adapter) constructor arguments. | ||
The `logoutRedirectUri` must instead be defined in [`options.logout`](#logout) | ||
See description below. | ||
@@ -323,8 +347,17 @@ | ||
### Example application | ||
### Example applications | ||
View a complete example app, with router guards: | ||
[hello-keycloak](https://github.com/dsb-norge/vue-keycloak-js/tree/master/examples) | ||
[hello-keycloak](https://github.com/dsb-norge/vue-keycloak-js/tree/master/examples/hello-keycloak) | ||
Simple 'in component' secret displaying reactiveness | ||
[simple_vue2](https://github.com/dsb-norge/vue-keycloak-js/tree/master/examples/simple_vue2) | ||
Typescript example with vue 3 | ||
[typescript_vue3](https://github.com/dsb-norge/vue-keycloak-js/tree/master/examples/typescript_vue3) | ||
## Develop and deploy | ||
@@ -355,2 +388,2 @@ | ||
Note that if you run keycloak on your own machine its important to be consistent with the settings for it's address. Cookies created from 127.0.0.1 will not be sent to "localhost" and vice versa. | ||
Note that if you run keycloak on your own machine its important to be consistent with the settings for it's address. Cookies created from 127.0.0.1 will not be sent to "localhost" and vice versa. |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
8
384
42193
2
14
705
1