@ghentcdh/authentication-vue 0.0.2-8 → 0.0.2-9

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.
Files changed (2) hide show
  1. package/README.md +12 -62
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,10 +1,19 @@
1
+ GhentCdh Keycloak libraries for authentication
2
+
3
+ # Vue frontend
4
+
5
+ ## Install the libraries
6
+
7
+ ```ssh
8
+ pnpm add @ghentcdh/auth/vue @ghentcdh/auth/backend
9
+ ```
1
10
 
2
11
  # Use the GhentCDH keycloak libraries for authentication
3
12
 
4
13
  ## Install the libraries
5
14
 
6
15
  ```ssh
7
- pnpm add @ghentcdh/auth-vue @ghentcdh/auth-api
16
+ pnpm add @ghentcdh/auth/vue @ghentcdh/auth/backend
8
17
  ```
9
18
 
10
19
  ## Frontend vuejs
@@ -22,7 +31,7 @@ Add following environment variables to the `.env` file.
22
31
  ```vue
23
32
 
24
33
  <script setup lang="ts">
25
- import {useAuthenticationStore} from "@ghentcdh/authentication-vue";
34
+ import {useAuthenticationStore} from "@ghentcdh/authentication/vue";
26
35
 
27
36
  const authenticationStore = useAuthenticationStore();
28
37
  </script>
@@ -38,7 +47,7 @@ Add following environment variables to the `.env` file.
38
47
  ```vue
39
48
 
40
49
  <script setup lang="ts">
41
- import {useHttpStore} from "@ghentcdh/authentication-vue";
50
+ import {useHttpStore} from "@ghentcdh/authentication/vue";
42
51
 
43
52
  const httpStore = useHttpStore();
44
53
 
@@ -55,62 +64,3 @@ Add following environment variables to the `.env` file.
55
64
  > - [ ] Test if it's possible to have public routes
56
65
  > - [ ] Add a
57
66
  > - [ ] Add logout functionality
58
-
59
- ## Backend nestjs
60
-
61
- Add following environment variables to the `.env` file.
62
-
63
- ```
64
- - KEYCLOAK_HOST=$KEYCLOAK_HOST
65
- - KEYCLOAK_REALM=$KEYCLOAK_REALM
66
- ```
67
-
68
- ### Secure requests
69
-
70
- Add the module to your module.ts imports
71
-
72
- ```typescript
73
-
74
- import {AuthenticationApiModule} from "@ghentcdh/authentication-api";
75
-
76
- @Module({
77
- imports: [AuthenticationApiModule],
78
- })
79
- export class MyModule {
80
- }
81
-
82
- ```
83
-
84
- Use the `@GhentCdhGuard` decorator to secure your routes
85
-
86
- ```typescript
87
- import {GhentCdhGuard} from "@ghentcdh/authentication-api";
88
-
89
- @Controller()
90
- export class MyController {
91
- @UseGuards(GhentCdhGuard)
92
- @Post('/secure')
93
- async securePath(@User() user: any, @Request() req: any) {
94
- return user;
95
- }
96
- }
97
- ```
98
-
99
- The `@User()` decorator will give you the user object from the keycloak token.
100
-
101
-
102
- > TODO list
103
- > - [ ] Add roles decorator and implement logic `@GhentCdhRoles(['admin'])`
104
-
105
- ## Development environment
106
-
107
- Make sure the following is added to your hosts file, if you are running a local keycloak instance. Internally the docker
108
- containers cannot connect to the localhost:8080 port, so a hook is needed in terms of host rewrite.
109
-
110
- ```sh
111
- echo "127.0.0.1 authentication\n" | sudo tee -a /etc/hosts
112
- ```
113
-
114
- ## Setup docker
115
-
116
- > TODO describe me
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ghentcdh/authentication-vue",
3
3
  "license": "MIT",
4
- "version": "0.0.2-8",
4
+ "version": "0.0.2-9",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
7
7
  "dependencies": {