code: public boolean isValid() {
      boolean result = true;
  
      // The username attribute will always be required.
      result = (this.getUsername() != null);
  
      if (result == true && this.requiredTokenAttributes != null) {
        for (String attr : this.requiredTokenAttributes) {
          if (this.get(attr) == null) {
            result = false;
            break;
          }
        }
      }
  
      return result;
    }
docs: Used to determine if the instance contains all of the
  {@link TokenAttributes#requiredTokenAttributes}. If any of the
  required attributes are missing, this will return {@code false}.
  
  @return {@code true} if all required attributes are present