code: public boolean isCredentialsValid(String username, String password) {
          try {
              String token = getTokenAuthenticationManager().login(StringUtil.toEmptyIfNull(username), StringUtil.toEmptyIfNull(password));
              getTokenAuthenticationManager().logout(token);
  
              return true;
          } catch (Exception ex) {
              return false;
          }
      }
docs: <p>isCredentialsValid.</p>
  
  @param username a {@link java.lang.String} object.
  @param password a {@link java.lang.String} object.
  @return a boolean.