getResourceOwner method

  1. @override
Future<T?> getResourceOwner(
  1. AuthServer server,
  2. String username
)
override

Must return a ResourceOwner for a username.

This method must return an instance of ResourceOwner if one exists for username. Otherwise, it must return null.

Every property declared by ResourceOwner must be non-null in the return value.

server is the AuthServer invoking this method.

Implementation

@override
Future<T?> getResourceOwner(AuthServer server, String username) {
  final query = Query<T>(context)
    ..where((o) => o.username).equalTo(username)
    ..returningProperties(
        (t) => [t.id, t.hashedPassword, t.salt, t.username]);

  return query.fetchOne();
}