@augmenting-integrations/auth 0.2.2 → 2.0.0

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/dist/index.cjs CHANGED
@@ -36,7 +36,14 @@ module.exports = __toCommonJS(index_exports);
36
36
  var import_next_auth = __toESM(require("next-auth"));
37
37
  var import_credentials = __toESM(require("next-auth/providers/credentials"));
38
38
  var import_cognito = __toESM(require("next-auth/providers/cognito"));
39
- var VALID_ROLES = ["visitor", "sales", "agent", "admin"];
39
+ var VALID_ROLES = [
40
+ "visitor",
41
+ "broker",
42
+ "company_admin",
43
+ "manager",
44
+ "agent",
45
+ "admin"
46
+ ];
40
47
  function roleFromGroups(groups) {
41
48
  if (Array.isArray(groups) && groups.length > 0) {
42
49
  const first = String(groups[0]).toLowerCase();
@@ -76,7 +83,7 @@ function createAuth(opts) {
76
83
  role: {
77
84
  label: "Role",
78
85
  type: "text",
79
- placeholder: "visitor | sales | agent | admin"
86
+ placeholder: "visitor | broker | company_admin | manager | agent | admin"
80
87
  }
81
88
  },
82
89
  authorize: async (credentials) => {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Auth.js v5 (the package is still distributed as `next-auth`, but treat\n// these as Auth.js v5 internally — docs at https://authjs.dev, NOT\n// next-auth.js.org which is v4 and incompatible).\n//\n// Provider strategy:\n// - Production: Cognito OIDC. Group membership from `cognito:groups`\n// drives role.\n// - Dev / preview: Credentials with a role picker, BUT shaped to mirror\n// Cognito's claim payload so consumers (callbacks, gates, audit logs)\n// never branch on environment. Same `sub`, `email`, `cognito:groups`\n// in both modes.\n//\n// IMPORTANT: do not let the dev-mode session diverge from production. If\n// you add a claim in prod, also add it (with a synthetic value) in dev.\n\nimport NextAuth, { type DefaultSession, type NextAuthConfig } from \"next-auth\";\nimport Credentials from \"next-auth/providers/credentials\";\nimport Cognito from \"next-auth/providers/cognito\";\n\nexport type Role = \"visitor\" | \"sales\" | \"agent\" | \"admin\";\n\nconst VALID_ROLES: Role[] = [\"visitor\", \"sales\", \"agent\", \"admin\"];\n\ndeclare module \"next-auth\" {\n interface Session {\n user: {\n role: Role;\n } & DefaultSession[\"user\"];\n }\n interface User {\n role: Role;\n }\n}\n\nexport type CreateAuthOptions = {\n /**\n * Path prefixes that require an authenticated session.\n * Empty array = no gating (rare).\n */\n authedRoutePrefixes: string[];\n /**\n * Page to redirect to when an unauthed user hits a gated route. Can be a\n * relative path (`\"/login\"`) for in-app login, or a fully-qualified URL\n * (`\"https://compass.aillc.link/login\"`) to delegate login to a peer app\n * on a sibling subdomain. Default: `/login`.\n */\n signInPage?: string;\n /**\n * Cookie domain for the session token. Set this to the parent domain\n * (e.g. `.compass.aillc.link`) when running across multiple subdomains\n * so the session JWT is readable by every app sharing that parent.\n * Default: read from `process.env.AUTH_COOKIE_DOMAIN`; if unset, Auth.js\n * defaults to host-only (current request hostname).\n *\n * In dev (NODE_ENV !== \"production\"), this is ignored — cookies stay\n * scoped to localhost so per-port apps don't collide.\n */\n cookieDomain?: string;\n /**\n * Override prod/dev detection. Default reads NODE_ENV.\n */\n isProd?: boolean;\n};\n\nfunction roleFromGroups(groups: unknown): Role {\n if (Array.isArray(groups) && groups.length > 0) {\n const first = String(groups[0]).toLowerCase();\n if ((VALID_ROLES as string[]).includes(first)) return first as Role;\n }\n return \"visitor\";\n}\n\n/**\n * Build an Auth.js v5 NextAuth() invocation. Each consuming app calls this\n * once at module scope and re-exports the returned `handlers`, `auth`,\n * `signIn`, `signOut`.\n *\n * Cognito creds are read from process.env (typically set from SSM at deploy):\n * AUTH_COGNITO_ID, AUTH_COGNITO_SECRET, AUTH_COGNITO_ISSUER, AUTH_SECRET\n */\nexport function createAuth(opts: CreateAuthOptions) {\n const isProd = opts.isProd ?? process.env.NODE_ENV === \"production\";\n const signInPage = opts.signInPage ?? \"/login\";\n // Cookie domain is only honored in production. In dev, leaving it unset\n // keeps the cookie scoped to localhost so apps on different ports don't\n // stomp on each other.\n const cookieDomain = isProd\n ? (opts.cookieDomain ?? process.env.AUTH_COOKIE_DOMAIN)\n : undefined;\n\n const SECRET =\n process.env.AUTH_SECRET ?? (isProd ? undefined : \"dev-only-fallback-not-for-prod\");\n\n const config: NextAuthConfig = {\n secret: SECRET,\n cookies: cookieDomain\n ? {\n sessionToken: {\n name: \"authjs.session-token\",\n options: {\n domain: cookieDomain,\n sameSite: \"lax\",\n secure: true,\n httpOnly: true,\n path: \"/\",\n },\n },\n }\n : undefined,\n providers: isProd\n ? [\n Cognito({\n clientId: process.env.AUTH_COGNITO_ID,\n clientSecret: process.env.AUTH_COGNITO_SECRET,\n issuer: process.env.AUTH_COGNITO_ISSUER,\n }),\n ]\n : [\n Credentials({\n name: \"Mock role (dev only)\",\n credentials: {\n role: {\n label: \"Role\",\n type: \"text\",\n placeholder: \"visitor | sales | agent | admin\",\n },\n },\n authorize: async (credentials) => {\n const role = credentials?.role as Role | undefined;\n if (!role || !VALID_ROLES.includes(role)) return null;\n const display = role.charAt(0).toUpperCase() + role.slice(1);\n return {\n id: `mock-${role}`,\n name: `${display} (mock)`,\n email: `${role}@example.local`,\n role,\n };\n },\n }),\n ],\n session: { strategy: \"jwt\" },\n callbacks: {\n jwt: ({ token, user, profile }) => {\n if (user) {\n token.sub ??= user.id ?? undefined;\n token.email ??= user.email ?? undefined;\n if (!isProd && (user as { role?: Role }).role) {\n (token as Record<string, unknown>)[\"cognito:groups\"] = [\n (user as { role: Role }).role,\n ];\n }\n }\n if (isProd && profile) {\n const groups = (profile as Record<string, unknown>)[\"cognito:groups\"];\n if (groups) {\n (token as Record<string, unknown>)[\"cognito:groups\"] = groups;\n }\n }\n return token;\n },\n session: ({ session, token }) => {\n session.user.role = roleFromGroups(\n (token as Record<string, unknown>)[\"cognito:groups\"],\n );\n return session;\n },\n authorized: ({ auth: session, request: { nextUrl } }) => {\n const path = nextUrl.pathname;\n const isAuthedRoute = opts.authedRoutePrefixes.some(\n (prefix) => path === prefix || path.startsWith(`${prefix}/`),\n );\n if (!session && isAuthedRoute) return false;\n return true;\n },\n },\n pages: { signIn: signInPage },\n trustHost: true,\n };\n\n return NextAuth(config);\n}\n\n/**\n * Convenience: build the proxy default-export for `src/proxy.ts`. In Next 16\n * the proxy must be a default export and must live at `src/proxy.ts` — the\n * named-export form throws \"TypeError: adapterFn is not a function\".\n *\n * Usage:\n * // src/proxy.ts\n * import { auth } from \"@/lib/auth\";\n * export default auth;\n * export const config = {\n * matcher: [\"/dashboard\", \"/dashboard/:path*\"],\n * };\n */\nexport type { NextAuthConfig } from \"next-auth\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAeA,uBAAmE;AACnE,yBAAwB;AACxB,qBAAoB;AAIpB,IAAM,cAAsB,CAAC,WAAW,SAAS,SAAS,OAAO;AA2CjE,SAAS,eAAe,QAAuB;AAC7C,MAAI,MAAM,QAAQ,MAAM,KAAK,OAAO,SAAS,GAAG;AAC9C,UAAM,QAAQ,OAAO,OAAO,CAAC,CAAC,EAAE,YAAY;AAC5C,QAAK,YAAyB,SAAS,KAAK,EAAG,QAAO;AAAA,EACxD;AACA,SAAO;AACT;AAUO,SAAS,WAAW,MAAyB;AAClD,QAAM,SAAS,KAAK,UAAU,QAAQ,IAAI,aAAa;AACvD,QAAM,aAAa,KAAK,cAAc;AAItC,QAAM,eAAe,SAChB,KAAK,gBAAgB,QAAQ,IAAI,qBAClC;AAEJ,QAAM,SACJ,QAAQ,IAAI,gBAAgB,SAAS,SAAY;AAEnD,QAAM,SAAyB;AAAA,IAC7B,QAAQ;AAAA,IACR,SAAS,eACL;AAAA,MACE,cAAc;AAAA,QACZ,MAAM;AAAA,QACN,SAAS;AAAA,UACP,QAAQ;AAAA,UACR,UAAU;AAAA,UACV,QAAQ;AAAA,UACR,UAAU;AAAA,UACV,MAAM;AAAA,QACR;AAAA,MACF;AAAA,IACF,IACA;AAAA,IACJ,WAAW,SACP;AAAA,UACE,eAAAA,SAA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AO;AAAA,MACT;AAAA,MACA,YAAY,CAAC,EAAE,MAAM,SAAS,SAAS,EAAE,QAAQ,EAAE,MAAM;AACvD,cAAM,OAAO,QAAQ;AACrB,cAAM,gBAAgB,KAAK,oBAAoB;AAAA,UAC7C,CAAC,WAAW,SAAS,UAAU,KAAK,WAAW,GAAG,MAAM,GAAG;AAAA,QAC7D;AACA,YAAI,CAAC,WAAW,cAAe,QAAO;AACtC,eAAO;AAAA,MACT;AAAA,IACF;AAAA,IACA,OAAO,EAAE,QAAQ,WAAW;AAAA,IAC5B,WAAW;AAAA,EACb;AAEA,aAAO,iBAAAC,SAAS,MAAM;AACxB;","names":["Cognito","Credentials","NextAuth"]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Auth.js v5 (the package is still distributed as `next-auth`, but treat\n// these as Auth.js v5 internally — docs at https://authjs.dev, NOT\n// next-auth.js.org which is v4 and incompatible).\n//\n// Provider strategy:\n// - Production: Cognito OIDC. Group membership from `cognito:groups`\n// drives role.\n// - Dev / preview: Credentials with a role picker, BUT shaped to mirror\n// Cognito's claim payload so consumers (callbacks, gates, audit logs)\n// never branch on environment. Same `sub`, `email`, `cognito:groups`\n// in both modes.\n//\n// IMPORTANT: do not let the dev-mode session diverge from production. If\n// you add a claim in prod, also add it (with a synthetic value) in dev.\n\nimport NextAuth, { type DefaultSession, type NextAuthConfig } from \"next-auth\";\nimport Credentials from \"next-auth/providers/credentials\";\nimport Cognito from \"next-auth/providers/cognito\";\n\n// Compass role taxonomy. Sourced from census-platform-main's profiles.role\n// enum (broker, company_admin) plus the sales-dashboard manager/agent\n// hierarchy. `visitor` is the implicit anonymous default (no Cognito group).\n// Adding a new role here requires adding the matching Cognito group in\n// compass-infra/template.yaml.\nexport type Role = \"visitor\" | \"broker\" | \"company_admin\" | \"manager\" | \"agent\" | \"admin\";\n\nconst VALID_ROLES: Role[] = [\n \"visitor\",\n \"broker\",\n \"company_admin\",\n \"manager\",\n \"agent\",\n \"admin\",\n];\n\ndeclare module \"next-auth\" {\n interface Session {\n user: {\n role: Role;\n } & DefaultSession[\"user\"];\n }\n interface User {\n role: Role;\n }\n}\n\nexport type CreateAuthOptions = {\n /**\n * Path prefixes that require an authenticated session.\n * Empty array = no gating (rare).\n */\n authedRoutePrefixes: string[];\n /**\n * Page to redirect to when an unauthed user hits a gated route. Can be a\n * relative path (`\"/login\"`) for in-app login, or a fully-qualified URL\n * (`\"https://compass.aillc.link/login\"`) to delegate login to a peer app\n * on a sibling subdomain. Default: `/login`.\n */\n signInPage?: string;\n /**\n * Cookie domain for the session token. Set this to the parent domain\n * (e.g. `.compass.aillc.link`) when running across multiple subdomains\n * so the session JWT is readable by every app sharing that parent.\n * Default: read from `process.env.AUTH_COOKIE_DOMAIN`; if unset, Auth.js\n * defaults to host-only (current request hostname).\n *\n * In dev (NODE_ENV !== \"production\"), this is ignored — cookies stay\n * scoped to localhost so per-port apps don't collide.\n */\n cookieDomain?: string;\n /**\n * Override prod/dev detection. Default reads NODE_ENV.\n */\n isProd?: boolean;\n};\n\nfunction roleFromGroups(groups: unknown): Role {\n if (Array.isArray(groups) && groups.length > 0) {\n const first = String(groups[0]).toLowerCase();\n if ((VALID_ROLES as string[]).includes(first)) return first as Role;\n }\n return \"visitor\";\n}\n\n/**\n * Build an Auth.js v5 NextAuth() invocation. Each consuming app calls this\n * once at module scope and re-exports the returned `handlers`, `auth`,\n * `signIn`, `signOut`.\n *\n * Cognito creds are read from process.env (typically set from SSM at deploy):\n * AUTH_COGNITO_ID, AUTH_COGNITO_SECRET, AUTH_COGNITO_ISSUER, AUTH_SECRET\n */\nexport function createAuth(opts: CreateAuthOptions) {\n const isProd = opts.isProd ?? process.env.NODE_ENV === \"production\";\n const signInPage = opts.signInPage ?? \"/login\";\n // Cookie domain is only honored in production. In dev, leaving it unset\n // keeps the cookie scoped to localhost so apps on different ports don't\n // stomp on each other.\n const cookieDomain = isProd\n ? (opts.cookieDomain ?? process.env.AUTH_COOKIE_DOMAIN)\n : undefined;\n\n const SECRET =\n process.env.AUTH_SECRET ?? (isProd ? undefined : \"dev-only-fallback-not-for-prod\");\n\n const config: NextAuthConfig = {\n secret: SECRET,\n cookies: cookieDomain\n ? {\n sessionToken: {\n name: \"authjs.session-token\",\n options: {\n domain: cookieDomain,\n sameSite: \"lax\",\n secure: true,\n httpOnly: true,\n path: \"/\",\n },\n },\n }\n : undefined,\n providers: isProd\n ? [\n Cognito({\n clientId: process.env.AUTH_COGNITO_ID,\n clientSecret: process.env.AUTH_COGNITO_SECRET,\n issuer: process.env.AUTH_COGNITO_ISSUER,\n }),\n ]\n : [\n Credentials({\n name: \"Mock role (dev only)\",\n credentials: {\n role: {\n label: \"Role\",\n type: \"text\",\n placeholder: \"visitor | broker | company_admin | manager | agent | admin\",\n },\n },\n authorize: async (credentials) => {\n const role = credentials?.role as Role | undefined;\n if (!role || !VALID_ROLES.includes(role)) return null;\n const display = role.charAt(0).toUpperCase() + role.slice(1);\n return {\n id: `mock-${role}`,\n name: `${display} (mock)`,\n email: `${role}@example.local`,\n role,\n };\n },\n }),\n ],\n session: { strategy: \"jwt\" },\n callbacks: {\n jwt: ({ token, user, profile }) => {\n if (user) {\n token.sub ??= user.id ?? undefined;\n token.email ??= user.email ?? undefined;\n if (!isProd && (user as { role?: Role }).role) {\n (token as Record<string, unknown>)[\"cognito:groups\"] = [\n (user as { role: Role }).role,\n ];\n }\n }\n if (isProd && profile) {\n const groups = (profile as Record<string, unknown>)[\"cognito:groups\"];\n if (groups) {\n (token as Record<string, unknown>)[\"cognito:groups\"] = groups;\n }\n }\n return token;\n },\n session: ({ session, token }) => {\n session.user.role = roleFromGroups(\n (token as Record<string, unknown>)[\"cognito:groups\"],\n );\n return session;\n },\n authorized: ({ auth: session, request: { nextUrl } }) => {\n const path = nextUrl.pathname;\n const isAuthedRoute = opts.authedRoutePrefixes.some(\n (prefix) => path === prefix || path.startsWith(`${prefix}/`),\n );\n if (!session && isAuthedRoute) return false;\n return true;\n },\n },\n pages: { signIn: signInPage },\n trustHost: true,\n };\n\n return NextAuth(config);\n}\n\n/**\n * Convenience: build the proxy default-export for `src/proxy.ts`. In Next 16\n * the proxy must be a default export and must live at `src/proxy.ts` — the\n * named-export form throws \"TypeError: adapterFn is not a function\".\n *\n * Usage:\n * // src/proxy.ts\n * import { auth } from \"@/lib/auth\";\n * export default auth;\n * export const config = {\n * matcher: [\"/dashboard\", \"/dashboard/:path*\"],\n * };\n */\nexport type { NextAuthConfig } from \"next-auth\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAeA,uBAAmE;AACnE,yBAAwB;AACxB,qBAAoB;AASpB,IAAM,cAAsB;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AA2CA,SAAS,eAAe,QAAuB;AAC7C,MAAI,MAAM,QAAQ,MAAM,KAAK,OAAO,SAAS,GAAG;AAC9C,UAAM,QAAQ,OAAO,OAAO,CAAC,CAAC,EAAE,YAAY;AAC5C,QAAK,YAAyB,SAAS,KAAK,EAAG,QAAO;AAAA,EACxD;AACA,SAAO;AACT;AAUO,SAAS,WAAW,MAAyB;AAClD,QAAM,SAAS,KAAK,UAAU,QAAQ,IAAI,aAAa;AACvD,QAAM,aAAa,KAAK,cAAc;AAItC,QAAM,eAAe,SAChB,KAAK,gBAAgB,QAAQ,IAAI,qBAClC;AAEJ,QAAM,SACJ,QAAQ,IAAI,gBAAgB,SAAS,SAAY;AAEnD,QAAM,SAAyB;AAAA,IAC7B,QAAQ;AAAA,IACR,SAAS,eACL;AAAA,MACE,cAAc;AAAA,QACZ,MAAM;AAAA,QACN,SAAS;AAAA,UACP,QAAQ;AAAA,UACR,UAAU;AAAA,UACV,QAAQ;AAAA,UACR,UAAU;AAAA,UACV,MAAM;AAAA,QACR;AAAA,MACF;AAAA,IACF,IACA;AAAA,IACJ,WAAW,SACP;AAAA,UACE,eAAAA,SAAQ;AAAA,QACN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;AAAA,MACA,YAAY,CAAC,EAAE,MAAM,SAAS,SAAS,EAAE,QAAQ,EAAE,MAAM;AACvD,cAAM,OAAO,QAAQ;AACrB,cAAM,gBAAgB,KAAK,oBAAoB;AAAA,UAC7C,CAAC,WAAW,SAAS,UAAU,KAAK,WAAW,GAAG,MAAM,GAAG;AAAA,QAC7D;AACA,YAAI,CAAC,WAAW,cAAe,QAAO;AACtC,eAAO;AAAA,MACT;AAAA,IACF;AAAA,IACA,OAAO,EAAE,QAAQ,WAAW;AAAA,IAC5B,WAAW;AAAA,EACb;AAEA,aAAO,iBAAAC,SAAS,MAAM;AACxB;","names":["Cognito","Credentials","NextAuth"]}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { type DefaultSession } from "next-auth";
2
- export type Role = "visitor" | "sales" | "agent" | "admin";
2
+ export type Role = "visitor" | "broker" | "company_admin" | "manager" | "agent" | "admin";
3
3
  declare module "next-auth" {
4
4
  interface Session {
5
5
  user: {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAeA,OAAiB,EAAE,KAAK,cAAc,EAAuB,MAAM,WAAW,CAAC;AAI/E,MAAM,MAAM,IAAI,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;AAI3D,OAAO,QAAQ,WAAW,CAAC;IACzB,UAAU,OAAO;QACf,IAAI,EAAE;YACJ,IAAI,EAAE,IAAI,CAAC;SACZ,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;KAC5B;IACD,UAAU,IAAI;QACZ,IAAI,EAAE,IAAI,CAAC;KACZ;CACF;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;;OAGG;IACH,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;;;;;OASG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAUF;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,iBAAiB,sCAoGjD;AAED;;;;;;;;;;;;GAYG;AACH,YAAY,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAeA,OAAiB,EAAE,KAAK,cAAc,EAAuB,MAAM,WAAW,CAAC;AAS/E,MAAM,MAAM,IAAI,GAAG,SAAS,GAAG,QAAQ,GAAG,eAAe,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;AAW1F,OAAO,QAAQ,WAAW,CAAC;IACzB,UAAU,OAAO;QACf,IAAI,EAAE;YACJ,IAAI,EAAE,IAAI,CAAC;SACZ,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;KAC5B;IACD,UAAU,IAAI;QACZ,IAAI,EAAE,IAAI,CAAC;KACZ;CACF;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;;OAGG;IACH,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;;;;;OASG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAUF;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,iBAAiB,sCAoGjD;AAED;;;;;;;;;;;;GAYG;AACH,YAAY,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC"}
package/dist/index.js CHANGED
@@ -2,7 +2,14 @@
2
2
  import NextAuth from "next-auth";
3
3
  import Credentials from "next-auth/providers/credentials";
4
4
  import Cognito from "next-auth/providers/cognito";
5
- var VALID_ROLES = ["visitor", "sales", "agent", "admin"];
5
+ var VALID_ROLES = [
6
+ "visitor",
7
+ "broker",
8
+ "company_admin",
9
+ "manager",
10
+ "agent",
11
+ "admin"
12
+ ];
6
13
  function roleFromGroups(groups) {
7
14
  if (Array.isArray(groups) && groups.length > 0) {
8
15
  const first = String(groups[0]).toLowerCase();
@@ -42,7 +49,7 @@ function createAuth(opts) {
42
49
  role: {
43
50
  label: "Role",
44
51
  type: "text",
45
- placeholder: "visitor | sales | agent | admin"
52
+ placeholder: "visitor | broker | company_admin | manager | agent | admin"
46
53
  }
47
54
  },
48
55
  authorize: async (credentials) => {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Auth.js v5 (the package is still distributed as `next-auth`, but treat\n// these as Auth.js v5 internally — docs at https://authjs.dev, NOT\n// next-auth.js.org which is v4 and incompatible).\n//\n// Provider strategy:\n// - Production: Cognito OIDC. Group membership from `cognito:groups`\n// drives role.\n// - Dev / preview: Credentials with a role picker, BUT shaped to mirror\n// Cognito's claim payload so consumers (callbacks, gates, audit logs)\n// never branch on environment. Same `sub`, `email`, `cognito:groups`\n// in both modes.\n//\n// IMPORTANT: do not let the dev-mode session diverge from production. If\n// you add a claim in prod, also add it (with a synthetic value) in dev.\n\nimport NextAuth, { type DefaultSession, type NextAuthConfig } from \"next-auth\";\nimport Credentials from \"next-auth/providers/credentials\";\nimport Cognito from \"next-auth/providers/cognito\";\n\nexport type Role = \"visitor\" | \"sales\" | \"agent\" | \"admin\";\n\nconst VALID_ROLES: Role[] = [\"visitor\", \"sales\", \"agent\", \"admin\"];\n\ndeclare module \"next-auth\" {\n interface Session {\n user: {\n role: Role;\n } & DefaultSession[\"user\"];\n }\n interface User {\n role: Role;\n }\n}\n\nexport type CreateAuthOptions = {\n /**\n * Path prefixes that require an authenticated session.\n * Empty array = no gating (rare).\n */\n authedRoutePrefixes: string[];\n /**\n * Page to redirect to when an unauthed user hits a gated route. Can be a\n * relative path (`\"/login\"`) for in-app login, or a fully-qualified URL\n * (`\"https://compass.aillc.link/login\"`) to delegate login to a peer app\n * on a sibling subdomain. Default: `/login`.\n */\n signInPage?: string;\n /**\n * Cookie domain for the session token. Set this to the parent domain\n * (e.g. `.compass.aillc.link`) when running across multiple subdomains\n * so the session JWT is readable by every app sharing that parent.\n * Default: read from `process.env.AUTH_COOKIE_DOMAIN`; if unset, Auth.js\n * defaults to host-only (current request hostname).\n *\n * In dev (NODE_ENV !== \"production\"), this is ignored — cookies stay\n * scoped to localhost so per-port apps don't collide.\n */\n cookieDomain?: string;\n /**\n * Override prod/dev detection. Default reads NODE_ENV.\n */\n isProd?: boolean;\n};\n\nfunction roleFromGroups(groups: unknown): Role {\n if (Array.isArray(groups) && groups.length > 0) {\n const first = String(groups[0]).toLowerCase();\n if ((VALID_ROLES as string[]).includes(first)) return first as Role;\n }\n return \"visitor\";\n}\n\n/**\n * Build an Auth.js v5 NextAuth() invocation. Each consuming app calls this\n * once at module scope and re-exports the returned `handlers`, `auth`,\n * `signIn`, `signOut`.\n *\n * Cognito creds are read from process.env (typically set from SSM at deploy):\n * AUTH_COGNITO_ID, AUTH_COGNITO_SECRET, AUTH_COGNITO_ISSUER, AUTH_SECRET\n */\nexport function createAuth(opts: CreateAuthOptions) {\n const isProd = opts.isProd ?? process.env.NODE_ENV === \"production\";\n const signInPage = opts.signInPage ?? \"/login\";\n // Cookie domain is only honored in production. In dev, leaving it unset\n // keeps the cookie scoped to localhost so apps on different ports don't\n // stomp on each other.\n const cookieDomain = isProd\n ? (opts.cookieDomain ?? process.env.AUTH_COOKIE_DOMAIN)\n : undefined;\n\n const SECRET =\n process.env.AUTH_SECRET ?? (isProd ? undefined : \"dev-only-fallback-not-for-prod\");\n\n const config: NextAuthConfig = {\n secret: SECRET,\n cookies: cookieDomain\n ? {\n sessionToken: {\n name: \"authjs.session-token\",\n options: {\n domain: cookieDomain,\n sameSite: \"lax\",\n secure: true,\n httpOnly: true,\n path: \"/\",\n },\n },\n }\n : undefined,\n providers: isProd\n ? [\n Cognito({\n clientId: process.env.AUTH_COGNITO_ID,\n clientSecret: process.env.AUTH_COGNITO_SECRET,\n issuer: process.env.AUTH_COGNITO_ISSUER,\n }),\n ]\n : [\n Credentials({\n name: \"Mock role (dev only)\",\n credentials: {\n role: {\n label: \"Role\",\n type: \"text\",\n placeholder: \"visitor | sales | agent | admin\",\n },\n },\n authorize: async (credentials) => {\n const role = credentials?.role as Role | undefined;\n if (!role || !VALID_ROLES.includes(role)) return null;\n const display = role.charAt(0).toUpperCase() + role.slice(1);\n return {\n id: `mock-${role}`,\n name: `${display} (mock)`,\n email: `${role}@example.local`,\n role,\n };\n },\n }),\n ],\n session: { strategy: \"jwt\" },\n callbacks: {\n jwt: ({ token, user, profile }) => {\n if (user) {\n token.sub ??= user.id ?? undefined;\n token.email ??= user.email ?? undefined;\n if (!isProd && (user as { role?: Role }).role) {\n (token as Record<string, unknown>)[\"cognito:groups\"] = [\n (user as { role: Role }).role,\n ];\n }\n }\n if (isProd && profile) {\n const groups = (profile as Record<string, unknown>)[\"cognito:groups\"];\n if (groups) {\n (token as Record<string, unknown>)[\"cognito:groups\"] = groups;\n }\n }\n return token;\n },\n session: ({ session, token }) => {\n session.user.role = roleFromGroups(\n (token as Record<string, unknown>)[\"cognito:groups\"],\n );\n return session;\n },\n authorized: ({ auth: session, request: { nextUrl } }) => {\n const path = nextUrl.pathname;\n const isAuthedRoute = opts.authedRoutePrefixes.some(\n (prefix) => path === prefix || path.startsWith(`${prefix}/`),\n );\n if (!session && isAuthedRoute) return false;\n return true;\n },\n },\n pages: { signIn: signInPage },\n trustHost: true,\n };\n\n return NextAuth(config);\n}\n\n/**\n * Convenience: build the proxy default-export for `src/proxy.ts`. In Next 16\n * the proxy must be a default export and must live at `src/proxy.ts` — the\n * named-export form throws \"TypeError: adapterFn is not a function\".\n *\n * Usage:\n * // src/proxy.ts\n * import { auth } from \"@/lib/auth\";\n * export default auth;\n * export const config = {\n * matcher: [\"/dashboard\", \"/dashboard/:path*\"],\n * };\n */\nexport type { NextAuthConfig } from \"next-auth\";\n"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../src/index.ts"],"sourcesContent":["// Auth.js v5 (the package is still distributed as `next-auth`, but treat\n// these as Auth.js v5 internally — docs at https://authjs.dev, NOT\n// next-auth.js.org which is v4 and incompatible).\n//\n// Provider strategy:\n// - Production: Cognito OIDC. Group membership from `cognito:groups`\n// drives role.\n// - Dev / preview: Credentials with a role picker, BUT shaped to mirror\n// Cognito's claim payload so consumers (callbacks, gates, audit logs)\n// never branch on environment. Same `sub`, `email`, `cognito:groups`\n// in both modes.\n//\n// IMPORTANT: do not let the dev-mode session diverge from production. If\n// you add a claim in prod, also add it (with a synthetic value) in dev.\n\nimport NextAuth, { type DefaultSession, type NextAuthConfig } from \"next-auth\";\nimport Credentials from \"next-auth/providers/credentials\";\nimport Cognito from \"next-auth/providers/cognito\";\n\n// Compass role taxonomy. Sourced from census-platform-main's profiles.role\n// enum (broker, company_admin) plus the sales-dashboard manager/agent\n// hierarchy. `visitor` is the implicit anonymous default (no Cognito group).\n// Adding a new role here requires adding the matching Cognito group in\n// compass-infra/template.yaml.\nexport type Role = \"visitor\" | \"broker\" | \"company_admin\" | \"manager\" | \"agent\" | \"admin\";\n\nconst VALID_ROLES: Role[] = [\n \"visitor\",\n \"broker\",\n \"company_admin\",\n \"manager\",\n \"agent\",\n \"admin\",\n];\n\ndeclare module \"next-auth\" {\n interface Session {\n user: {\n role: Role;\n } & DefaultSession[\"user\"];\n }\n interface User {\n role: Role;\n }\n}\n\nexport type CreateAuthOptions = {\n /**\n * Path prefixes that require an authenticated session.\n * Empty array = no gating (rare).\n */\n authedRoutePrefixes: string[];\n /**\n * Page to redirect to when an unauthed user hits a gated route. Can be a\n * relative path (`\"/login\"`) for in-app login, or a fully-qualified URL\n * (`\"https://compass.aillc.link/login\"`) to delegate login to a peer app\n * on a sibling subdomain. Default: `/login`.\n */\n signInPage?: string;\n /**\n * Cookie domain for the session token. Set this to the parent domain\n * (e.g. `.compass.aillc.link`) when running across multiple subdomains\n * so the session JWT is readable by every app sharing that parent.\n * Default: read from `process.env.AUTH_COOKIE_DOMAIN`; if unset, Auth.js\n * defaults to host-only (current request hostname).\n *\n * In dev (NODE_ENV !== \"production\"), this is ignored — cookies stay\n * scoped to localhost so per-port apps don't collide.\n */\n cookieDomain?: string;\n /**\n * Override prod/dev detection. Default reads NODE_ENV.\n */\n isProd?: boolean;\n};\n\nfunction roleFromGroups(groups: unknown): Role {\n if (Array.isArray(groups) && groups.length > 0) {\n const first = String(groups[0]).toLowerCase();\n if ((VALID_ROLES as string[]).includes(first)) return first as Role;\n }\n return \"visitor\";\n}\n\n/**\n * Build an Auth.js v5 NextAuth() invocation. Each consuming app calls this\n * once at module scope and re-exports the returned `handlers`, `auth`,\n * `signIn`, `signOut`.\n *\n * Cognito creds are read from process.env (typically set from SSM at deploy):\n * AUTH_COGNITO_ID, AUTH_COGNITO_SECRET, AUTH_COGNITO_ISSUER, AUTH_SECRET\n */\nexport function createAuth(opts: CreateAuthOptions) {\n const isProd = opts.isProd ?? process.env.NODE_ENV === \"production\";\n const signInPage = opts.signInPage ?? \"/login\";\n // Cookie domain is only honored in production. In dev, leaving it unset\n // keeps the cookie scoped to localhost so apps on different ports don't\n // stomp on each other.\n const cookieDomain = isProd\n ? (opts.cookieDomain ?? process.env.AUTH_COOKIE_DOMAIN)\n : undefined;\n\n const SECRET =\n process.env.AUTH_SECRET ?? (isProd ? undefined : \"dev-only-fallback-not-for-prod\");\n\n const config: NextAuthConfig = {\n secret: SECRET,\n cookies: cookieDomain\n ? {\n sessionToken: {\n name: \"authjs.session-token\",\n options: {\n domain: cookieDomain,\n sameSite: \"lax\",\n secure: true,\n httpOnly: true,\n path: \"/\",\n },\n },\n }\n : undefined,\n providers: isProd\n ? [\n Cognito({\n clientId: process.env.AUTH_COGNITO_ID,\n clientSecret: process.env.AUTH_COGNITO_SECRET,\n issuer: process.env.AUTH_COGNITO_ISSUER,\n }),\n ]\n : [\n Credentials({\n name: \"Mock role (dev only)\",\n credentials: {\n role: {\n label: \"Role\",\n type: \"text\",\n placeholder: \"visitor | broker | company_admin | manager | agent | admin\",\n },\n },\n authorize: async (credentials) => {\n const role = credentials?.role as Role | undefined;\n if (!role || !VALID_ROLES.includes(role)) return null;\n const display = role.charAt(0).toUpperCase() + role.slice(1);\n return {\n id: `mock-${role}`,\n name: `${display} (mock)`,\n email: `${role}@example.local`,\n role,\n };\n },\n }),\n ],\n session: { strategy: \"jwt\" },\n callbacks: {\n jwt: ({ token, user, profile }) => {\n if (user) {\n token.sub ??= user.id ?? undefined;\n token.email ??= user.email ?? undefined;\n if (!isProd && (user as { role?: Role }).role) {\n (token as Record<string, unknown>)[\"cognito:groups\"] = [\n (user as { role: Role }).role,\n ];\n }\n }\n if (isProd && profile) {\n const groups = (profile as Record<string, unknown>)[\"cognito:groups\"];\n if (groups) {\n (token as Record<string, unknown>)[\"cognito:groups\"] = groups;\n }\n }\n return token;\n },\n session: ({ session, token }) => {\n session.user.role = roleFromGroups(\n (token as Record<string, unknown>)[\"cognito:groups\"],\n );\n return session;\n },\n authorized: ({ auth: session, request: { nextUrl } }) => {\n const path = nextUrl.pathname;\n const isAuthedRoute = opts.authedRoutePrefixes.some(\n (prefix) => path === prefix || path.startsWith(`${prefix}/`),\n );\n if (!session && isAuthedRoute) return false;\n return true;\n },\n },\n pages: { signIn: signInPage },\n trustHost: true,\n };\n\n return NextAuth(config);\n}\n\n/**\n * Convenience: build the proxy default-export for `src/proxy.ts`. In Next 16\n * the proxy must be a default export and must live at `src/proxy.ts` — the\n * named-export form throws \"TypeError: adapterFn is not a function\".\n *\n * Usage:\n * // src/proxy.ts\n * import { auth } from \"@/lib/auth\";\n * export default auth;\n * export const config = {\n * matcher: [\"/dashboard\", \"/dashboard/:path*\"],\n * };\n */\nexport type { NextAuthConfig } from \"next-auth\";\n"],"mappings":";AAeA,OAAO,cAA4D;AACnE,OAAO,iBAAiB;AACxB,OAAO,aAAa;AASpB,IAAM,cAAsB;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA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AChB,MAAM,GAAG,OAAO;AAAA,YAChB,OAAO,GAAG,IAAI;AAAA,YACd;AAAA,UACF;AAAA,QACF;AAAA,MACF,CAAC;AAAA,IACH;AAAA,IACJ,SAAS,EAAE,UAAU,MAAM;AAAA,IAC3B,WAAW;AAAA,MACT,KAAK,CAAC,EAAE,OAAO,MAAM,QAAQ,MAAM;AACjC,YAAI,MAAM;AACR,gBAAM,QAAQ,KAAK,MAAM;AACzB,gBAAM,UAAU,KAAK,SAAS;AAC9B,cAAI,CAAC,UAAW,KAAyB,MAAM;AAC7C,YAAC,MAAkC,gBAAgB,IAAI;AAAA,cACpD,KAAwB;AAAA,YAC3B;AAAA,UACF;AAAA,QACF;AACA,YAAI,UAAU,SAAS;AACrB,gBAAM,SAAU,QAAoC,gBAAgB;AACpE,cAAI,QAAQ;AACV,YAAC,MAAkC,gBAAgB,IAAI;AAAA,UACzD;AAAA,QACF;AACA,eAAO;AAAA,MACT;AAAA,MACA,SAAS,CAAC,EAAE,SAAS,MAAM,MAAM;AAC/B,gBAAQ,KAAK,OAAO;AAAA,UACjB,MAAkC,gBAAgB;AAAA,QACrD;AACA,eAAO;AAAA,MACT;AAAA,MACA,YAAY,CAAC,EAAE,MAAM,SAAS,SAAS,EAAE,QAAQ,EAAE,MAAM;AACvD,cAAM,OAAO,QAAQ;AACrB,cAAM,gBAAgB,KAAK,oBAAoB;AAAA,UAC7C,CAAC,WAAW,SAAS,UAAU,KAAK,WAAW,GAAG,MAAM,GAAG;AAAA,QAC7D;AACA,YAAI,CAAC,WAAW,cAAe,QAAO;AACtC,eAAO;AAAA,MACT;AAAA,IACF;AAAA,IACA,OAAO,EAAE,QAAQ,WAAW;AAAA,IAC5B,WAAW;AAAA,EACb;AAEA,SAAO,SAAS,MAAM;AACxB;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@augmenting-integrations/auth",
3
- "version": "0.2.2",
3
+ "version": "2.0.0",
4
4
  "description": "Auth.js v5 factory: Cognito in prod, Credentials role-picker in dev. Same JWT shape (sub, email, cognito:groups) regardless of provider.",
5
5
  "license": "MIT",
6
6
  "publishConfig": {