@moreillon/vue-oidc 0.2.0 → 0.2.1
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 +16 -16
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Vue OIDC
|
|
2
2
|
|
|
3
|
-
Vue 3 plugin and composable for OpenID Connect authentication, built on [@moreillon/oidc-auth](https://www.npmjs.com/package/@moreillon/oidc-auth).
|
|
3
|
+
Vue 3 plugin and composable for OpenID Connect authentication, built on [@moreillon/oidc-auth](https://www.npmjs.com/package/@moreillon/oidc-auth). The main purpose of this module is to provide OIDC authentication to Vue.js apps served over plain HTTP, where crypto library cannot be used.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -29,12 +29,12 @@ createApp(App)
|
|
|
29
29
|
|
|
30
30
|
### Options
|
|
31
31
|
|
|
32
|
-
| Option | Type | Description
|
|
33
|
-
| ------------------ | ------------------------ |
|
|
34
|
-
| `authority` | `string` | URL of the OIDC provider (required)
|
|
35
|
-
| `client_id` | `string` | OIDC client ID (required)
|
|
36
|
-
| `redirect_uri` | `string` | Where the provider redirects after login. Defaults to the current page
|
|
37
|
-
| `extraQueryParams` | `Record<string, string>` | Additional query parameters sent to the authorization endpoint
|
|
32
|
+
| Option | Type | Description |
|
|
33
|
+
| ------------------ | ------------------------ | ------------------------------------------------------------------------------------------------- |
|
|
34
|
+
| `authority` | `string` | URL of the OIDC provider (required) |
|
|
35
|
+
| `client_id` | `string` | OIDC client ID (required) |
|
|
36
|
+
| `redirect_uri` | `string` | Where the provider redirects after login. Defaults to the current page |
|
|
37
|
+
| `extraQueryParams` | `Record<string, string>` | Additional query parameters sent to the authorization endpoint |
|
|
38
38
|
| `enforce` | `boolean` | Redirect unauthenticated users to the provider immediately instead of letting them in anonymously |
|
|
39
39
|
|
|
40
40
|
## Usage
|
|
@@ -63,15 +63,15 @@ const { ready, error, user, login, logout } = useAuth();
|
|
|
63
63
|
|
|
64
64
|
All refs are read-only.
|
|
65
65
|
|
|
66
|
-
| Property | Type
|
|
67
|
-
| -------------- |
|
|
68
|
-
| `ready` | `Ref<boolean>`
|
|
69
|
-
| `error` | `Ref<unknown>`
|
|
70
|
-
| `user` | `Ref<User \| null>`
|
|
71
|
-
| `access_token` | `Ref<string \| null>`
|
|
72
|
-
| `client` | `Ref<OidcClient \| null>`
|
|
73
|
-
| `login()` | `() => void`
|
|
74
|
-
| `logout()` | `() => void`
|
|
66
|
+
| Property | Type | Description |
|
|
67
|
+
| -------------- | ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
68
|
+
| `ready` | `Ref<boolean>` | `true` once initialization has finished (successfully or not) |
|
|
69
|
+
| `error` | `Ref<unknown>` | Error during initialization (e.g. provider unreachable, login cancelled) or when the session could not be renewed. Cleared on the next successful refresh |
|
|
70
|
+
| `user` | `Ref<User \| null>` | User info of the authenticated user. Cleared when the user logs out in another tab or the provider rejects the session |
|
|
71
|
+
| `access_token` | `Ref<string \| null>` | Current access token, kept up to date on refresh |
|
|
72
|
+
| `client` | `Ref<OidcClient \| null>` | Underlying `@moreillon/oidc-auth` client |
|
|
73
|
+
| `login()` | `() => void` | Redirect to the provider's login page |
|
|
74
|
+
| `logout()` | `() => void` | Log out at the provider |
|
|
75
75
|
|
|
76
76
|
`error.value instanceof TokenRejectedError` (exported by this package) tells a session rejected by the provider apart from network or server errors.
|
|
77
77
|
|