Example #1
0
  @Override
  public void validate(User user) {
    super.validate(user);
    if (Utils.isEmptyString(this.code)) {
      throw new IllegalArgumentException(
          "Access Key must not be empty, you can delete the key if you don't want it anymore.");
    }

    if (Utils.isEmptyString(this.scope)) {
      throw new IllegalArgumentException("Source must not be empty");
    }

    if (AuthLevel.get(this.authLevel).equals(AuthLevel.readPoint)
        || AuthLevel.get(this.authLevel).equals(AuthLevel.readWritePoint)) {
      if (Utils.isEmptyString(this.scope)) {
        throw new IllegalArgumentException(
            "Auth Keys with an auth level of point, must have a target point key set");
      }
    }
  }
Example #2
0
 @Override
 public AuthLevel getAuthLevel() {
   return AuthLevel.get(this.authLevel);
 }