private UsernamePasswordCredentials login(final String username, final String password, final String attribute) {
        val authenticator = new MongoProfileService(getClient(), attribute);
        authenticator.setPasswordEncoder(MongoServer.PASSWORD_ENCODER);
        val credentials = new UsernamePasswordCredentials(username, password);
        authenticator.validate(null, credentials);

        return credentials;
    }
Tests the {@link MongoProfileService}.

@author Jerome Leleu
@since 1.8.0
pac4j-mongo/src/test/java/org/pac4j/mongo/profile/service/MongoProfileServiceIT.java