cauthy-auth 0.38.0 → 0.38.2

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.
@@ -1,4 +1,4 @@
1
- import { J as JsonValue, S as Session, t as SessionStatus, s as SessionOrganization, f as CheckQuestion, k as OrganizationRef, g as CheckResult, d as CauthySystem, q as PublicSession, c as CauthyOptions } from './system-DUGV040y.mjs';
1
+ import { J as JsonValue, S as Session, t as SessionStatus, s as SessionOrganization, f as CheckQuestion, k as OrganizationRef, g as CheckResult, d as CauthySystem, q as PublicSession, c as CauthyOptions } from './system-CqPa5xR5.mjs';
2
2
  import { JWTVerifyGetKey } from 'jose';
3
3
 
4
4
  /** Something that happened in Cauthy, as a subscriber is told. Moments are UTC. */
@@ -1,4 +1,4 @@
1
- import { J as JsonValue, S as Session, t as SessionStatus, s as SessionOrganization, f as CheckQuestion, k as OrganizationRef, g as CheckResult, d as CauthySystem, q as PublicSession, c as CauthyOptions } from './system-Bz4haPrI.js';
1
+ import { J as JsonValue, S as Session, t as SessionStatus, s as SessionOrganization, f as CheckQuestion, k as OrganizationRef, g as CheckResult, d as CauthySystem, q as PublicSession, c as CauthyOptions } from './system-Dssq1JUJ.js';
2
2
  import { JWTVerifyGetKey } from 'jose';
3
3
 
4
4
  /** Something that happened in Cauthy, as a subscriber is told. Moments are UTC. */
package/dist/cli.js CHANGED
@@ -1013,9 +1013,10 @@ function createSystem(given = {}) {
1013
1013
  let asking;
1014
1014
  async function ask() {
1015
1015
  configured();
1016
- const form = new URLSearchParams({ grant_type: "client_credentials", client_id: clientId });
1016
+ const self = key?.clientId || clientId;
1017
+ const form = new URLSearchParams({ grant_type: "client_credentials", client_id: self });
1017
1018
  if (key) {
1018
- const assertion = await new import_jose.SignJWT({}).setProtectedHeader({ alg: "RS256", kid: key.keyId }).setIssuer(clientId).setSubject(clientId).setAudience(tokenEndpoint).setJti(crypto.randomUUID()).setIssuedAt().setExpirationTime("2m").sign(await signingKey());
1019
+ const assertion = await new import_jose.SignJWT({}).setProtectedHeader({ alg: "RS256", kid: key.keyId }).setIssuer(self).setSubject(self).setAudience(tokenEndpoint).setJti(crypto.randomUUID()).setIssuedAt().setExpirationTime("2m").sign(await signingKey());
1019
1020
  form.set("client_assertion_type", ASSERTION_TYPE);
1020
1021
  form.set("client_assertion", assertion);
1021
1022
  } else {
package/dist/client.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { CauthyTheme } from './theme.mjs';
2
- import { q as PublicSession, f as CheckQuestion, k as OrganizationRef, g as CheckResult } from './system-DUGV040y.mjs';
3
- export { h as CheckRule } from './system-DUGV040y.mjs';
2
+ import { q as PublicSession, f as CheckQuestion, k as OrganizationRef, g as CheckResult } from './system-CqPa5xR5.mjs';
3
+ export { h as CheckRule } from './system-CqPa5xR5.mjs';
4
4
  import { A as AuthField, b as PasswordPolicy } from './validate-sEXG82po.mjs';
5
5
  export { D as DEFAULT_PASSWORD_POLICY, F as FieldProblem, M as MIN_PASSWORD, P as PasswordClass, a as PasswordLocale, c as PasswordReason, d as checkCode, e as checkEmail, f as checkName, g as checkNewPassword, h as checkPassword, i as describePasswordPolicy, j as explainPasswordProblems, p as passwordPolicyOf, k as passwordProblems } from './validate-sEXG82po.mjs';
6
6
  import 'jose';
package/dist/client.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { CauthyTheme } from './theme.js';
2
- import { q as PublicSession, f as CheckQuestion, k as OrganizationRef, g as CheckResult } from './system-Bz4haPrI.js';
3
- export { h as CheckRule } from './system-Bz4haPrI.js';
2
+ import { q as PublicSession, f as CheckQuestion, k as OrganizationRef, g as CheckResult } from './system-Dssq1JUJ.js';
3
+ export { h as CheckRule } from './system-Dssq1JUJ.js';
4
4
  import { A as AuthField, b as PasswordPolicy } from './validate-sEXG82po.js';
5
5
  export { D as DEFAULT_PASSWORD_POLICY, F as FieldProblem, M as MIN_PASSWORD, P as PasswordClass, a as PasswordLocale, c as PasswordReason, d as checkCode, e as checkEmail, f as checkName, g as checkNewPassword, h as checkPassword, i as describePasswordPolicy, j as explainPasswordProblems, p as passwordPolicyOf, k as passwordProblems } from './validate-sEXG82po.js';
6
6
  import 'jose';
@@ -1,6 +1,6 @@
1
1
  import { IncomingMessage, ServerResponse } from 'node:http';
2
- import { C as Cauthy } from './cauthy-C-GoRXy9.mjs';
3
- import { S as Session } from './system-DUGV040y.mjs';
2
+ import { C as Cauthy } from './cauthy-3h6d8YXl.mjs';
3
+ import { S as Session } from './system-CqPa5xR5.mjs';
4
4
  import 'jose';
5
5
  import './theme.mjs';
6
6
 
package/dist/express.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { IncomingMessage, ServerResponse } from 'node:http';
2
- import { C as Cauthy } from './cauthy-BUozWD72.js';
3
- import { S as Session } from './system-Bz4haPrI.js';
2
+ import { C as Cauthy } from './cauthy-C-_Bj6-L.js';
3
+ import { S as Session } from './system-Dssq1JUJ.js';
4
4
  import 'jose';
5
5
  import './theme.js';
6
6
 
@@ -1,6 +1,6 @@
1
1
  import { FastifyReply, FastifyPluginAsync } from 'fastify';
2
- import { C as Cauthy } from './cauthy-C-GoRXy9.mjs';
3
- import { S as Session } from './system-DUGV040y.mjs';
2
+ import { C as Cauthy } from './cauthy-3h6d8YXl.mjs';
3
+ import { S as Session } from './system-CqPa5xR5.mjs';
4
4
  import 'jose';
5
5
  import './theme.mjs';
6
6
 
package/dist/fastify.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { FastifyReply, FastifyPluginAsync } from 'fastify';
2
- import { C as Cauthy } from './cauthy-BUozWD72.js';
3
- import { S as Session } from './system-Bz4haPrI.js';
2
+ import { C as Cauthy } from './cauthy-C-_Bj6-L.js';
3
+ import { S as Session } from './system-Dssq1JUJ.js';
4
4
  import 'jose';
5
5
  import './theme.js';
6
6
 
package/dist/hono.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { MiddlewareHandler } from 'hono';
2
- import { C as Cauthy } from './cauthy-C-GoRXy9.mjs';
3
- import { S as Session } from './system-DUGV040y.mjs';
2
+ import { C as Cauthy } from './cauthy-3h6d8YXl.mjs';
3
+ import { S as Session } from './system-CqPa5xR5.mjs';
4
4
  import 'jose';
5
5
  import './theme.mjs';
6
6
 
package/dist/hono.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { MiddlewareHandler } from 'hono';
2
- import { C as Cauthy } from './cauthy-BUozWD72.js';
3
- import { S as Session } from './system-Bz4haPrI.js';
2
+ import { C as Cauthy } from './cauthy-C-_Bj6-L.js';
3
+ import { S as Session } from './system-Dssq1JUJ.js';
4
4
  import 'jose';
5
5
  import './theme.js';
6
6
 
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- export { C as Cauthy, a as CauthyEvent, b as CauthyWebhookError, R as Resolved, V as VerifyWebhookOptions, c as createCauthy, v as verifyWebhook } from './cauthy-C-GoRXy9.mjs';
2
- export { A as AttributeType, C as CatalogResource, a as CauthyApiError, b as CauthyConfigError, c as CauthyOptions, d as CauthySystem, e as CheckOf, f as CheckQuestion, g as CheckResult, h as CheckRule, i as ConditionalPermission, J as JsonValue, N as NewMember, O as Organization, j as OrganizationMember, k as OrganizationRef, P as PermissionOf, l as Permitted, m as Policy, n as PolicyDefinition, o as PolicyPermission, p as PolicyRole, q as PublicSession, r as PushPolicyOptions, R as RoleOf, S as Session, s as SessionOrganization, t as SessionStatus, u as SessionUser, v as SystemKey, w as SystemOptions, x as SystemPolicy, y as can, z as createSystem, B as definePolicy, D as policySource, E as pullCatalog, F as pullPolicy, G as pushCatalog, H as pushPolicy } from './system-DUGV040y.mjs';
1
+ export { C as Cauthy, a as CauthyEvent, b as CauthyWebhookError, R as Resolved, V as VerifyWebhookOptions, c as createCauthy, v as verifyWebhook } from './cauthy-3h6d8YXl.mjs';
2
+ export { A as AttributeType, C as CatalogResource, a as CauthyApiError, b as CauthyConfigError, c as CauthyOptions, d as CauthySystem, e as CheckOf, f as CheckQuestion, g as CheckResult, h as CheckRule, i as ConditionalPermission, J as JsonValue, N as NewMember, O as Organization, j as OrganizationMember, k as OrganizationRef, P as PermissionOf, l as Permitted, m as Policy, n as PolicyDefinition, o as PolicyPermission, p as PolicyRole, q as PublicSession, r as PushPolicyOptions, R as RoleOf, S as Session, s as SessionOrganization, t as SessionStatus, u as SessionUser, v as SystemKey, w as SystemOptions, x as SystemPolicy, y as can, z as createSystem, B as definePolicy, D as policySource, E as pullCatalog, F as pullPolicy, G as pushCatalog, H as pushPolicy } from './system-CqPa5xR5.mjs';
3
3
  export { CauthyTheme, ImportedTheme, PushThemeOptions, StackmythThemeOptions, StackmythTokens, ThemeFont, ThemeTexts, pushTheme, themeFromStackmyth, tokensFromStackmyth } from './theme.mjs';
4
4
  export { A as AuthField, D as DEFAULT_PASSWORD_POLICY, F as FieldProblem, M as MIN_PASSWORD, P as PasswordClass, a as PasswordLocale, b as PasswordPolicy, c as PasswordReason, d as checkCode, e as checkEmail, f as checkName, g as checkNewPassword, h as checkPassword, i as describePasswordPolicy, j as explainPasswordProblems, p as passwordPolicyOf, k as passwordProblems } from './validate-sEXG82po.mjs';
5
5
  import { JWTVerifyGetKey } from 'jose';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- export { C as Cauthy, a as CauthyEvent, b as CauthyWebhookError, R as Resolved, V as VerifyWebhookOptions, c as createCauthy, v as verifyWebhook } from './cauthy-BUozWD72.js';
2
- export { A as AttributeType, C as CatalogResource, a as CauthyApiError, b as CauthyConfigError, c as CauthyOptions, d as CauthySystem, e as CheckOf, f as CheckQuestion, g as CheckResult, h as CheckRule, i as ConditionalPermission, J as JsonValue, N as NewMember, O as Organization, j as OrganizationMember, k as OrganizationRef, P as PermissionOf, l as Permitted, m as Policy, n as PolicyDefinition, o as PolicyPermission, p as PolicyRole, q as PublicSession, r as PushPolicyOptions, R as RoleOf, S as Session, s as SessionOrganization, t as SessionStatus, u as SessionUser, v as SystemKey, w as SystemOptions, x as SystemPolicy, y as can, z as createSystem, B as definePolicy, D as policySource, E as pullCatalog, F as pullPolicy, G as pushCatalog, H as pushPolicy } from './system-Bz4haPrI.js';
1
+ export { C as Cauthy, a as CauthyEvent, b as CauthyWebhookError, R as Resolved, V as VerifyWebhookOptions, c as createCauthy, v as verifyWebhook } from './cauthy-C-_Bj6-L.js';
2
+ export { A as AttributeType, C as CatalogResource, a as CauthyApiError, b as CauthyConfigError, c as CauthyOptions, d as CauthySystem, e as CheckOf, f as CheckQuestion, g as CheckResult, h as CheckRule, i as ConditionalPermission, J as JsonValue, N as NewMember, O as Organization, j as OrganizationMember, k as OrganizationRef, P as PermissionOf, l as Permitted, m as Policy, n as PolicyDefinition, o as PolicyPermission, p as PolicyRole, q as PublicSession, r as PushPolicyOptions, R as RoleOf, S as Session, s as SessionOrganization, t as SessionStatus, u as SessionUser, v as SystemKey, w as SystemOptions, x as SystemPolicy, y as can, z as createSystem, B as definePolicy, D as policySource, E as pullCatalog, F as pullPolicy, G as pushCatalog, H as pushPolicy } from './system-Dssq1JUJ.js';
3
3
  export { CauthyTheme, ImportedTheme, PushThemeOptions, StackmythThemeOptions, StackmythTokens, ThemeFont, ThemeTexts, pushTheme, themeFromStackmyth, tokensFromStackmyth } from './theme.js';
4
4
  export { A as AuthField, D as DEFAULT_PASSWORD_POLICY, F as FieldProblem, M as MIN_PASSWORD, P as PasswordClass, a as PasswordLocale, b as PasswordPolicy, c as PasswordReason, d as checkCode, e as checkEmail, f as checkName, g as checkNewPassword, h as checkPassword, i as describePasswordPolicy, j as explainPasswordProblems, p as passwordPolicyOf, k as passwordProblems } from './validate-sEXG82po.js';
5
5
  import { JWTVerifyGetKey } from 'jose';
package/dist/index.js CHANGED
@@ -770,9 +770,10 @@ function createSystem(given = {}) {
770
770
  let asking;
771
771
  async function ask() {
772
772
  configured();
773
- const form = new URLSearchParams({ grant_type: "client_credentials", client_id: clientId });
773
+ const self = key?.clientId || clientId;
774
+ const form = new URLSearchParams({ grant_type: "client_credentials", client_id: self });
774
775
  if (key) {
775
- const assertion = await new import_jose2.SignJWT({}).setProtectedHeader({ alg: "RS256", kid: key.keyId }).setIssuer(clientId).setSubject(clientId).setAudience(tokenEndpoint).setJti(crypto.randomUUID()).setIssuedAt().setExpirationTime("2m").sign(await signingKey());
776
+ const assertion = await new import_jose2.SignJWT({}).setProtectedHeader({ alg: "RS256", kid: key.keyId }).setIssuer(self).setSubject(self).setAudience(tokenEndpoint).setJti(crypto.randomUUID()).setIssuedAt().setExpirationTime("2m").sign(await signingKey());
776
777
  form.set("client_assertion_type", ASSERTION_TYPE);
777
778
  form.set("client_assertion", assertion);
778
779
  } else {
@@ -1742,7 +1743,8 @@ function createCauthy(given = {}) {
1742
1743
  // Whether the workspace signs people in with a password at all. A
1743
1744
  // Cauthy from before the setting says nothing of it: then it does.
1744
1745
  passwordSignIn: settings.data?.allow_password !== false,
1745
- signUp: settings.data?.allow_signup !== false,
1746
+ // The workspace's switch, and how the application's own system takes sign-ups.
1747
+ signUp: settings.data?.allow_signup !== false && settings.data?.signup?.mode !== "invite_only",
1746
1748
  // The application's system makes an organization per sign-up: the form asks the company's name.
1747
1749
  ...settings.data?.signup?.organization?.ask === true ? { organization: { ask: true, required: settings.data.signup.organization.required === true } } : {},
1748
1750
  // A sign-in link needs a page of the application to open.