payload-zitadel-plugin 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 CHANGED
@@ -12,7 +12,7 @@ Thus the user collection in PayloadCMS becomes just a shadow of the information
12
12
  ## Install
13
13
 
14
14
  ```shell
15
- pnpm add payload-zitadel-plugin@0.2.0
15
+ pnpm add payload-zitadel-plugin@0.2.1
16
16
  ```
17
17
 
18
18
  ## Configuration
@@ -32,16 +32,16 @@ export default buildConfig({
32
32
  ZitadelPlugin({
33
33
  // URL of your Zitadel instance
34
34
  issuerUrl: process.env.ZITADEL_URL,
35
-
35
+
36
36
  // in Zitadel create a new App->Web->PKCE, then copy the Client ID
37
37
  clientId: process.env.ZITADEL_CLIENT_ID,
38
38
 
39
39
  // interpolation text for the Login Button - "sign in with ..."
40
40
  label: 'Zitadel',
41
-
41
+
42
42
  // set the name of the CustomStrategy in PayloadCMS - usually not necessary
43
43
  // strategyName: 'zitadel'
44
-
44
+
45
45
  // set to true if you do not want to use the Zitadel Profile Picture as the Avatar
46
46
  // disableAvatar: true
47
47
 
@@ -101,11 +101,14 @@ const nextConfig = {
101
101
  export default withPayload(nextConfig)
102
102
  ```
103
103
 
104
- ### add profile picture url to accepted Next.js assets
104
+ ### further configuration
105
105
 
106
106
  If you want to use the Zitadel profile picture as the avatar in PayloadCMS (`disableAvatar != true`),
107
107
  you have to manually add the asset URL to the Next.js config file.
108
108
 
109
+ Also if you want to automatically redirect to Zitadel without asking the user to click on the login button,
110
+ you have to add the redirect manually to the Next.js config file.
111
+
109
112
  #### next.config.js
110
113
 
111
114
  ```typescript
@@ -113,6 +116,8 @@ import {withPayload} from '@payloadcms/next/withPayload'
113
116
 
114
117
  /** @type {import('next').NextConfig} */
115
118
  const nextConfig = {
119
+ // if Avatar enabled:
120
+ // allow loading assets like profile pictures from Zitadel
116
121
  images: {
117
122
  remotePatterns: [
118
123
  {
@@ -122,7 +127,18 @@ const nextConfig = {
122
127
  pathname: '/assets/**'
123
128
  }
124
129
  ]
130
+ },
131
+ // optional: enable auto-redirect to Zitadel login page if no logged in
132
+ async redirects() {
133
+ return [
134
+ {
135
+ source: '/admin/login',
136
+ destination: '/api/users/authorize',
137
+ permanent: true
138
+ }
139
+ ]
125
140
  }
141
+
126
142
  }
127
143
 
128
144
  export default withPayload(nextConfig)
@@ -1,5 +1,5 @@
1
1
  import { SanitizedConfig } from 'payload';
2
2
  export declare const getCurrentUser: ({ config }: {
3
3
  config: Promise<SanitizedConfig>;
4
- }) => Promise<(import("payload").TypeWithID & Record<string, unknown>) | null>;
4
+ }) => Promise<(Record<string, unknown> & import("payload").TypeWithID) | null>;
5
5
  //# sourceMappingURL=user.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payload-zitadel-plugin",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "plugin for Payload CMS, which enables authentication via Zitadel IdP",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -36,12 +36,12 @@
36
36
  "dist"
37
37
  ],
38
38
  "dependencies": {
39
- "@payloadcms/next": "3.0.0-beta.59",
40
- "@payloadcms/translations": "3.0.0-beta.59",
41
- "@payloadcms/ui": "3.0.0-beta.59",
39
+ "@payloadcms/next": "3.0.0-beta.63",
40
+ "@payloadcms/translations": "3.0.0-beta.63",
41
+ "@payloadcms/ui": "3.0.0-beta.63",
42
42
  "jsonwebtoken": "^9.0.2",
43
- "next": "^15.0.0-canary.59",
44
- "payload": "3.0.0-beta.59",
43
+ "next": "^15.0.0-canary.66",
44
+ "payload": "3.0.0-beta.63",
45
45
  "react": "rc",
46
46
  "react-dom": "rc"
47
47
  },
@@ -52,7 +52,7 @@
52
52
  "@types/node": "^20.14.10",
53
53
  "@types/react": "^18.3.3",
54
54
  "@types/react-dom": "^18.3.0",
55
- "rimraf": "^6.0.0",
55
+ "rimraf": "^6.0.1",
56
56
  "typescript": "^5.5.3"
57
57
  },
58
58
  "engines": {