payload-zitadel-plugin 0.2.29 → 0.2.30

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.29
15
+ pnpm add payload-zitadel-plugin@0.2.30
16
16
  ```
17
17
 
18
18
  ## Configuration
@@ -39,6 +39,16 @@ export default buildConfig({
39
39
  // interpolation text for the Login Button - "sign in with ..."
40
40
  label: 'Zitadel',
41
41
 
42
+ // change field names, field labels and alse hide them if wanted
43
+ /*
44
+ fieldConfig: {
45
+ image: {
46
+ name: 'idp_image',
47
+ label: 'some custom label'
48
+ }
49
+ }
50
+ */
51
+
42
52
  // set the name of the CustomStrategy in PayloadCMS - usually not necessary
43
53
  // strategyName: 'zitadel'
44
54
 
@@ -48,9 +58,6 @@ export default buildConfig({
48
58
  // set to true if you want to use your own custom login button
49
59
  // disableDefaultLoginButton: true
50
60
 
51
- // if you want to specify the field name for the Zitadel User Id in the users collection
52
- // associatedIdFieldName: 'idp_id'
53
-
54
61
  // if you want to manually control what happen after a successful login
55
62
  // state contains all URLSearchParams that were send to /authorize
56
63
  // onSuccess: (state) => NextResponse.redirect([serverURL, state.get('redirect')].join(''))
@@ -73,8 +80,6 @@ Optionally you could use an `.env.local` file for parameters:
73
80
  #### .env.local
74
81
 
75
82
  ```dotenv
76
- NEXTAUTH_URL=http://localhost
77
- NEXTAUTH_SECRET=pMvElMzVrLvGL4tHyqtDlVP/90wQdxGBy94ISifi62I=
78
83
  ZITADEL_URL=https://idp.zitadel.url
79
84
  ZITADEL_CLIENT_ID=123456789012345678@project_name
80
85
  ZITADEL_API_CLIENT_ID=123456789123456789@project_name
@@ -92,8 +97,6 @@ import {withPayload} from '@payloadcms/next/withPayload'
92
97
  /** @type {import('next').NextConfig} */
93
98
  const nextConfig = {
94
99
  env: {
95
- NEXTAUTH_URL: 'http://localhost',
96
- NEXTAUTH_SECRET: 'mQ46qpFwfE1BHuqMC+qlm19qBAD9fVPgh28werwe3ASFlAfnKjM=',
97
100
  ZITADEL_URL: 'https://idp.zitadel.url',
98
101
  ZITADEL_CLIENT_ID: '123456789012345678@project_name',
99
102
  ZITADEL_API_CLIENT_ID: '123456789123456789@project_name',
@@ -132,25 +135,13 @@ const nextConfig = {
132
135
  }
133
136
  ]
134
137
  },
135
-
138
+
136
139
  // optional: enable auto-redirect to Zitadel login page if not logged in
137
140
  async redirects() {
138
141
  return [
139
142
  {
140
- source: '/admin/:path',
141
- destination: `/api/users/authorize?${new URLSearchParams({redirect: '/admin/:path'})}`,
142
- missing: [
143
- {
144
- type: 'cookie',
145
- key: 'zitadel_id_token'
146
- }
147
- ],
148
- permanent: false
149
- },
150
- // also works with any route outside of PayloadCMS
151
- {
152
- source: '/profile/:path',
153
- destination: `/api/users/authorize?${new URLSearchParams({redirect: '/profile/:path'})}`,
143
+ source: '/:path((?:admin|profile).*)',
144
+ destination: '/api/users/authorize?redirect=/:path*',
154
145
  missing: [
155
146
  {
156
147
  type: 'cookie',
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/constants.ts"],"sourcesContent":["import {ZitadelStrategyProps} from './types.js'\n\nexport const COOKIES = {\n pkce: 'zitadel_pkce_code_verifier',\n idToken: 'zitadel_id_token',\n state: 'zitadel_state'\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 ZitadelStrategyProps['fieldsConfig'],\n strategyName: 'zitadel',\n label: 'Zitadel'\n}\n\nexport const ERROR_MESSAGES = {\n issuerURL: 'ZITADEL-PLUGIN: ISSUER-URL IS EMPTY',\n clientId: 'ZITADEL-PLUGIN: CLIENT-ID IS EMPTY',\n apiClientId: 'ZITADEL-PLUGIN: API ENABLED, BUT API-CLIENT-ID IS EMPTY',\n apiKeyId: 'ZITADEL-PLUGIN: API ENABLED, BUT API-KEY-ID IS EMPTY',\n apiKey: 'ZITADEL-PLUGIN: API ENABLED, BUT API-KEY IS EMPTY'\n}\nexport const ROUTES = {\n authorize: '/authorize',\n callback: '/callback',\n redirect: '/redirect'\n}\n\n"],"names":["COOKIES","pkce","idToken","state","DEFAULT_CONFIG","fields","id","name","label","de","en","email","image","roles","labels","singular","plural","roleFields","strategyName","ERROR_MESSAGES","issuerURL","clientId","apiClientId","apiKeyId","apiKey","ROUTES","authorize","callback","redirect"],"mappings":"AAEA,OAAO,MAAMA,UAAU;IACnBC,MAAM;IACNC,SAAS;IACTC,OAAO;AACX,EAAC;AAED,OAAO,MAAMC,iBAAiB;IAC1BC,QAAQ;QACJC,IAAI;YACAC,MAAM;YACNC,OAAO;gBACHC,IAAI;gBACJC,IAAI;YACR;QACJ;QACAH,MAAM;YACFA,MAAM;YACNC,OAAO;gBAACC,IAAI;gBAAQC,IAAI;YAAM;QAClC;QACAC,OAAO;YACHJ,MAAM;YACNC,OAAO;gBAACC,IAAI;gBAAUC,IAAI;YAAO;QACrC;QACAE,OAAO;YACHL,MAAM;YACNC,OAAO;gBAACC,IAAI;gBAAkBC,IAAI;YAAqB;QAC3D;QACAG,OAAO;YACHN,MAAM;YACNC,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;YACRV,MAAM;gBACFA,MAAM;gBACNC,OAAO;oBAACC,IAAI;oBAAQC,IAAI;gBAAM;YAClC;QACJ;IACJ;IACAQ,cAAc;IACdV,OAAO;AACX,EAAC;AAED,OAAO,MAAMW,iBAAiB;IAC1BC,WAAW;IACXC,UAAU;IACVC,aAAa;IACbC,UAAU;IACVC,QAAQ;AACZ,EAAC;AACD,OAAO,MAAMC,SAAS;IAClBC,WAAW;IACXC,UAAU;IACVC,UAAU;AACd,EAAC"}
1
+ {"version":3,"sources":["../src/constants.ts"],"sourcesContent":["import {ZitadelFieldsConfig} from './types.js'\n\nexport const COOKIES = {\n pkce: 'zitadel_pkce_code_verifier',\n idToken: 'zitadel_id_token',\n state: 'zitadel_state'\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 ERROR_MESSAGES = {\n issuerURL: 'ZITADEL-PLUGIN: ISSUER-URL IS EMPTY',\n clientId: 'ZITADEL-PLUGIN: CLIENT-ID IS EMPTY',\n apiClientId: 'ZITADEL-PLUGIN: API ENABLED, BUT API-CLIENT-ID IS EMPTY',\n apiKeyId: 'ZITADEL-PLUGIN: API ENABLED, BUT API-KEY-ID IS EMPTY',\n apiKey: 'ZITADEL-PLUGIN: API ENABLED, BUT API-KEY IS EMPTY'\n}\nexport const ROUTES = {\n authorize: '/authorize',\n callback: '/callback',\n redirect: '/redirect'\n}\n\n"],"names":["COOKIES","pkce","idToken","state","DEFAULT_CONFIG","fields","id","name","label","de","en","email","image","roles","labels","singular","plural","roleFields","strategyName","ERROR_MESSAGES","issuerURL","clientId","apiClientId","apiKeyId","apiKey","ROUTES","authorize","callback","redirect"],"mappings":"AAEA,OAAO,MAAMA,UAAU;IACnBC,MAAM;IACNC,SAAS;IACTC,OAAO;AACX,EAAC;AAED,OAAO,MAAMC,iBAAiB;IAC1BC,QAAQ;QACJC,IAAI;YACAC,MAAM;YACNC,OAAO;gBACHC,IAAI;gBACJC,IAAI;YACR;QACJ;QACAH,MAAM;YACFA,MAAM;YACNC,OAAO;gBAACC,IAAI;gBAAQC,IAAI;YAAM;QAClC;QACAC,OAAO;YACHJ,MAAM;YACNC,OAAO;gBAACC,IAAI;gBAAUC,IAAI;YAAO;QACrC;QACAE,OAAO;YACHL,MAAM;YACNC,OAAO;gBAACC,IAAI;gBAAkBC,IAAI;YAAqB;QAC3D;QACAG,OAAO;YACHN,MAAM;YACNC,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;YACRV,MAAM;gBACFA,MAAM;gBACNC,OAAO;oBAACC,IAAI;oBAAQC,IAAI;gBAAM;YAClC;QACJ;IACJ;IACAQ,cAAc;IACdV,OAAO;AACX,EAAC;AAED,OAAO,MAAMW,iBAAiB;IAC1BC,WAAW;IACXC,UAAU;IACVC,aAAa;IACbC,UAAU;IACVC,QAAQ;AACZ,EAAC;AACD,OAAO,MAAMC,SAAS;IAClBC,WAAW;IACXC,UAAU;IACVC,UAAU;AACd,EAAC"}
package/dist/types.d.ts CHANGED
@@ -23,14 +23,13 @@ export type ZitadelFieldsConfig = {
23
23
  };
24
24
  };
25
25
  export type ZitadelPluginProps = Partial<{
26
+ fieldsConfig: Partial<ZitadelFieldsConfig>;
26
27
  disableAvatar: true;
27
28
  disableDefaultLoginButton: true;
28
29
  defaultLoginButtonTitle: string;
29
30
  label: string;
30
31
  onSuccess: ZitadelOnSuccess;
31
- }> & Partial<ZitadelStrategyProps> & {
32
- fieldsConfig: Partial<ZitadelFieldsConfig>;
33
- };
32
+ }> & Partial<ZitadelStrategyProps>;
34
33
  export type ZitadelPluginType = (props: ZitadelPluginProps) => (config: Config) => Config;
35
34
  export type ZitadelAPIProps = {
36
35
  enableAPI: true;
@@ -39,7 +38,6 @@ export type ZitadelAPIProps = {
39
38
  apiKey: string;
40
39
  };
41
40
  export type ZitadelStrategyProps = {
42
- fieldsConfig: ZitadelFieldsConfig;
43
41
  strategyName: string;
44
42
  issuerURL: string;
45
43
  clientId: string;
@@ -47,7 +45,9 @@ export type ZitadelStrategyProps = {
47
45
  } & (ZitadelAPIProps | {
48
46
  enableAPI?: undefined;
49
47
  } & Partial<ZitadelAPIProps>);
50
- export type ZitadelStrategyType = (props: ZitadelStrategyProps) => AuthStrategy;
48
+ export type ZitadelStrategyType = (props: ZitadelStrategyProps & {
49
+ fieldsConfig: ZitadelFieldsConfig;
50
+ }) => AuthStrategy;
51
51
  export type ZitadelIdToken = Partial<{
52
52
  sub: string;
53
53
  name: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAE,MAAM,EAAE,eAAe,EAAE,WAAW,EAAE,SAAS,EAAC,MAAM,SAAS,CAAA;AACrF,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAA;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AAC,CAAA;CAC/E,CAAC,CAAA;AAEF,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,OAAO,CAAC;IAC1C,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB,CAAC,CAAA;AAEF,MAAM,MAAM,uBAAuB,GAAG,WAAW,GAAG;IAChD,IAAI,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,EAAE,EAAE,kBAAkB,CAAC,OAAO,YAAY,CAAC,EAAE,CAAC,CAAC,CAAC;IACrF,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG,CAAC,KAAK,EAAE,eAAe,KAAK,YAAY,CAAA;AAEvE,MAAM,MAAM,wBAAwB,GAAG,CAAC,MAAM,GAAG,eAAe,CAAC,GAAG;IAChE,KAAK,EAAE;QACH,MAAM,EAAE;YACJ,OAAO,EAAE;gBACL,SAAS,EAAE,MAAM,CAAA;gBACjB,QAAQ,EAAE,MAAM,CAAA;gBAChB,WAAW,EAAE,MAAM,CAAA;aACtB,CAAA;SACJ,CAAA;KACJ,CAAA;CACJ,CAAA"}
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/types.ts"],"sourcesContent":["import {AuthStrategy, Config, SanitizedConfig, ServerProps, TypedUser} from 'payload'\nimport {NextResponse} from 'next/server.js'\nimport {translations} from './translations.js'\nimport {I18nClient, NestedKeysStripped} from '@payloadcms/translations'\n\nexport type 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\nexport type ZitadelPluginProps = Partial<{\n disableAvatar: true\n disableDefaultLoginButton: true\n defaultLoginButtonTitle: string\n label: string\n onSuccess: ZitadelOnSuccess\n}> & Partial<ZitadelStrategyProps> & {\n fieldsConfig: Partial<ZitadelFieldsConfig>,\n}\n\nexport type ZitadelPluginType = (props: ZitadelPluginProps) => (config: Config) => Config\n\nexport type ZitadelAPIProps = {\n enableAPI: true\n apiClientId: string,\n apiKeyId: string,\n apiKey: string\n}\n\nexport type ZitadelStrategyProps = {\n fieldsConfig: ZitadelFieldsConfig,\n strategyName: string,\n issuerURL: string,\n clientId: string\n authSlug: string\n} & (ZitadelAPIProps | {\n enableAPI?: undefined\n} & Partial<ZitadelAPIProps>)\n\nexport type ZitadelStrategyType = (props: ZitadelStrategyProps) => AuthStrategy\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\nexport type ZitadelUser = TypedUser & Partial<{\n email: string | null,\n name: string | null,\n image: string | null,\n}>\n\nexport type ZitadelLoginButtonProps = ServerProps & {\n i18n: I18nClient<typeof translations.en, NestedKeysStripped<typeof translations.en>>,\n authorizeURL: string,\n label: string\n}\n\nexport type ZitadelOnSuccess = (state: URLSearchParams) => NextResponse\n\nexport type PayloadConfigWithZitadel = (Config | SanitizedConfig) & {\n admin: {\n custom: {\n zitadel: {\n issuerURL: string\n clientId: string\n callbackURL: string\n }\n }\n }\n}"],"names":[],"mappings":"AAgFA,WAUC"}
1
+ {"version":3,"sources":["../src/types.ts"],"sourcesContent":["import {AuthStrategy, Config, SanitizedConfig, ServerProps, TypedUser} from 'payload'\nimport {NextResponse} from 'next/server.js'\nimport {translations} from './translations.js'\nimport {I18nClient, NestedKeysStripped} from '@payloadcms/translations'\n\nexport type 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\nexport type ZitadelPluginProps = Partial<{\n fieldsConfig: Partial<ZitadelFieldsConfig>,\n disableAvatar: true\n disableDefaultLoginButton: true\n defaultLoginButtonTitle: string\n label: string\n onSuccess: ZitadelOnSuccess\n}> & Partial<ZitadelStrategyProps>\n\nexport type ZitadelPluginType = (props: ZitadelPluginProps) => (config: Config) => Config\n\nexport type ZitadelAPIProps = {\n enableAPI: true\n apiClientId: string,\n apiKeyId: string,\n apiKey: string\n}\n\nexport type ZitadelStrategyProps = {\n strategyName: string,\n issuerURL: string,\n clientId: string\n authSlug: string\n} & (ZitadelAPIProps | {\n enableAPI?: undefined\n} & Partial<ZitadelAPIProps>)\n\nexport type ZitadelStrategyType = (props: ZitadelStrategyProps & {\n fieldsConfig: ZitadelFieldsConfig\n}) => AuthStrategy\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\nexport type ZitadelUser = TypedUser & Partial<{\n email: string | null,\n name: string | null,\n image: string | null,\n}>\n\nexport type ZitadelLoginButtonProps = ServerProps & {\n i18n: I18nClient<typeof translations.en, NestedKeysStripped<typeof translations.en>>,\n authorizeURL: string,\n label: string\n}\n\nexport type ZitadelOnSuccess = (state: URLSearchParams) => NextResponse\n\nexport type PayloadConfigWithZitadel = (Config | SanitizedConfig) & {\n admin: {\n custom: {\n zitadel: {\n issuerURL: string\n clientId: string\n callbackURL: string\n }\n }\n }\n}"],"names":[],"mappings":"AAgFA,WAUC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payload-zitadel-plugin",
3
- "version": "0.2.29",
3
+ "version": "0.2.30",
4
4
  "description": "plugin for Payload CMS, which enables authentication via Zitadel IdP",
5
5
  "type": "module",
6
6
  "license": "MIT",