srv/auth/DataSourceAuthenticationProvider.js
function (authenticationRequest, callback) {
            // create query to fetch the user
            var query = this._createQueryForUser(authenticationRequest.get(this.$.usernameField));
            var collection = this.$.dataSource.createCollection(this.$collectionClass).query(query);

            collection.fetch({limit: 1}, function (err, users) {
                var user;
                if (!err && users.size()) {
                    user = users.at(0);
                    user.fetch(null, callback);
                } else {
                    callback(err, null);
                }
            });
        }
function (authenticationRequest, callback) {
            // create query to fetch the user
            var query = this._createQueryForUser(authenticationRequest.get(this.$.usernameField));
            var collection = this.$.dataSource.createCollection(this.$collectionClass).query(query);

            collection.fetch({limit: 1}, function (err, users) {
                var user;
                if (!err && users.size()) {
                    user = users.at(0);
                    user.fetch(null, callback);
                } else {
                    callback(err, null);
                }
            });
        }
function ( authenticationRequest , callback ) { // create query to fetch the user var query = this . _createQueryForUser ( authenticationRequest . get ( this . $ . usernameField ) ) ; var collection = this . $ . dataSource . createCollection ( this . $collectionClass ) . query ( query ) ; collection . fetch ( { limit : 1 } , function ( err , users ) { var user ; if ( ! err && users . size ( ) ) { user = users . at ( 0 ) ; user . fetch ( null , callback ) ; } else { callback ( err , null ) ; } } ) ; }
Fetches a user by username, returns a User or NULL
@param {srv.auth.AuthenticationRequest} authenticationRequest
@param {Function} callback
Fetches a user by username returns a User or NULL