payload-zitadel-plugin 0.4.1 → 0.4.3
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 +45 -37
- package/dist/constants.d.ts +6 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +6 -0
- package/dist/constants.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +24 -2
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +6 -6
package/README.md
CHANGED
@@ -2,22 +2,24 @@
|
|
2
2
|
|
3
3
|
[](https://npmjs.org/package/payload-zitadel-plugin)
|
4
4
|
|
5
|
-
plugin for [Payload CMS](https://payloadcms.com), which enables authentication via Zitadel IdP
|
5
|
+
a plugin for [Payload CMS](https://payloadcms.com) (v3), which enables authentication via Zitadel IdP
|
6
6
|
|
7
7
|
The default use case is to fully replace PayloadCMS Auth with Zitadel.
|
8
8
|
Thus, the user collection in PayloadCMS becomes just a shadow of the information in Zitadel.
|
9
9
|
|
10
|
-
:boom: :boom: :boom: works :100: with PayloadCMS version :three: :boom: :boom: :boom:
|
11
|
-
|
12
10
|
## Install
|
13
11
|
|
14
12
|
```shell
|
15
|
-
pnpm add payload-zitadel-plugin@0.4.
|
13
|
+
pnpm add payload-zitadel-plugin@0.4.2
|
16
14
|
```
|
17
15
|
|
18
16
|
## Configuration
|
19
17
|
|
20
|
-
Initialize the plugin in Payload
|
18
|
+
Initialize the plugin in the Payload config file. Change the parameters to connect to your Zitadel instance.
|
19
|
+
|
20
|
+
The cleanest way to use this plugin is just to set the `ZITADEL_URL` and `ZITADEL_CLIENT_ID` environment variables,
|
21
|
+
set up the `next.config.ts` as described down below and then add `zitadelPlugin()` without further configuration to the
|
22
|
+
plugin list.
|
21
23
|
|
22
24
|
#### payload.config.ts
|
23
25
|
|
@@ -31,14 +33,16 @@ export default buildConfig({
|
|
31
33
|
plugins: [
|
32
34
|
zitadelPlugin({
|
33
35
|
// URL of your Zitadel instance
|
34
|
-
|
36
|
+
// if not provided, it will look for the ZITADEL_URL environment variable
|
37
|
+
// issuerUrl: 'https://idp.zitadel.url',
|
35
38
|
|
36
39
|
// in Zitadel create a new App->Web->PKCE in your project, then copy the Client ID
|
37
40
|
// DO NOT FORGET to add '{http://localhost with development mode on or https://your-domain.tld}/api/users/callback'
|
38
41
|
// to the allowed redirect URIs and ALSO to the post logout redirect URIs
|
39
|
-
|
42
|
+
// if not provided, it will look for the ZITADEL_CLIENT_ID environment variable
|
43
|
+
// clientId: '123456789012345678@project_name',
|
40
44
|
|
41
|
-
// change field names, field labels and
|
45
|
+
// change field names, field labels and also hide them if wanted
|
42
46
|
/*
|
43
47
|
fieldConfig: {
|
44
48
|
image: {
|
@@ -46,7 +50,7 @@ export default buildConfig({
|
|
46
50
|
label: 'some custom label'
|
47
51
|
}
|
48
52
|
}
|
49
|
-
|
53
|
+
*/
|
50
54
|
|
51
55
|
// set the name of the CustomStrategy in PayloadCMS - usually not necessary
|
52
56
|
// strategyName: 'zitadel'
|
@@ -67,7 +71,7 @@ export default buildConfig({
|
|
67
71
|
// interpolation text for the Login Button - "sign in with ..."
|
68
72
|
label: 'Zitadel'
|
69
73
|
}
|
70
|
-
|
74
|
+
*/
|
71
75
|
|
72
76
|
// if you want to manually control what happens after a successful login
|
73
77
|
// afterLogin: (req) => NextResponse.redirect('...')
|
@@ -78,13 +82,15 @@ export default buildConfig({
|
|
78
82
|
// following properties are only needed if you want to authenticate clients (e.g. a mobile app) for the API
|
79
83
|
// if the users are just visiting the CMS via a browser you can ignore all of them
|
80
84
|
// otherwise create in Zitadel a new App->API->JWT and copy the Client ID, Key ID and the Key itself
|
85
|
+
// if not provided it will look for the ZITADEL_API_CLIENT_ID environment variable
|
86
|
+
// if ZITADEL_API_CLIENT_ID was found it will look for ZITADEL_API_KEY_ID and ZITADEL_API_KEY
|
81
87
|
/*
|
82
88
|
api: {
|
83
|
-
clientId:
|
84
|
-
keyId:
|
85
|
-
key:
|
89
|
+
clientId: '123456789123456789@project_name'
|
90
|
+
keyId: '123456789012345678'
|
91
|
+
key: '-----BEGIN RSA PRIVATE KEY----- ... ----END RSA PRIVATE KEY-----'
|
86
92
|
}
|
87
|
-
|
93
|
+
*/
|
88
94
|
})
|
89
95
|
],
|
90
96
|
...
|
@@ -105,48 +111,50 @@ ZITADEL_API_KEY='-----BEGIN RSA PRIVATE KEY----- ... ----END RSA PRIVATE KEY----
|
|
105
111
|
|
106
112
|
or use the Next.js Config file:
|
107
113
|
|
108
|
-
#### next.config.
|
114
|
+
#### next.config.ts
|
109
115
|
|
110
116
|
```typescript
|
111
117
|
import {withPayload} from '@payloadcms/next/withPayload'
|
112
118
|
|
113
|
-
|
114
|
-
|
119
|
+
export default withPayload({
|
120
|
+
...,
|
115
121
|
env: {
|
116
122
|
ZITADEL_URL: 'https://idp.zitadel.url',
|
117
123
|
ZITADEL_CLIENT_ID: '123456789012345678@project_name',
|
118
124
|
ZITADEL_API_CLIENT_ID: '123456789123456789@project_name',
|
119
125
|
ZITADEL_API_KEY_ID: '123456789012345678',
|
120
126
|
ZITADEL_API_KEY: '-----BEGIN RSA PRIVATE KEY----- ... ----END RSA PRIVATE KEY-----'
|
121
|
-
}
|
122
|
-
|
123
|
-
|
124
|
-
export default withPayload(nextConfig)
|
127
|
+
},
|
128
|
+
...
|
129
|
+
})
|
125
130
|
```
|
126
131
|
|
127
132
|
### further configuration
|
128
133
|
|
129
|
-
If you want to use the Zitadel profile picture as the avatar in PayloadCMS
|
134
|
+
If you want to use the Zitadel profile picture as the avatar in PayloadCMS,
|
130
135
|
you have to manually add the asset URL to the Next.js config file.
|
131
136
|
|
132
|
-
|
137
|
+
For a proper logout you have to add the `end_session` redirect.
|
138
|
+
|
139
|
+
Also, if you want to automatically redirect to Zitadel without asking the user to click on the login button,
|
133
140
|
you have to add the redirect manually to the Next.js config file.
|
134
141
|
|
135
|
-
#### next.config.
|
142
|
+
#### next.config.ts
|
136
143
|
|
137
144
|
```typescript
|
138
145
|
import {withPayload} from '@payloadcms/next/withPayload'
|
139
146
|
|
140
|
-
|
141
|
-
|
147
|
+
export default withPayload({
|
148
|
+
...,
|
149
|
+
|
142
150
|
// if Avatar enabled:
|
143
151
|
// allow loading assets like profile pictures from Zitadel
|
144
152
|
images: {
|
145
153
|
remotePatterns: [
|
146
154
|
{
|
147
|
-
//protocol: new URL(process.env.ZITADEL_URL).protocol,
|
155
|
+
// protocol: new URL(process.env.ZITADEL_URL).protocol,
|
148
156
|
hostname: new URL(process.env.ZITADEL_URL).hostname,
|
149
|
-
//port: new URL(process.env.ZITADEL_URL).port,
|
157
|
+
// port: new URL(process.env.ZITADEL_URL).port,
|
150
158
|
pathname: '/assets/**'
|
151
159
|
}
|
152
160
|
]
|
@@ -156,6 +164,8 @@ const nextConfig = {
|
|
156
164
|
return [
|
157
165
|
// for proper logout
|
158
166
|
{
|
167
|
+
// all paths, that do not start with 'api'
|
168
|
+
// it is important to ignore the Payload API routes!
|
159
169
|
source: '/:path((?!api).*)',
|
160
170
|
destination: '/api/users/end_session?redirect=/:path*',
|
161
171
|
has: [
|
@@ -168,26 +178,24 @@ const nextConfig = {
|
|
168
178
|
},
|
169
179
|
// optional: enable auto-redirect to Zitadel login page if not logged in
|
170
180
|
{
|
171
|
-
|
181
|
+
// all paths that start with 'admin' or 'profile'
|
182
|
+
// you could replace 'profile' with 'app' or some other protected route
|
183
|
+
source: '/:path((?:admin|profile).*)',
|
172
184
|
destination: '/api/users/authorize?redirect=/:path*',
|
173
185
|
missing: [
|
174
186
|
{
|
175
187
|
type: 'cookie',
|
176
188
|
key: 'zitadel_id_token'
|
177
|
-
},
|
178
|
-
{
|
179
|
-
type: 'cookie',
|
180
|
-
key: 'zitadel_logout'
|
181
189
|
}
|
182
190
|
],
|
183
191
|
permanent: false
|
184
192
|
}
|
185
193
|
]
|
186
|
-
}
|
187
|
-
|
188
|
-
|
194
|
+
},
|
195
|
+
|
196
|
+
...
|
189
197
|
|
190
|
-
|
198
|
+
})
|
191
199
|
```
|
192
200
|
|
193
201
|
## For an example look in this repository at the `dev` directory!
|
package/dist/constants.d.ts
CHANGED
@@ -94,6 +94,12 @@ export declare const ENDPOINT_PATHS: {
|
|
94
94
|
token: string;
|
95
95
|
end_session: string;
|
96
96
|
};
|
97
|
+
export declare const ERRORS: {
|
98
|
+
issuerURL: Error;
|
99
|
+
clientId: Error;
|
100
|
+
apiKeyId: Error;
|
101
|
+
apiKey: Error;
|
102
|
+
};
|
97
103
|
export declare const ROLES_KEY = "urn:zitadel:iam:org:project:roles";
|
98
104
|
export declare const ROUTES: {
|
99
105
|
authorize: string;
|
package/dist/constants.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,eAAe;;;;CAI3B,CAAA;AAED,eAAO,MAAM,eAAe,sCAAsC,CAAA;AASlE,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;CAcnB,CAAA;AAED,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsC1B,CAAA;AAED,eAAO,MAAM,cAAc;;;;;CAK1B,CAAA;AAED,eAAO,MAAM,SAAS,sCAAsC,CAAA;AAE5D,eAAO,MAAM,MAAM;;;;CAIlB,CAAA"}
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,eAAe;;;;CAI3B,CAAA;AAED,eAAO,MAAM,eAAe,sCAAsC,CAAA;AASlE,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;CAcnB,CAAA;AAED,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsC1B,CAAA;AAED,eAAO,MAAM,cAAc;;;;;CAK1B,CAAA;AAED,eAAO,MAAM,MAAM;;;;;CAWlB,CAAA;AAED,eAAO,MAAM,SAAS,sCAAsC,CAAA;AAE5D,eAAO,MAAM,MAAM;;;;CAIlB,CAAA"}
|
package/dist/constants.js
CHANGED
@@ -91,6 +91,12 @@ export const ENDPOINT_PATHS = {
|
|
91
91
|
token: '/oauth/v2/token',
|
92
92
|
end_session: '/oidc/v1/end_session'
|
93
93
|
};
|
94
|
+
export const ERRORS = {
|
95
|
+
issuerURL: new Error('ZITADEL-PLUGIN | Error during initialization of the issuer URL: ' + 'issuerURL in plugin configuration not provided or empty and ZITADEL_URL environment variable also not found or empty'),
|
96
|
+
clientId: new Error('ZITADEL-PLUGIN | Error during initialization of the client Id: ' + 'clientId in plugin configuration not provided or empty and ZITADEL_CLIENT_ID environment variable also not found or empty'),
|
97
|
+
apiKeyId: new Error('ZITADEL-PLUGIN | Error during initialization of the API credentials: ' + 'API is enabled (api credentials in plugin configuration not provided, but the ZITADEL_API_CLIENT_ID environment variable was found), ' + 'but ZITADEL_API_KEY_ID environment variable was not found or is empty'),
|
98
|
+
apiKey: new Error('ZITADEL-PLUGIN | Error during initialization of the API credentials: ' + 'API is enabled (api credentials in plugin configuration not provided, but the ZITADEL_API_CLIENT_ID environment variable was found), ' + 'but ZITADEL_API_KEY environment variable was not found or is empty')
|
99
|
+
};
|
94
100
|
export const ROLES_KEY = 'urn:zitadel:iam:org:project:roles';
|
95
101
|
export const ROUTES = {
|
96
102
|
authorize: '/authorize',
|
package/dist/constants.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/constants.ts"],"sourcesContent":["import {ResponseCookie} from 'next/dist/compiled/@edge-runtime/cookies/index.js'\nimport type {ZitadelFieldsConfig} from './types.js'\n\nexport const AUTHORIZE_QUERY = {\n response_type: 'code',\n scope: 'openid email profile',\n code_challenge_method: 'S256'\n}\n\nexport const COMPONENTS_PATH = 'payload-zitadel-plugin/components'\n\nconst COOKIE_CONFIG = {\n httpOnly: true,\n path: '/',\n sameSite: 'lax',\n secure: process.env.NODE_ENV == 'production'\n} satisfies Pick<ResponseCookie, 'httpOnly' | 'path' | 'sameSite' | 'secure'>\n\nexport const COOKIES = {\n pkce: {\n name: 'zitadel_pkce_code_verifier',\n ...COOKIE_CONFIG\n } satisfies Omit<ResponseCookie, 'value'>,\n idToken: {\n name: 'zitadel_id_token',\n ...COOKIE_CONFIG\n } satisfies Omit<ResponseCookie, 'value'>,\n logout: {\n name: 'zitadel_logout',\n value: 'true',\n ...COOKIE_CONFIG\n } satisfies ResponseCookie\n}\n\nexport const DEFAULT_CONFIG = {\n fields: {\n id: {\n name: 'idp_id',\n label: {\n de: 'Identifikation im System des Identitätsanbieters',\n en: 'Identifier in the system of the Identity Provider'\n }\n },\n name: {\n name: 'name',\n label: {de: 'Name', en: 'Name'}\n },\n email: {\n name: 'email',\n label: {de: 'E-Mail', en: 'Email'}\n },\n image: {\n name: 'image',\n label: {de: 'Profilbild-URL', en: 'Profile picture URL'}\n },\n roles: {\n name: 'roles',\n label: {de: 'Rollen', en: 'Roles'},\n labels: {\n singular: {de: 'Rolle', en: 'Role'},\n plural: {de: 'Rollen', en: 'Roles'}\n }\n },\n roleFields: {\n name: {\n name: 'name',\n label: {de: 'Name', en: 'Name'}\n }\n }\n } satisfies ZitadelFieldsConfig,\n strategyName: 'zitadel',\n label: 'Zitadel'\n}\n\nexport const ENDPOINT_PATHS = {\n authorize: '/oauth/v2/authorize',\n introspect: '/oauth/v2/introspect',\n token: '/oauth/v2/token',\n end_session: '/oidc/v1/end_session'\n}\n\nexport const ROLES_KEY = 'urn:zitadel:iam:org:project:roles'\n\nexport const ROUTES = {\n authorize: '/authorize',\n callback: '/callback',\n end_session: '/end_session'\n}\n\n"],"names":["AUTHORIZE_QUERY","response_type","scope","code_challenge_method","COMPONENTS_PATH","COOKIE_CONFIG","httpOnly","path","sameSite","secure","process","env","NODE_ENV","COOKIES","pkce","name","idToken","logout","value","DEFAULT_CONFIG","fields","id","label","de","en","email","image","roles","labels","singular","plural","roleFields","strategyName","ENDPOINT_PATHS","authorize","introspect","token","end_session","ROLES_KEY","ROUTES","callback"],"mappings":"AAGA,OAAO,MAAMA,kBAAkB;IAC3BC,eAAe;IACfC,OAAO;IACPC,uBAAuB;AAC3B,EAAC;AAED,OAAO,MAAMC,kBAAkB,oCAAmC;AAElE,MAAMC,gBAAgB;IAClBC,UAAU;IACVC,MAAM;IACNC,UAAU;IACVC,QAAQC,QAAQC,GAAG,CAACC,QAAQ,IAAI;AACpC;AAEA,OAAO,MAAMC,UAAU;IACnBC,MAAM;QACFC,MAAM;QACN,GAAGV,aAAa;IACpB;IACAW,SAAS;QACLD,MAAM;QACN,GAAGV,aAAa;IACpB;IACAY,QAAQ;QACJF,MAAM;QACNG,OAAO;QACP,GAAGb,aAAa;IACpB;AACJ,EAAC;AAED,OAAO,MAAMc,iBAAiB;IAC1BC,QAAQ;QACJC,IAAI;YACAN,MAAM;YACNO,OAAO;gBACHC,IAAI;gBACJC,IAAI;YACR;QACJ;QACAT,MAAM;YACFA,MAAM;YACNO,OAAO;gBAACC,IAAI;gBAAQC,IAAI;YAAM;QAClC;QACAC,OAAO;YACHV,MAAM;YACNO,OAAO;gBAACC,IAAI;gBAAUC,IAAI;YAAO;QACrC;QACAE,OAAO;YACHX,MAAM;YACNO,OAAO;gBAACC,IAAI;gBAAkBC,IAAI;YAAqB;QAC3D;QACAG,OAAO;YACHZ,MAAM;YACNO,OAAO;gBAACC,IAAI;gBAAUC,IAAI;YAAO;YACjCI,QAAQ;gBACJC,UAAU;oBAACN,IAAI;oBAASC,IAAI;gBAAM;gBAClCM,QAAQ;oBAACP,IAAI;oBAAUC,IAAI;gBAAO;YACtC;QACJ;QACAO,YAAY;YACRhB,MAAM;gBACFA,MAAM;gBACNO,OAAO;oBAACC,IAAI;oBAAQC,IAAI;gBAAM;YAClC;QACJ;IACJ;IACAQ,cAAc;IACdV,OAAO;AACX,EAAC;AAED,OAAO,MAAMW,iBAAiB;IAC1BC,WAAW;IACXC,YAAY;IACZC,OAAO;IACPC,aAAa;AACjB,EAAC;AAED,OAAO,MAAMC,YAAY,oCAAmC;AAE5D,OAAO,MAAMC,SAAS;
|
1
|
+
{"version":3,"sources":["../src/constants.ts"],"sourcesContent":["import {ResponseCookie} from 'next/dist/compiled/@edge-runtime/cookies/index.js'\nimport type {ZitadelFieldsConfig} from './types.js'\n\nexport const AUTHORIZE_QUERY = {\n response_type: 'code',\n scope: 'openid email profile',\n code_challenge_method: 'S256'\n}\n\nexport const COMPONENTS_PATH = 'payload-zitadel-plugin/components'\n\nconst COOKIE_CONFIG = {\n httpOnly: true,\n path: '/',\n sameSite: 'lax',\n secure: process.env.NODE_ENV == 'production'\n} satisfies Pick<ResponseCookie, 'httpOnly' | 'path' | 'sameSite' | 'secure'>\n\nexport const COOKIES = {\n pkce: {\n name: 'zitadel_pkce_code_verifier',\n ...COOKIE_CONFIG\n } satisfies Omit<ResponseCookie, 'value'>,\n idToken: {\n name: 'zitadel_id_token',\n ...COOKIE_CONFIG\n } satisfies Omit<ResponseCookie, 'value'>,\n logout: {\n name: 'zitadel_logout',\n value: 'true',\n ...COOKIE_CONFIG\n } satisfies ResponseCookie\n}\n\nexport const DEFAULT_CONFIG = {\n fields: {\n id: {\n name: 'idp_id',\n label: {\n de: 'Identifikation im System des Identitätsanbieters',\n en: 'Identifier in the system of the Identity Provider'\n }\n },\n name: {\n name: 'name',\n label: {de: 'Name', en: 'Name'}\n },\n email: {\n name: 'email',\n label: {de: 'E-Mail', en: 'Email'}\n },\n image: {\n name: 'image',\n label: {de: 'Profilbild-URL', en: 'Profile picture URL'}\n },\n roles: {\n name: 'roles',\n label: {de: 'Rollen', en: 'Roles'},\n labels: {\n singular: {de: 'Rolle', en: 'Role'},\n plural: {de: 'Rollen', en: 'Roles'}\n }\n },\n roleFields: {\n name: {\n name: 'name',\n label: {de: 'Name', en: 'Name'}\n }\n }\n } satisfies ZitadelFieldsConfig,\n strategyName: 'zitadel',\n label: 'Zitadel'\n}\n\nexport const ENDPOINT_PATHS = {\n authorize: '/oauth/v2/authorize',\n introspect: '/oauth/v2/introspect',\n token: '/oauth/v2/token',\n end_session: '/oidc/v1/end_session'\n}\n\nexport const ERRORS = {\n issuerURL: new Error('ZITADEL-PLUGIN | Error during initialization of the issuer URL: ' +\n 'issuerURL in plugin configuration not provided or empty and ZITADEL_URL environment variable also not found or empty'),\n clientId: new Error('ZITADEL-PLUGIN | Error during initialization of the client Id: ' +\n 'clientId in plugin configuration not provided or empty and ZITADEL_CLIENT_ID environment variable also not found or empty'),\n apiKeyId: new Error('ZITADEL-PLUGIN | Error during initialization of the API credentials: ' +\n 'API is enabled (api credentials in plugin configuration not provided, but the ZITADEL_API_CLIENT_ID environment variable was found), ' +\n 'but ZITADEL_API_KEY_ID environment variable was not found or is empty'),\n apiKey: new Error('ZITADEL-PLUGIN | Error during initialization of the API credentials: ' +\n 'API is enabled (api credentials in plugin configuration not provided, but the ZITADEL_API_CLIENT_ID environment variable was found), ' +\n 'but ZITADEL_API_KEY environment variable was not found or is empty')\n}\n\nexport const ROLES_KEY = 'urn:zitadel:iam:org:project:roles'\n\nexport const ROUTES = {\n authorize: '/authorize',\n callback: '/callback',\n end_session: '/end_session'\n}\n\n"],"names":["AUTHORIZE_QUERY","response_type","scope","code_challenge_method","COMPONENTS_PATH","COOKIE_CONFIG","httpOnly","path","sameSite","secure","process","env","NODE_ENV","COOKIES","pkce","name","idToken","logout","value","DEFAULT_CONFIG","fields","id","label","de","en","email","image","roles","labels","singular","plural","roleFields","strategyName","ENDPOINT_PATHS","authorize","introspect","token","end_session","ERRORS","issuerURL","Error","clientId","apiKeyId","apiKey","ROLES_KEY","ROUTES","callback"],"mappings":"AAGA,OAAO,MAAMA,kBAAkB;IAC3BC,eAAe;IACfC,OAAO;IACPC,uBAAuB;AAC3B,EAAC;AAED,OAAO,MAAMC,kBAAkB,oCAAmC;AAElE,M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IACA;AACR,EAAC;AAED,OAAO,MAAMI,YAAY,oCAAmC;AAE5D,OAAO,MAAMC,SAAS;IAClBX,WAAW;IACXY,UAAU;IACVT,aAAa;AACjB,EAAC"}
|
package/dist/index.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAqB,aAAa,EAAC,MAAM,YAAY,CAAA;AAG5D,eAAO,MAAM,aAAa,EAAE,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAqB,aAAa,EAAC,MAAM,YAAY,CAAA;AAG5D,eAAO,MAAM,aAAa,EAAE,aA0L3B,CAAA"}
|
package/dist/index.js
CHANGED
@@ -1,11 +1,33 @@
|
|
1
1
|
import { cookies } from 'next/headers.js';
|
2
2
|
import { AvatarComponent, LoginButtonComponent } from './components/index.js';
|
3
|
-
import { COOKIES, DEFAULT_CONFIG, ROUTES } from './constants.js';
|
3
|
+
import { COOKIES, DEFAULT_CONFIG, ERRORS, ROUTES } from './constants.js';
|
4
4
|
import { authorize, callback } from './handlers/index.js';
|
5
5
|
import { zitadelStrategy } from './strategy.js';
|
6
6
|
import { translations } from './translations.js';
|
7
7
|
import { defaultRedirect, getAuthSlug, requestRedirect } from './utils/index.js';
|
8
|
-
export const zitadelPlugin = (
|
8
|
+
export const zitadelPlugin = (config)=>{
|
9
|
+
let { issuerURL = process.env.ZITADEL_URL, clientId = process.env.ZITADEL_CLIENT_ID, fields, strategyName = DEFAULT_CONFIG.strategyName, api, callbacks, components } = config ?? {};
|
10
|
+
if (!issuerURL) {
|
11
|
+
throw ERRORS.issuerURL;
|
12
|
+
}
|
13
|
+
if (!clientId) {
|
14
|
+
throw ERRORS.clientId;
|
15
|
+
}
|
16
|
+
if (!api && process.env.ZITADEL_API_CLIENT_ID) {
|
17
|
+
const keyId = process.env.ZITADEL_API_KEY_ID;
|
18
|
+
if (!keyId) {
|
19
|
+
throw ERRORS.apiKeyId;
|
20
|
+
}
|
21
|
+
const key = process.env.ZITADEL_API_KEY;
|
22
|
+
if (!key) {
|
23
|
+
throw ERRORS.apiKey;
|
24
|
+
}
|
25
|
+
api = {
|
26
|
+
clientId: process.env.ZITADEL_API_CLIENT_ID,
|
27
|
+
keyId,
|
28
|
+
key
|
29
|
+
};
|
30
|
+
}
|
9
31
|
const fieldsConfig = {
|
10
32
|
...DEFAULT_CONFIG.fields,
|
11
33
|
...fields
|
package/dist/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import {cookies} from 'next/headers.js'\nimport {AvatarComponent, LoginButtonComponent} from './components/index.js'\nimport {COOKIES, DEFAULT_CONFIG, ROUTES} from './constants.js'\nimport {authorize, callback} from './handlers/index.js'\nimport {zitadelStrategy} from './strategy.js'\nimport {translations} from './translations.js'\nimport {ZitadelAvatarProps, ZitadelPlugin} from './types.js'\nimport {defaultRedirect, getAuthSlug, requestRedirect} from './utils/index.js'\n\nexport const zitadelPlugin: ZitadelPlugin = ({\n issuerURL,\n clientId,\n fields,\n strategyName = DEFAULT_CONFIG.strategyName,\n api,\n callbacks,\n components\n }) => {\n\n const fieldsConfig = {...DEFAULT_CONFIG.fields, ...fields}\n\n return (incomingConfig) => ({\n ...incomingConfig,\n admin: {\n ...incomingConfig.admin,\n ...components?.avatar ? {} : {\n avatar: {\n Component: {\n ...AvatarComponent,\n clientProps: {\n imageFieldName: fieldsConfig.image.name\n } satisfies ZitadelAvatarProps\n }\n }\n },\n ...components?.loginButton ? {} : {\n components: {\n ...incomingConfig.admin?.components,\n afterLogin: [\n ...incomingConfig.admin?.components?.afterLogin ?? [],\n {\n ...LoginButtonComponent,\n serverProps: {\n label: components?.loginButton?.label ?? DEFAULT_CONFIG.label\n }\n }\n ]\n }\n }\n },\n collections: (incomingConfig.collections || []).map((collection) => {\n\n const authConfig = typeof collection.auth == 'boolean' ? {} : collection.auth\n\n return {\n ...collection,\n ...collection.slug == getAuthSlug(incomingConfig) ? {\n auth: {\n ...authConfig,\n disableLocalStrategy: true,\n strategies: [\n ...authConfig?.strategies ?? [],\n zitadelStrategy({\n strategyName: strategyName,\n issuerURL,\n fields: fieldsConfig,\n api: api ?? false\n })\n ]\n },\n hooks: {\n afterLogout: [async () => (await cookies()).set(COOKIES.logout)]\n },\n endpoints: [\n {\n path: ROUTES.authorize,\n method: 'get',\n handler: authorize({\n issuerURL,\n clientId\n })\n },\n {\n path: ROUTES.callback,\n method: 'get',\n handler: callback({\n issuerURL,\n clientId,\n fields: fieldsConfig,\n afterLogin: callbacks?.afterLogin ?? defaultRedirect,\n afterLogout: callbacks?.afterLogout ?? defaultRedirect\n })\n },\n {\n path: ROUTES.end_session,\n method: 'get',\n handler: (req) => requestRedirect({req, issuerURL, clientId, invokedBy: 'end_session'})\n }\n ],\n fields: [\n ...collection.fields,\n {\n ...fieldsConfig.id,\n type: 'text',\n admin: {\n readOnly: true\n },\n index: true,\n unique: true,\n required: true\n },\n {\n ...fieldsConfig.name,\n type: 'text',\n admin: {\n readOnly: true\n }\n },\n {\n ...fieldsConfig.email,\n type: 'email',\n admin: {\n readOnly: true\n }\n },\n {\n ...fieldsConfig.image,\n type: 'text',\n admin: {\n readOnly: true\n }\n },\n {\n ...fieldsConfig.roles,\n type: 'array',\n admin: {\n readOnly: true\n },\n fields: [\n {\n ...fieldsConfig.roleFields.name,\n type: 'text'\n }\n ]\n }\n ]\n } : {}\n }\n }),\n i18n: {\n ...incomingConfig.i18n,\n translations: {\n ...incomingConfig.i18n?.translations,\n de: {\n ...incomingConfig.i18n?.translations?.de,\n ...translations.de\n },\n en: {\n ...incomingConfig.i18n?.translations?.en,\n ...translations.en\n }\n }\n }\n })\n\n}"],"names":["cookies","AvatarComponent","LoginButtonComponent","COOKIES","DEFAULT_CONFIG","ROUTES","authorize","callback","zitadelStrategy","translations","defaultRedirect","getAuthSlug","requestRedirect","zitadelPlugin","issuerURL","clientId","fields","strategyName","api","callbacks","components","fieldsConfig","incomingConfig","admin","avatar","Component","clientProps","imageFieldName","image","name","loginButton","afterLogin","serverProps","label","collections","map","collection","authConfig","auth","slug","disableLocalStrategy","strategies","hooks","afterLogout","set","logout","endpoints","path","method","handler","end_session","req","invokedBy","id","type","readOnly","index","unique","required","email","roles","roleFields","i18n","de","en"],"mappings":"AAAA,SAAQA,OAAO,QAAO,kBAAiB;AACvC,SAAQC,eAAe,EAAEC,oBAAoB,QAAO,wBAAuB;AAC3E,SAAQC,OAAO,EAAEC,cAAc,EAAEC,MAAM,QAAO,iBAAgB;AAC9D,SAAQC,SAAS,EAAEC,QAAQ,QAAO,sBAAqB;AACvD,SAAQC,eAAe,QAAO,gBAAe;AAC7C,SAAQC,YAAY,QAAO,oBAAmB;AAE9C,SAAQC,eAAe,EAAEC,WAAW,EAAEC,eAAe,QAAO,mBAAkB;AAE9E,OAAO,MAAMC,gBAA+B,CAAC,EACIC,SAAS,EACTC,QAAQ,EACRC,MAAM,EACNC,eAAeb,eAAea,YAAY,EAC1CC,GAAG,EACHC,SAAS,EACTC,UAAU,EACb;IAE1C,MAAMC,eAAe;QAAC,GAAGjB,eAAeY,MAAM;QAAE,GAAGA,MAAM;IAAA;IAEzD,OAAO,CAACM,iBAAoB,CAAA;YACxB,GAAGA,cAAc;YACjBC,OAAO;gBACH,GAAGD,eAAeC,KAAK;gBACvB,GAAGH,YAAYI,SAAS,CAAC,IAAI;oBACzBA,QAAQ;wBACJC,WAAW;4BACP,GAAGxB,eAAe;4BAClByB,aAAa;gCACTC,gBAAgBN,aAAaO,KAAK,CAACC,IAAI;4BAC3C;wBACJ;oBACJ;gBACJ,CAAC;gBACD,GAAGT,YAAYU,cAAc,CAAC,IAAI;oBAC9BV,YAAY;wBACR,GAAGE,eAAeC,KAAK,EAAEH,UAAU;wBACnCW,YAAY;+BACLT,eAAeC,KAAK,EAAEH,YAAYW,cAAc,EAAE;4BACrD;g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N/B,OAAO;oCACHgC,UAAU;gCACd;gCACAC,OAAO;gCACPC,QAAQ;gCACRC,UAAU;4BACd;4BACA;gCACI,GAAGrC,aAAaQ,IAAI;gCACpByB,MAAM;gCACN/B,OAAO;oCACHgC,UAAU;gCACd;4BACJ;4BACA;gCACI,GAAGlC,aAAasC,KAAK;gCACrBL,MAAM;gCACN/B,OAAO;oCACHgC,UAAU;gCACd;4BACJ;4BACA;gCACI,GAAGlC,aAAaO,KAAK;gCACrB0B,MAAM;gCACN/B,OAAO;oCACHgC,UAAU;gCACd;4BACJ;4BACA;gCACI,GAAGlC,aAAauC,KAAK;gCACrBN,MAAM;gCACN/B,OAAO;oCACHgC,UAAU;gCACd;gCACAvC,QAAQ;oCACJ;wCACI,GAAGK,aAAawC,UAAU,CAAChC,IAAI;wCAC/ByB,MAAM;oCACV;iCACH;4BACL;yBACH;oBACL,IAAI,CAAC,CAAC;gBACV;YACJ;YACAQ,MAAM;gBACF,GAAGxC,eAAewC,IAAI;gBACtBrD,cAAc;oBACV,GAAGa,eAAewC,IAAI,EAAErD,YAAY;oBACpCsD,IAAI;wBACA,GAAGzC,eAAewC,IAAI,EAAErD,cAAcsD,EAAE;wBACxC,GAAGtD,aAAasD,EAAE;oBACtB;oBACAC,IAAI;wBACA,GAAG1C,eAAewC,IAAI,EAAErD,cAAcuD,EAAE;wBACxC,GAAGvD,aAAauD,EAAE;oBACtB;gBACJ;YACJ;QACJ,CAAA;AAEJ,EAAC"}
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import {cookies} from 'next/headers.js'\nimport {AvatarComponent, LoginButtonComponent} from './components/index.js'\nimport {COOKIES, DEFAULT_CONFIG, ERRORS, ROUTES} from './constants.js'\nimport {authorize, callback} from './handlers/index.js'\nimport {zitadelStrategy} from './strategy.js'\nimport {translations} from './translations.js'\nimport {ZitadelAvatarProps, ZitadelPlugin} from './types.js'\nimport {defaultRedirect, getAuthSlug, requestRedirect} from './utils/index.js'\n\nexport const zitadelPlugin: ZitadelPlugin = (config) => {\n\n let {\n issuerURL = process.env.ZITADEL_URL,\n clientId = process.env.ZITADEL_CLIENT_ID,\n fields,\n strategyName = DEFAULT_CONFIG.strategyName,\n api,\n callbacks,\n components\n } = config ?? {}\n\n if (!issuerURL) {\n throw ERRORS.issuerURL\n }\n\n if (!clientId) {\n throw ERRORS.clientId\n }\n\n if (!api && process.env.ZITADEL_API_CLIENT_ID) {\n\n const keyId = process.env.ZITADEL_API_KEY_ID\n if (!keyId) {\n throw ERRORS.apiKeyId\n }\n\n const key = process.env.ZITADEL_API_KEY\n if (!key) {\n throw ERRORS.apiKey\n }\n\n api = {\n clientId: process.env.ZITADEL_API_CLIENT_ID,\n keyId,\n key\n }\n\n }\n\n const fieldsConfig = {...DEFAULT_CONFIG.fields, ...fields}\n\n return (incomingConfig) => ({\n ...incomingConfig,\n admin: {\n ...incomingConfig.admin,\n ...components?.avatar ? {} : {\n avatar: {\n Component: {\n ...AvatarComponent,\n clientProps: {\n imageFieldName: fieldsConfig.image.name\n } satisfies ZitadelAvatarProps\n }\n }\n },\n ...components?.loginButton ? {} : {\n components: {\n ...incomingConfig.admin?.components,\n afterLogin: [\n ...incomingConfig.admin?.components?.afterLogin ?? [],\n {\n ...LoginButtonComponent,\n serverProps: {\n label: components?.loginButton?.label ?? DEFAULT_CONFIG.label\n }\n }\n ]\n }\n }\n },\n collections: (incomingConfig.collections || []).map((collection) => {\n\n const authConfig = typeof collection.auth == 'boolean' ? {} : collection.auth\n\n return {\n ...collection,\n ...collection.slug == getAuthSlug(incomingConfig) ? {\n auth: {\n ...authConfig,\n disableLocalStrategy: true,\n strategies: [\n ...authConfig?.strategies ?? [],\n zitadelStrategy({\n strategyName: strategyName,\n issuerURL,\n fields: fieldsConfig,\n api: api ?? false\n })\n ]\n },\n hooks: {\n afterLogout: [async () => (await cookies()).set(COOKIES.logout)]\n },\n endpoints: [\n {\n path: ROUTES.authorize,\n method: 'get',\n handler: authorize({\n issuerURL,\n clientId\n })\n },\n {\n path: ROUTES.callback,\n method: 'get',\n handler: callback({\n issuerURL,\n clientId,\n fields: fieldsConfig,\n afterLogin: callbacks?.afterLogin ?? defaultRedirect,\n afterLogout: callbacks?.afterLogout ?? defaultRedirect\n })\n },\n {\n path: ROUTES.end_session,\n method: 'get',\n handler: (req) => requestRedirect({req, issuerURL, clientId, invokedBy: 'end_session'})\n }\n ],\n fields: [\n ...collection.fields,\n {\n ...fieldsConfig.id,\n type: 'text',\n admin: {\n readOnly: true\n },\n index: true,\n unique: true,\n required: true\n },\n {\n ...fieldsConfig.name,\n type: 'text',\n admin: {\n readOnly: true\n }\n },\n {\n ...fieldsConfig.email,\n type: 'email',\n admin: {\n readOnly: true\n }\n },\n {\n ...fieldsConfig.image,\n type: 'text',\n admin: {\n readOnly: true\n }\n },\n {\n ...fieldsConfig.roles,\n type: 'array',\n admin: {\n readOnly: true\n },\n fields: [\n {\n ...fieldsConfig.roleFields.name,\n type: 'text'\n }\n ]\n }\n ]\n } : {}\n }\n }),\n i18n: {\n ...incomingConfig.i18n,\n translations: {\n ...incomingConfig.i18n?.translations,\n de: {\n ...incomingConfig.i18n?.translations?.de,\n ...translations.de\n },\n en: {\n ...incomingConfig.i18n?.translations?.en,\n ...translations.en\n }\n }\n }\n })\n\n}"],"names":["cookies","AvatarComponent","LoginButtonComponent","COOKIES","DEFAULT_CONFIG","ERRORS","ROUTES","authorize","callback","zitadelStrategy","translations","defaultRedirect","getAuthSlug","requestRedirect","zitadelPlugin","config","issuerURL","process","env","ZITADEL_URL","clientId","ZITADEL_CLIENT_ID","fields","strategyName","api","callbacks","components","ZITADEL_API_CLIENT_ID","keyId","ZITADEL_API_KEY_ID","apiKeyId","key","ZITADEL_API_KEY","apiKey","fieldsConfig","incomingConfig","admin","avatar","Component","clientProps","imageFieldName","image","name","loginButton","afterLogin","serverProps","label","collections","map","collection","authConfig","auth","slug","disableLocalStrategy","strategies","hooks","afterLogout","set","logout","endpoints","path","method","handler","end_session","req","invokedBy","id","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AAE;oBACtB;gBACJ;YACJ;QACJ,CAAA;AAEJ,EAAC"}
|
package/dist/types.d.ts
CHANGED
@@ -77,11 +77,11 @@ type ZitadelComponentsConfig = {
|
|
77
77
|
avatar: ZitadelAvatarConfig;
|
78
78
|
loginButton: ZitadelLoginButtonConfig;
|
79
79
|
};
|
80
|
-
type ZitadelPluginConfig = ZitadelBaseConfig & Partial<ZitadelUserConfig> & Partial<ZitadelStrategyConfig> & Partial<{
|
80
|
+
type ZitadelPluginConfig = Partial<ZitadelBaseConfig> & Partial<ZitadelUserConfig> & Partial<ZitadelStrategyConfig> & Partial<{
|
81
81
|
callbacks: Partial<ZitadelCallbackConfig>;
|
82
82
|
components: Partial<ZitadelComponentsConfig>;
|
83
83
|
}>;
|
84
|
-
export type ZitadelPlugin = (config
|
84
|
+
export type ZitadelPlugin = (config?: ZitadelPluginConfig) => (config: Config) => Config;
|
85
85
|
type ZitadelAuthorizeRequestConfig = {
|
86
86
|
codeChallenge: string;
|
87
87
|
};
|
package/dist/types.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAE,MAAM,EAAE,cAAc,EAAE,cAAc,EAAE,WAAW,EAAC,MAAM,SAAS,CAAA;AAC9F,OAAO,KAAK,EAAC,UAAU,EAAE,kBAAkB,EAAC,MAAM,0BAA0B,CAAA;AAC5E,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAA;AAE9C,MAAM,MAAM,cAAc,GAAG,OAAO,CAAC;IACjC,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,mCAAmC,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;CAC/E,CAAC,C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mBAAmB,CAAA;AAE3C,MAAM,MAAM,qBAAqB,GAAG,CAAC,MAAM,EAAE,oBAAoB,KAAK,QAAQ,CAAA"}
|
package/dist/types.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type {AuthStrategy, Config, PayloadHandler, PayloadRequest, ServerProps} from 'payload'\nimport type {I18nClient, NestedKeysStripped} from '@payloadcms/translations'\nimport {translations} from './translations.js'\n\nexport type ZitadelIdToken = Partial<{\n sub: string\n name: string\n email: string\n picture: string\n 'urn:zitadel:iam:org:project:roles'?: Record<string, Record<string, string>>\n}>\n\ntype ZitadelFieldConfig = {\n hidden?: boolean\n name: string\n label: string | Record<string, string>\n}\n\nexport type ZitadelFieldsConfig = {\n id: ZitadelFieldConfig\n name: ZitadelFieldConfig\n email: ZitadelFieldConfig\n image: ZitadelFieldConfig\n roles: ZitadelFieldConfig & {\n labels: {\n singular: string | Record<string, string>\n plural: string | Record<string, string>\n }\n }\n roleFields: {\n name: ZitadelFieldConfig\n }\n}\n\ntype ZitadelBaseConfig = {\n issuerURL: string\n clientId: string\n}\n\ntype ZitadelUserConfig = {\n fields: ZitadelFieldsConfig\n}\n\nexport type ZitadelCallbackQuery = Partial<{\n code: string | null,\n state: string | null,\n}>\n\ntype ZitadelInvoker = 'authorize' | 'end_session'\n\ntype ZitadelInvokedBy<InvokedBy extends ZitadelInvoker = ZitadelInvoker> = {\n invokedBy: InvokedBy\n}\n\nexport type ZitadelCallbackState = Record<any, any> & ZitadelInvokedBy\n\nexport type ZitadelCallbackConfig = {\n afterLogin: PayloadHandler\n afterLogout: PayloadHandler\n}\n\nexport type ZitadelBaseHandler<ConfigExtension = {}> = (config: ZitadelBaseConfig & ConfigExtension) => PayloadHandler\n\nexport type ZitadelCallbackHandler = ZitadelBaseHandler<ZitadelUserConfig & ZitadelCallbackConfig>\n\ntype ZitadelAPIConfig = {\n clientId: string\n key: string\n keyId: string\n}\n\ntype ZitadelStrategyConfig = {\n strategyName: string\n api: ZitadelAPIConfig | false\n}\n\nexport type ZitadelStrategy = (config: Omit<ZitadelBaseConfig, 'clientId'> & ZitadelUserConfig & ZitadelStrategyConfig) => AuthStrategy\n\ntype ZitadelAvatarConfig = {\n disable: true\n}\n\nexport type ZitadelAvatarProps = {\n imageFieldName: string\n}\n\ntype ZitadelLoginButtonConfig = {\n disable: true\n label: string\n}\n\nexport type ZitadelLoginButtonProps = ServerProps & Omit<ZitadelLoginButtonConfig, 'disable'> & {\n i18n: I18nClient<typeof translations.en, NestedKeysStripped<typeof translations.en>>\n}\n\ntype ZitadelComponentsConfig = {\n avatar: ZitadelAvatarConfig\n loginButton: ZitadelLoginButtonConfig\n}\n\ntype ZitadelPluginConfig =\n ZitadelBaseConfig
|
1
|
+
{"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type {AuthStrategy, Config, PayloadHandler, PayloadRequest, ServerProps} from 'payload'\nimport type {I18nClient, NestedKeysStripped} from '@payloadcms/translations'\nimport {translations} from './translations.js'\n\nexport type ZitadelIdToken = Partial<{\n sub: string\n name: string\n email: string\n picture: string\n 'urn:zitadel:iam:org:project:roles'?: Record<string, Record<string, string>>\n}>\n\ntype ZitadelFieldConfig = {\n hidden?: boolean\n name: string\n label: string | Record<string, string>\n}\n\nexport type ZitadelFieldsConfig = {\n id: ZitadelFieldConfig\n name: ZitadelFieldConfig\n email: ZitadelFieldConfig\n image: ZitadelFieldConfig\n roles: ZitadelFieldConfig & {\n labels: {\n singular: string | Record<string, string>\n plural: string | Record<string, string>\n }\n }\n roleFields: {\n name: ZitadelFieldConfig\n }\n}\n\ntype ZitadelBaseConfig = {\n issuerURL: string\n clientId: string\n}\n\ntype ZitadelUserConfig = {\n fields: ZitadelFieldsConfig\n}\n\nexport type ZitadelCallbackQuery = Partial<{\n code: string | null,\n state: string | null,\n}>\n\ntype ZitadelInvoker = 'authorize' | 'end_session'\n\ntype ZitadelInvokedBy<InvokedBy extends ZitadelInvoker = ZitadelInvoker> = {\n invokedBy: InvokedBy\n}\n\nexport type ZitadelCallbackState = Record<any, any> & ZitadelInvokedBy\n\nexport type ZitadelCallbackConfig = {\n afterLogin: PayloadHandler\n afterLogout: PayloadHandler\n}\n\nexport type ZitadelBaseHandler<ConfigExtension = {}> = (config: ZitadelBaseConfig & ConfigExtension) => PayloadHandler\n\nexport type ZitadelCallbackHandler = ZitadelBaseHandler<ZitadelUserConfig & ZitadelCallbackConfig>\n\ntype ZitadelAPIConfig = {\n clientId: string\n key: string\n keyId: string\n}\n\ntype ZitadelStrategyConfig = {\n strategyName: string\n api: ZitadelAPIConfig | false\n}\n\nexport type ZitadelStrategy = (config: Omit<ZitadelBaseConfig, 'clientId'> & ZitadelUserConfig & ZitadelStrategyConfig) => AuthStrategy\n\ntype ZitadelAvatarConfig = {\n disable: true\n}\n\nexport type ZitadelAvatarProps = {\n imageFieldName: string\n}\n\ntype ZitadelLoginButtonConfig = {\n disable: true\n label: string\n}\n\nexport type ZitadelLoginButtonProps = ServerProps & Omit<ZitadelLoginButtonConfig, 'disable'> & {\n i18n: I18nClient<typeof translations.en, NestedKeysStripped<typeof translations.en>>\n}\n\ntype ZitadelComponentsConfig = {\n avatar: ZitadelAvatarConfig\n loginButton: ZitadelLoginButtonConfig\n}\n\ntype ZitadelPluginConfig =\n Partial<ZitadelBaseConfig>\n & Partial<ZitadelUserConfig>\n & Partial<ZitadelStrategyConfig>\n & Partial<{\n callbacks: Partial<ZitadelCallbackConfig>\n components: Partial<ZitadelComponentsConfig>\n}>\n\nexport type ZitadelPlugin = (config?: ZitadelPluginConfig) => (config: Config) => Config\n\ntype ZitadelAuthorizeRequestConfig = {\n codeChallenge: string\n}\n\n\ntype ZitadelRequestState =\n (ZitadelInvokedBy<'authorize'> & ZitadelAuthorizeRequestConfig)\n | (ZitadelInvokedBy<'end_session'> & Partial<ZitadelAuthorizeRequestConfig>)\n\ntype ZitadelRequestConfig = {\n req: PayloadRequest\n} & ZitadelBaseConfig & ZitadelRequestState\n\nexport type ZitadelRequestHandler = (config: ZitadelRequestConfig) => Response\n\n\n"],"names":[],"mappings":"AA4HA,WAA8E"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "payload-zitadel-plugin",
|
3
|
-
"version": "0.4.
|
3
|
+
"version": "0.4.3",
|
4
4
|
"description": "plugin for Payload CMS, which enables authentication via Zitadel IdP",
|
5
5
|
"type": "module",
|
6
6
|
"license": "MIT",
|
@@ -36,19 +36,19 @@
|
|
36
36
|
"dist"
|
37
37
|
],
|
38
38
|
"dependencies": {
|
39
|
-
"@payloadcms/next": "^3.
|
40
|
-
"@payloadcms/translations": "^3.
|
41
|
-
"@payloadcms/ui": "^3.
|
39
|
+
"@payloadcms/next": "^3.13.0",
|
40
|
+
"@payloadcms/translations": "^3.13.0",
|
41
|
+
"@payloadcms/ui": "^3.13.0",
|
42
42
|
"jose": "^5.9.6",
|
43
43
|
"next": "^15.1.3",
|
44
|
-
"payload": "^3.
|
44
|
+
"payload": "^3.13.0",
|
45
45
|
"react": "^19.0.0",
|
46
46
|
"react-dom": "^19.0.0"
|
47
47
|
},
|
48
48
|
"devDependencies": {
|
49
49
|
"@swc/cli": "^0.5.2",
|
50
50
|
"@swc/core": "^1.10.4",
|
51
|
-
"@types/node": "^22.10.
|
51
|
+
"@types/node": "^22.10.3",
|
52
52
|
"@types/react": "^19.0.2",
|
53
53
|
"@types/react-dom": "^19.0.2",
|
54
54
|
"rimraf": "^6.0.1",
|