code: public static UserAuthentication checkIfActive(UserAuthentication userAuth, User user, boolean throwException) {
  		if (userAuth == null || user == null || user.getIdentifier() == null) {
  			if (throwException) {
  				throw new BadCredentialsException("Bad credentials.");
  			} else {
  				logger.debug("Bad credentials. {}", userAuth);
  				return null;
  			}
  		} else if (!user.getActive()) {
  			if (throwException) {
  				throw new LockedException("Account " + user.getId() + " (" + user.getAppid() + "/" +
  						user.getIdentifier() + ") is locked.");
  			} else {
  				logger.warn("Account {} ({}/{}) is locked.", user.getId(), user.getAppid(), user.getIdentifier());
  				return null;
  			}
  		}
  		return userAuth;
  	}
docs: Checks if account is active.
  @param userAuth user authentication object
  @param user user object
  @param throwException throw or not
  @return the authentication object if {@code user.active == true}