Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions server/src/main/java/org/elasticsearch/TransportVersions.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ static TransportVersion def(int id) {
}

// TODO: ES-10337 we can remove all transport versions earlier than 8.18
public static final TransportVersion V_7_1_0 = def(7_01_00_99);
public static final TransportVersion V_7_2_0 = def(7_02_00_99);
public static final TransportVersion V_7_3_0 = def(7_03_00_99);
public static final TransportVersion V_7_3_2 = def(7_03_02_99);
public static final TransportVersion V_7_4_0 = def(7_04_00_99);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,8 @@ public SecurityFeatureSetUsage(StreamInput in) throws IOException {
realmsUsage = in.readGenericMap();
rolesStoreUsage = in.readGenericMap();
sslUsage = in.readGenericMap();
if (in.getTransportVersion().onOrAfter(TransportVersions.V_7_2_0)) {
tokenServiceUsage = in.readGenericMap();
apiKeyServiceUsage = in.readGenericMap();
}
tokenServiceUsage = in.readGenericMap();
apiKeyServiceUsage = in.readGenericMap();
auditUsage = in.readGenericMap();
ipFilterUsage = in.readGenericMap();
anonymousUsage = in.readGenericMap();
Expand Down Expand Up @@ -121,10 +119,8 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeGenericMap(realmsUsage);
out.writeGenericMap(rolesStoreUsage);
out.writeGenericMap(sslUsage);
if (out.getTransportVersion().onOrAfter(TransportVersions.V_7_2_0)) {
out.writeGenericMap(tokenServiceUsage);
out.writeGenericMap(apiKeyServiceUsage);
}
out.writeGenericMap(tokenServiceUsage);
out.writeGenericMap(apiKeyServiceUsage);
out.writeGenericMap(auditUsage);
out.writeGenericMap(ipFilterUsage);
out.writeGenericMap(anonymousUsage);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
package org.elasticsearch.xpack.core.security.authc.support;

import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.TransportVersions;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.io.stream.Writeable;
Expand Down Expand Up @@ -59,9 +58,6 @@ public TokensInvalidationResult(StreamInput in) throws IOException {
this.invalidatedTokens = in.readStringCollectionAsList();
this.previouslyInvalidatedTokens = in.readStringCollectionAsList();
this.errors = in.readCollectionAsList(StreamInput::readException);
if (in.getTransportVersion().before(TransportVersions.V_7_2_0)) {
in.readVInt();
}
this.restStatus = RestStatus.readFrom(in);
}

Expand Down Expand Up @@ -109,9 +105,6 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeStringCollection(invalidatedTokens);
out.writeStringCollection(previouslyInvalidatedTokens);
out.writeCollection(errors, StreamOutput::writeException);
if (out.getTransportVersion().before(TransportVersions.V_7_2_0)) {
out.writeVInt(5);
}
RestStatus.writeTo(out, restStatus);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -750,37 +750,6 @@ public void testClientCredentialsGrant() throws Exception {
assertUnauthorizedToken(createTokenResponse.accessToken());
}

public void testAuthenticateWithWrongToken() throws Exception {
final TokenService tokenService = internalCluster().getInstance(TokenService.class);
OAuth2Token response = createToken(TEST_USER_NAME, SecuritySettingsSourceField.TEST_PASSWORD_SECURE_STRING);
assertNotNull(response.getRefreshToken());
// Assert that we can authenticate with the access token
assertAuthenticateWithToken(response.accessToken(), TEST_USER_NAME);
// Now attempt to authenticate with an invalid access token string
assertUnauthorizedToken(randomAlphaOfLengthBetween(0, 128));
// Now attempt to authenticate with an invalid access token with valid structure (pre 7.2)
assertUnauthorizedToken(
tokenService.prependVersionAndEncodeAccessToken(
TransportVersions.V_7_1_0,
tokenService.getRandomTokenBytes(TransportVersions.V_7_1_0, randomBoolean()).v1()
)
);
// Now attempt to authenticate with an invalid access token with valid structure (after 7.2 pre 8.10)
assertUnauthorizedToken(
tokenService.prependVersionAndEncodeAccessToken(
TransportVersions.V_7_4_0,
tokenService.getRandomTokenBytes(TransportVersions.V_7_4_0, randomBoolean()).v1()
)
);
// Now attempt to authenticate with an invalid access token with valid structure (current version)
assertUnauthorizedToken(
tokenService.prependVersionAndEncodeAccessToken(
TransportVersion.current(),
tokenService.getRandomTokenBytes(TransportVersion.current(), randomBoolean()).v1()
)
);
}

@Before
public void waitForSecurityIndexWritable() throws Exception {
createSecurityIndexWithWaitForActiveShards();
Expand Down
Loading