payload-zitadel-plugin 0.1.5 → 0.1.6
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 +1 -1
- package/dist/options.d.ts.map +1 -1
- package/dist/options.js +13 -9
- package/dist/options.js.map +1 -1
- package/dist/types.d.ts +12 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
package/dist/options.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,sBAAsB,EAAC,MAAM,YAAY,CAAA;AAEjD,eAAO,MAAM,WAAW,EAAE,
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,sBAAsB,EAAC,MAAM,YAAY,CAAA;AAEjD,eAAO,MAAM,WAAW,EAAE,sBA8CxB,CAAA"}
|
package/dist/options.js
CHANGED
@@ -22,25 +22,29 @@ export const authOptions = ({ internalProviderName, issuerUrl, clientId })=>({
|
|
22
22
|
profile: async (profile)=>({
|
23
23
|
id: profile.sub,
|
24
24
|
name: profile.name,
|
25
|
-
firstName: profile.given_name,
|
26
|
-
lastName: profile.family_name,
|
27
25
|
email: profile.email,
|
28
26
|
loginName: profile.preferred_username,
|
29
|
-
image: profile.picture
|
27
|
+
image: profile.picture,
|
28
|
+
firstName: profile.given_name,
|
29
|
+
lastName: profile.family_name,
|
30
|
+
gender: profile.gender,
|
31
|
+
locale: profile.locale,
|
32
|
+
roles: profile['urn:zitadel:iam:org:project:roles']
|
30
33
|
}),
|
31
|
-
userinfo: {
|
32
|
-
async request (context) {
|
33
|
-
return await context.client.userinfo(context.tokens.access_token);
|
34
|
-
}
|
35
|
-
},
|
36
34
|
clientId
|
37
35
|
}
|
38
36
|
],
|
39
37
|
callbacks: {
|
38
|
+
jwt: async ({ user, token })=>({
|
39
|
+
...token,
|
40
|
+
...user ? {
|
41
|
+
user
|
42
|
+
} : {}
|
43
|
+
}),
|
40
44
|
session: async ({ session, token })=>({
|
41
45
|
...session,
|
42
46
|
user: {
|
43
|
-
|
47
|
+
...token.user,
|
44
48
|
...session.user
|
45
49
|
}
|
46
50
|
})
|
package/dist/options.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/options.ts"],"sourcesContent":["import {ZitadelAuthOptionsType} from './types.js'\n\nexport const authOptions: ZitadelAuthOptionsType = ({internalProviderName, issuerUrl, clientId}) => ({\n providers: [\n {\n id: internalProviderName,\n name: internalProviderName,\n type: 'oauth',\n version: '2',\n wellKnown: issuerUrl,\n authorization: {\n params: {\n scope: 'openid email profile'\n }\n },\n idToken: true,\n checks: ['pkce', 'state'],\n client: {\n token_endpoint_auth_method: 'none'\n },\n profile: async (profile) => ({\n id: profile.sub,\n name: profile.name,\n
|
1
|
+
{"version":3,"sources":["../src/options.ts"],"sourcesContent":["import {ZitadelAuthOptionsType} from './types.js'\n\nexport const authOptions: ZitadelAuthOptionsType = ({internalProviderName, issuerUrl, clientId}) => ({\n providers: [\n {\n id: internalProviderName,\n name: internalProviderName,\n type: 'oauth',\n version: '2',\n wellKnown: issuerUrl,\n authorization: {\n params: {\n scope: 'openid email profile'\n }\n },\n idToken: true,\n checks: ['pkce', 'state'],\n client: {\n token_endpoint_auth_method: 'none'\n },\n profile: async (profile) => ({\n id: profile.sub,\n name: profile.name,\n email: profile.email,\n loginName: profile.preferred_username,\n image: profile.picture,\n firstName: profile.given_name,\n lastName: profile.family_name,\n gender: profile.gender,\n locale: profile.locale,\n roles: profile['urn:zitadel:iam:org:project:roles'],\n }),\n clientId\n }\n ],\n callbacks: {\n jwt: async ({user, token}) => ({\n ...token,\n ...(user ? {user} : {})\n }),\n session: async ({session, token}) => ({\n ...session,\n user: {\n ...token.user,\n ...session.user\n }\n })\n }\n})"],"names":["authOptions","internalProviderName","issuerUrl","clientId","providers","id","name","type","version","wellKnown","authorization","params","scope","idToken","checks","client","token_endpoint_auth_method","profile","sub","email","loginName","preferred_username","image","picture","firstName","given_name","lastName","family_name","gender","locale","roles","callbacks","jwt","user","token","session"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,OAAO,MAAMA,cAAsC,CAAC,EAACC,oBAAoB,EAAEC,SAAS,EAAEC,QAAQ,EAAC,GAAM,CAAA;QACjGC,WAAW;YACP;gBACIC,IAAIJ;gBACJK,MAAML;gBACNM,MAAM;gBACNC,SAAS;gBACTC,WAAWP;gBACXQ,eAAe;oBACXC,QAAQ;wBACJC,OAAO;oBACX;gBACJ;gBACAC,SAAS;gBACTC,QAAQ;oBAAC;oBAAQ;iBAAQ;gBACzBC,QAAQ;oBACJC,4BAA4B;gBAChC;gBACAC,SAAS,OAAOA,UAAa,CAAA;wBACzBZ,IAAIY,QAAQC,GAAG;wBACfZ,MAAMW,QAAQX,IAAI;wBAClBa,OAAOF,QAAQE,KAAK;wBACpBC,WAAWH,QAAQI,kBAAkB;wBACrCC,OAAOL,QAAQM,OAAO;wBACtBC,WAAWP,QAAQQ,UAAU;wBAC7BC,UAAUT,QAAQU,WAAW;wBAC7BC,QAAQX,QAAQW,MAAM;wBACtBC,QAAQZ,QAAQY,MAAM;wBACtBC,OAAOb,OAAO,CAAC,oCAAoC;oBACvD,CAAA;gBACAd;YACJ;SACH;QACD4B,WAAW;YACPC,KAAK,OAAO,EAACC,IAAI,EAAEC,KAAK,EAAC,GAAM,CAAA;oBAC3B,GAAGA,KAAK;oBACR,GAAID,OAAO;wBAACA;oBAAI,IAAI,CAAC,CAAC;gBAC1B,CAAA;YACAE,SAAS,OAAO,EAACA,OAAO,EAAED,KAAK,EAAC,GAAM,CAAA;oBAClC,GAAGC,OAAO;oBACVF,MAAM;wBACF,GAAGC,MAAMD,IAAI;wBACb,GAAGE,QAAQF,IAAI;oBACnB;gBACJ,CAAA;QACJ;IACJ,CAAA,EAAE"}
|
package/dist/types.d.ts
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
import { NextAuthOptions } from 'next-auth';
|
1
|
+
import { Awaitable, NextAuthOptions, Session } from 'next-auth';
|
2
2
|
import { AuthStrategy } from 'payload';
|
3
3
|
import { Config } from 'payload';
|
4
|
+
import { JWT } from 'next-auth/jwt';
|
4
5
|
export type ZitadelPluginProps = {
|
5
6
|
disableAvatar?: true | undefined;
|
6
7
|
disableLocalStrategy?: true | undefined;
|
@@ -17,7 +18,16 @@ export type ZitadelAuthOptionsProps = {
|
|
17
18
|
issuerUrl: string;
|
18
19
|
clientId: string;
|
19
20
|
};
|
20
|
-
export type ZitadelAuthOptionsType = (props: ZitadelAuthOptionsProps) => NextAuthOptions
|
21
|
+
export type ZitadelAuthOptionsType = (props: ZitadelAuthOptionsProps) => NextAuthOptions & {
|
22
|
+
callbacks: {
|
23
|
+
session: (props: {
|
24
|
+
session: Session;
|
25
|
+
token: JWT & {
|
26
|
+
user: any;
|
27
|
+
};
|
28
|
+
}) => Awaitable<Session>;
|
29
|
+
};
|
30
|
+
};
|
21
31
|
export type ZitadelAPIProps = {
|
22
32
|
enableAPI: true;
|
23
33
|
apiClientId: string;
|
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,EAAC,eAAe,EAAC,MAAM,WAAW,CAAA;
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,eAAe,EAAE,OAAO,EAAC,MAAM,WAAW,CAAA;AAC7D,OAAO,EAAC,YAAY,EAAC,MAAM,SAAS,CAAA;AACpC,OAAO,EAAC,MAAM,EAAC,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAC,GAAG,EAAC,MAAM,e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,SAAS,CAAC,EAAE,SAAS,CAAA;CACxB,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC,CAAA;AAE7B,MAAM,MAAM,mBAAmB,GAAG,CAAC,KAAK,EAAE,oBAAoB,KAAK,YAAY,CAAA"}
|
package/dist/types.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/types.ts"],"sourcesContent":["import {NextAuthOptions} from 'next-auth'\nimport {AuthStrategy} from 'payload'\nimport {Config} from 'payload'\n\nexport type ZitadelPluginProps = {\n disableAvatar?: true | undefined\n disableLocalStrategy?: true | undefined\n disableDefaultLoginButton?: true | undefined\n defaultLoginButtonTitle?: string\n externalProviderName?: string\n} & Partial<ZitadelStrategyProps>\n\nexport type ZitadelPluginProviderType = (props: ZitadelPluginProps) => {\n zitadelPlugin: (incomingConfig: Config) => Config,\n nextauthHandler: any\n}\n\nexport type ZitadelAuthOptionsProps = {\n internalProviderName: string,\n issuerUrl: string,\n clientId: string\n}\n\nexport type ZitadelAuthOptionsType = (props: ZitadelAuthOptionsProps) => NextAuthOptions\n\nexport type ZitadelAPIProps = {\n enableAPI: true\n apiClientId: string,\n apiKeyId: string,\n apiKey: string\n}\n\nexport type ZitadelStrategyProps = ZitadelAuthOptionsProps & {\n authSlug: string,\n associatedIdFieldName: string,\n} & (ZitadelAPIProps | {\n enableAPI?: undefined\n} & Partial<ZitadelAPIProps>)\n\nexport type ZitadelStrategyType = (props: ZitadelStrategyProps) => AuthStrategy"],"names":[],"rangeMappings":"","mappings":"
|
1
|
+
{"version":3,"sources":["../src/types.ts"],"sourcesContent":["import {Awaitable, NextAuthOptions, Session} from 'next-auth'\nimport {AuthStrategy} from 'payload'\nimport {Config} from 'payload'\nimport {JWT} from 'next-auth/jwt'\n\nexport type ZitadelPluginProps = {\n disableAvatar?: true | undefined\n disableLocalStrategy?: true | undefined\n disableDefaultLoginButton?: true | undefined\n defaultLoginButtonTitle?: string\n externalProviderName?: string\n} & Partial<ZitadelStrategyProps>\n\nexport type ZitadelPluginProviderType = (props: ZitadelPluginProps) => {\n zitadelPlugin: (incomingConfig: Config) => Config,\n nextauthHandler: any\n}\n\nexport type ZitadelAuthOptionsProps = {\n internalProviderName: string,\n issuerUrl: string,\n clientId: string\n}\n\nexport type ZitadelAuthOptionsType = (props: ZitadelAuthOptionsProps) => NextAuthOptions & {\n callbacks: { session: (props: { session: Session, token: JWT & { user: any } }) => Awaitable<Session> }\n}\n\nexport type ZitadelAPIProps = {\n enableAPI: true\n apiClientId: string,\n apiKeyId: string,\n apiKey: string\n}\n\nexport type ZitadelStrategyProps = ZitadelAuthOptionsProps & {\n authSlug: string,\n associatedIdFieldName: string,\n} & (ZitadelAPIProps | {\n enableAPI?: undefined\n} & Partial<ZitadelAPIProps>)\n\nexport type ZitadelStrategyType = (props: ZitadelStrategyProps) => AuthStrategy"],"names":[],"rangeMappings":"","mappings":"AA0CA,WAA+E"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "payload-zitadel-plugin",
|
3
|
-
"version": "0.1.
|
3
|
+
"version": "0.1.6",
|
4
4
|
"description": "plugin for Payload CMS, which enables authentication via Zitadel IdP",
|
5
5
|
"type": "module",
|
6
6
|
"license": "MIT",
|
@@ -49,11 +49,11 @@
|
|
49
49
|
"@swc/cli": "^0.3.12",
|
50
50
|
"@swc/core": "^1.6.3",
|
51
51
|
"@types/jsonwebtoken": "^9.0.6",
|
52
|
-
"@types/node": "^20.14.
|
52
|
+
"@types/node": "^20.14.7",
|
53
53
|
"@types/react": "^18.3.3",
|
54
54
|
"@types/react-dom": "^18.3.0",
|
55
55
|
"rimraf": "^5.0.7",
|
56
|
-
"typescript": "^5.5.
|
56
|
+
"typescript": "^5.5.2"
|
57
57
|
},
|
58
58
|
"engines": {
|
59
59
|
"node": "^22.3.0"
|