Beispiel #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");
      }
    }
  }
Beispiel #2
0
 @Override
 public void setAuthLevel(final AuthLevel level) {
   this.authLevel = level.getCode();
 }
Beispiel #3
0
 @Override
 public AuthLevel getAuthLevel() {
   return AuthLevel.get(this.authLevel);
 }