Skip to content

Commit 1a3a006

Browse files
authored
Remove 7.1 and 7.2 transport version constants (#136038)
This commit removes the V_7_1_0 and V_7_2_0 version constants. Most users were in bwc logic for tokens, as well as testing specific bwc behavior that is no longer relevant to 9.x.
1 parent 711392c commit 1a3a006

File tree

6 files changed

+67
-428
lines changed

6 files changed

+67
-428
lines changed

server/src/main/java/org/elasticsearch/TransportVersions.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ static TransportVersion def(int id) {
5353
}
5454

5555
// TODO: ES-10337 we can remove all transport versions earlier than 8.18
56-
public static final TransportVersion V_7_1_0 = def(7_01_00_99);
57-
public static final TransportVersion V_7_2_0 = def(7_02_00_99);
5856
public static final TransportVersion V_7_3_0 = def(7_03_00_99);
5957
public static final TransportVersion V_7_3_2 = def(7_03_02_99);
6058
public static final TransportVersion V_7_4_0 = def(7_04_00_99);

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/SecurityFeatureSetUsage.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,8 @@ public SecurityFeatureSetUsage(StreamInput in) throws IOException {
5555
realmsUsage = in.readGenericMap();
5656
rolesStoreUsage = in.readGenericMap();
5757
sslUsage = in.readGenericMap();
58-
if (in.getTransportVersion().onOrAfter(TransportVersions.V_7_2_0)) {
59-
tokenServiceUsage = in.readGenericMap();
60-
apiKeyServiceUsage = in.readGenericMap();
61-
}
58+
tokenServiceUsage = in.readGenericMap();
59+
apiKeyServiceUsage = in.readGenericMap();
6260
auditUsage = in.readGenericMap();
6361
ipFilterUsage = in.readGenericMap();
6462
anonymousUsage = in.readGenericMap();
@@ -121,10 +119,8 @@ public void writeTo(StreamOutput out) throws IOException {
121119
out.writeGenericMap(realmsUsage);
122120
out.writeGenericMap(rolesStoreUsage);
123121
out.writeGenericMap(sslUsage);
124-
if (out.getTransportVersion().onOrAfter(TransportVersions.V_7_2_0)) {
125-
out.writeGenericMap(tokenServiceUsage);
126-
out.writeGenericMap(apiKeyServiceUsage);
127-
}
122+
out.writeGenericMap(tokenServiceUsage);
123+
out.writeGenericMap(apiKeyServiceUsage);
128124
out.writeGenericMap(auditUsage);
129125
out.writeGenericMap(ipFilterUsage);
130126
out.writeGenericMap(anonymousUsage);

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authc/support/TokensInvalidationResult.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
package org.elasticsearch.xpack.core.security.authc.support;
99

1010
import org.elasticsearch.ElasticsearchException;
11-
import org.elasticsearch.TransportVersions;
1211
import org.elasticsearch.common.io.stream.StreamInput;
1312
import org.elasticsearch.common.io.stream.StreamOutput;
1413
import org.elasticsearch.common.io.stream.Writeable;
@@ -59,9 +58,6 @@ public TokensInvalidationResult(StreamInput in) throws IOException {
5958
this.invalidatedTokens = in.readStringCollectionAsList();
6059
this.previouslyInvalidatedTokens = in.readStringCollectionAsList();
6160
this.errors = in.readCollectionAsList(StreamInput::readException);
62-
if (in.getTransportVersion().before(TransportVersions.V_7_2_0)) {
63-
in.readVInt();
64-
}
6561
this.restStatus = RestStatus.readFrom(in);
6662
}
6763

@@ -109,9 +105,6 @@ public void writeTo(StreamOutput out) throws IOException {
109105
out.writeStringCollection(invalidatedTokens);
110106
out.writeStringCollection(previouslyInvalidatedTokens);
111107
out.writeCollection(errors, StreamOutput::writeException);
112-
if (out.getTransportVersion().before(TransportVersions.V_7_2_0)) {
113-
out.writeVInt(5);
114-
}
115108
RestStatus.writeTo(out, restStatus);
116109
}
117110
}

x-pack/plugin/security/src/internalClusterTest/java/org/elasticsearch/xpack/security/authc/TokenAuthIntegTests.java

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -750,37 +750,6 @@ public void testClientCredentialsGrant() throws Exception {
750750
assertUnauthorizedToken(createTokenResponse.accessToken());
751751
}
752752

753-
public void testAuthenticateWithWrongToken() throws Exception {
754-
final TokenService tokenService = internalCluster().getInstance(TokenService.class);
755-
OAuth2Token response = createToken(TEST_USER_NAME, SecuritySettingsSourceField.TEST_PASSWORD_SECURE_STRING);
756-
assertNotNull(response.getRefreshToken());
757-
// Assert that we can authenticate with the access token
758-
assertAuthenticateWithToken(response.accessToken(), TEST_USER_NAME);
759-
// Now attempt to authenticate with an invalid access token string
760-
assertUnauthorizedToken(randomAlphaOfLengthBetween(0, 128));
761-
// Now attempt to authenticate with an invalid access token with valid structure (pre 7.2)
762-
assertUnauthorizedToken(
763-
tokenService.prependVersionAndEncodeAccessToken(
764-
TransportVersions.V_7_1_0,
765-
tokenService.getRandomTokenBytes(TransportVersions.V_7_1_0, randomBoolean()).v1()
766-
)
767-
);
768-
// Now attempt to authenticate with an invalid access token with valid structure (after 7.2 pre 8.10)
769-
assertUnauthorizedToken(
770-
tokenService.prependVersionAndEncodeAccessToken(
771-
TransportVersions.V_7_4_0,
772-
tokenService.getRandomTokenBytes(TransportVersions.V_7_4_0, randomBoolean()).v1()
773-
)
774-
);
775-
// Now attempt to authenticate with an invalid access token with valid structure (current version)
776-
assertUnauthorizedToken(
777-
tokenService.prependVersionAndEncodeAccessToken(
778-
TransportVersion.current(),
779-
tokenService.getRandomTokenBytes(TransportVersion.current(), randomBoolean()).v1()
780-
)
781-
);
782-
}
783-
784753
@Before
785754
public void waitForSecurityIndexWritable() throws Exception {
786755
createSecurityIndexWithWaitForActiveShards();

0 commit comments

Comments
 (0)