How to use @authx/strategy-password - 6 common examples

To help you get started, we’ve selected a few @authx/strategy-password 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 / tools / src / lib / bootstrap.ts View on Github external
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 / credential.ts View on Github external
insert: (tx: PoolClient) =>
      PasswordCredential.write(
        tx,
        {
          id: "03e69b4c-3f73-4b15-866c-17efeeed1678",
          enabled: true,
          authorityId: "725f9c3b-4a72-4021-9066-c89e534df5be",
          authorityUserId: "306eabbb-cc2b-4f88-be19-4bb6ec98e5c3",
          userId: "306eabbb-cc2b-4f88-be19-4bb6ec98e5c3",
          details: {
            hash: "$2a$04$bEApeUnCL0pMAZf6fNym9OO/z6SJsyN6CY773Fx1O7ZTSzgwu1pXG" // password: costa rica
          }
        },
        {
          recordId: "5cb8a994-5c76-4551-891e-f9720a4be423",
          createdByAuthorizationId: "f0e54748-c7bb-4724-ad8b-7dabb66aafa9",
          createdAt: new Date("2019-03-06T21:07:59.814Z")
        }
github the-control-group / authx / packages / tools / src / lib / bootstrap.ts View on Github external
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 / authority.ts View on Github external
insert: (tx: PoolClient) =>
      PasswordAuthority.write(
        tx,
        {
          id: "725f9c3b-4a72-4021-9066-c89e534df5be",
          enabled: true,
          name: "Password",
          description: "The password authority.",
          strategy: "password",
          details: {
            rounds: 4
          }
        },
        {
          recordId: "dc4f3328-34da-4c46-94a8-2ec041d495e3",
          createdByAuthorizationId: "f0e54748-c7bb-4724-ad8b-7dabb66aafa9",
          createdAt: new Date("2019-03-06T21:07:59.814Z")
        }
github the-control-group / authx / packages / tools / src / scripts / bootstrap.ts View on Github external
export default async (): Promise => {
  const pool = new Pool();
  const tx = await pool.connect();

  const user = new User({
    id: v4(),
    enabled: true,
    type: "human",
    name: "AuthX Root User"
  });

  const authority = new PasswordAuthority({
    id: v4(),
    enabled: true,
    strategy: "password",
    name: "Password",
    description: "The password authority.",
    details: {
      rounds: 12
    }
  });

  const password = randomBytes(16).toString("hex");
  const credential = new PasswordCredential({
    id: v4(),
    enabled: true,
    authorityId: authority.id,
    authorityUserId: user.id,
github the-control-group / authx / packages / tools / src / scripts / bootstrap.ts View on Github external
name: "AuthX Root User"
  });

  const authority = new PasswordAuthority({
    id: v4(),
    enabled: true,
    strategy: "password",
    name: "Password",
    description: "The password authority.",
    details: {
      rounds: 12
    }
  });

  const password = randomBytes(16).toString("hex");
  const credential = new PasswordCredential({
    id: v4(),
    enabled: true,
    authorityId: authority.id,
    authorityUserId: user.id,
    userId: user.id,
    details: {
      hash: await hash(password, authority.details.rounds)
    }
  });

  const role = new Role({
    id: v4(),
    enabled: true,
    name: "Super Administrator",
    description: "A super administrator has full access to all resources.",
    scopes: ["**:**:**"],