diff --git a/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/token/CreateTokenRequest.java b/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/token/CreateTokenRequest.java index aa28605d0fd..5956e1a6613 100644 --- a/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/token/CreateTokenRequest.java +++ b/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/token/CreateTokenRequest.java @@ -142,7 +142,7 @@ public final class CreateTokenRequest extends ActionRequest { out.writeOptionalString(refreshToken); } else { if ("refresh_token".equals(grantType)) { - throw new UnsupportedOperationException("a refresh request cannot be sent to an older version"); + throw new IllegalArgumentException("a refresh request cannot be sent to an older version"); } else { out.writeString(username); final byte[] passwordBytes = CharArrays.toUtf8Bytes(password.getChars()); diff --git a/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/token/InvalidateTokenRequest.java b/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/token/InvalidateTokenRequest.java index 8ad4f024eaf..7a8372fe456 100644 --- a/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/token/InvalidateTokenRequest.java +++ b/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/token/InvalidateTokenRequest.java @@ -74,7 +74,7 @@ public final class InvalidateTokenRequest extends ActionRequest { if (out.getVersion().onOrAfter(Version.V_6_2_0)) { out.writeVInt(tokenType.ordinal()); } else if (tokenType == Type.REFRESH_TOKEN) { - throw new UnsupportedOperationException("refresh token invalidation cannot be serialized with version [" + out.getVersion() + + throw new IllegalArgumentException("refresh token invalidation cannot be serialized with version [" + out.getVersion() + "]"); } }