How to use the @authx/authx.User.write function in @authx/authx

To help you get started, we’ve selected a few @authx/authx examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github the-control-group / authx / packages / strategy-openid / src / server / graphql / mutation / authenticateOpenId.ts View on Github external
authorityId: authority.id,
              authorityUserId: token.sub,
              details: {}
            },
            {
              recordId: v4(),
              createdByAuthorizationId: authorizationId,
              createdAt: new Date()
            }
          );
        }
      }

      // Create a new user.
      if (!credential && authority.details.createsUnmatchedUsers) {
        const user = await User.write(
          tx,
          {
            id: v4(),
            enabled: true,
            type: "human",
            name: token.name || ""
          },
          {
            recordId: v4(),
            createdByAuthorizationId: authorizationId,
            createdAt: new Date()
          }
        );

        credential = await OpenIdCredential.write(
          tx,
github the-control-group / authx / packages / tools / src / lib / bootstrap.ts View on Github external
tx.query("INSERT INTO authx.user (id) VALUES ($1)", [user.data.id]),
    tx.query("INSERT INTO authx.authority (id) VALUES ($1)", [
      authority.data.id
    ]),
    tx.query("INSERT INTO authx.credential (id) VALUES ($1)", [
      credential.data.id
    ]),
    tx.query("INSERT INTO authx.role (id) VALUES ($1)", [role.data.id]),
    tx.query("INSERT INTO authx.authorization (id) VALUES ($1)", [
      authorization.data.id
    ])
  ]);

  // insert the records
  await Promise.all([
    User.write(tx, user.data, user.metadata),
    PasswordAuthority.write(tx, authority.data, authority.metadata),
    PasswordCredential.write(tx, credential.data, credential.metadata),
    Role.write(tx, role.data, role.metadata),
    Authorization.write(tx, authorization.data, authorization.metadata)
  ]);
}
github the-control-group / authx / packages / tools / src / lib / fixture / user.ts View on Github external
insert: (tx: PoolClient) =>
      User.write(
        tx,
        {
          id: "eaa9fa5e-088a-4ae2-a6ab-f120006b20a9",
          enabled: true,
          type: "human",
          name: "Pam Beesly-Halpert"
        },
        {
          recordId: "60cd702f-8cb5-4aa2-aae6-7fd9778f8d50",
          createdByAuthorizationId: "f0e54748-c7bb-4724-ad8b-7dabb66aafa9",
          createdAt: new Date("2019-03-06T21:07:59.814Z")
        }
      )
  },