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.
package/dist/index.mjs CHANGED
@@ -715,9 +715,10 @@ function createSystem(given = {}) {
715
715
  let asking;
716
716
  async function ask() {
717
717
  configured();
718
- const form = new URLSearchParams({ grant_type: "client_credentials", client_id: clientId });
718
+ const self = key?.clientId || clientId;
719
+ const form = new URLSearchParams({ grant_type: "client_credentials", client_id: self });
719
720
  if (key) {
720
- const assertion = await new SignJWT({}).setProtectedHeader({ alg: "RS256", kid: key.keyId }).setIssuer(clientId).setSubject(clientId).setAudience(tokenEndpoint).setJti(crypto.randomUUID()).setIssuedAt().setExpirationTime("2m").sign(await signingKey());
721
+ const assertion = await new SignJWT({}).setProtectedHeader({ alg: "RS256", kid: key.keyId }).setIssuer(self).setSubject(self).setAudience(tokenEndpoint).setJti(crypto.randomUUID()).setIssuedAt().setExpirationTime("2m").sign(await signingKey());
721
722
  form.set("client_assertion_type", ASSERTION_TYPE);
722
723
  form.set("client_assertion", assertion);
723
724
  } else {
@@ -1687,7 +1688,8 @@ function createCauthy(given = {}) {
1687
1688
  // Whether the workspace signs people in with a password at all. A
1688
1689
  // Cauthy from before the setting says nothing of it: then it does.
1689
1690
  passwordSignIn: settings.data?.allow_password !== false,
1690
- signUp: settings.data?.allow_signup !== false,
1691
+ // The workspace's switch, and how the application's own system takes sign-ups.
1692
+ signUp: settings.data?.allow_signup !== false && settings.data?.signup?.mode !== "invite_only",
1691
1693
  // The application's system makes an organization per sign-up: the form asks the company's name.
1692
1694
  ...settings.data?.signup?.organization?.ask === true ? { organization: { ask: true, required: settings.data.signup.organization.required === true } } : {},
1693
1695
  // A sign-in link needs a page of the application to open.