AuthCredentialsProviderFixture constructor

AuthCredentialsProviderFixture({
  1. String email = 'fixture@example.test',
  2. String username = 'fixture-user',
  3. String password = 'fixture-password-not-a-secret',
  4. AuthUser? user,
})

Creates a credentials fixture.

Implementation

AuthCredentialsProviderFixture({
  this.email = 'fixture@example.test',
  this.username = 'fixture-user',
  this.password = 'fixture-password-not-a-secret',
  AuthUser? user,
}) : user = user ?? AuthUser(id: 'fixture-user-id', email: email) {
  provider = CredentialsProvider(
    authorize: (context, provider, credentials) {
      authorizationAttempts.add(credentials.redacted());
      return matches(credentials) ? this.user : null;
    },
    register: (context, provider, credentials) {
      registrationAttempts.add(credentials.redacted());
      return matches(credentials) ? this.user : null;
    },
  );
}