Skip to content

Commit 90ef203

Browse files
committed
revert bad change
1 parent 8b33379 commit 90ef203

File tree

1 file changed

+6
-6
lines changed
  • x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authc

1 file changed

+6
-6
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959
import static org.elasticsearch.transport.RemoteClusterPortSettings.TRANSPORT_VERSION_ADVANCED_REMOTE_CLUSTER_SECURITY;
6060
import static org.elasticsearch.xcontent.ConstructingObjectParser.constructorArg;
6161
import static org.elasticsearch.xcontent.ConstructingObjectParser.optionalConstructorArg;
62-
import static org.elasticsearch.xpack.core.security.authc.Authentication.AuthenticationType.TOKEN;
6362
import static org.elasticsearch.xpack.core.security.authc.Authentication.RealmRef.newAnonymousRealmRef;
6463
import static org.elasticsearch.xpack.core.security.authc.Authentication.RealmRef.newApiKeyRealmRef;
6564
import static org.elasticsearch.xpack.core.security.authc.Authentication.RealmRef.newCloudApiKeyRealmRef;
@@ -426,7 +425,7 @@ public Authentication token() {
426425
assert false == isAuthenticatedInternally();
427426
assert false == isServiceAccount();
428427
assert false == isCrossClusterAccess();
429-
final Authentication newTokenAuthentication = new Authentication(effectiveSubject, authenticatingSubject, TOKEN);
428+
final Authentication newTokenAuthentication = new Authentication(effectiveSubject, authenticatingSubject, AuthenticationType.TOKEN);
430429
return newTokenAuthentication;
431430
}
432431

@@ -605,7 +604,7 @@ public boolean supportsRunAs(@Nullable AnonymousUser anonymousUser) {
605604
// Run-as is supported for authentication with realm, api_key or token.
606605
if (AuthenticationType.REALM == getAuthenticationType()
607606
|| AuthenticationType.API_KEY == getAuthenticationType()
608-
|| TOKEN == getAuthenticationType()) {
607+
|| AuthenticationType.TOKEN == getAuthenticationType()) {
609608
return true;
610609
}
611610

@@ -719,7 +718,7 @@ public boolean canAccessResourcesOf(Authentication resourceCreatorAuthentication
719718
assert EnumSet.of(
720719
Authentication.AuthenticationType.REALM,
721720
Authentication.AuthenticationType.API_KEY,
722-
TOKEN,
721+
AuthenticationType.TOKEN,
723722
Authentication.AuthenticationType.ANONYMOUS,
724723
Authentication.AuthenticationType.INTERNAL
725724
).containsAll(EnumSet.of(getAuthenticationType(), resourceCreatorAuthentication.getAuthenticationType()))
@@ -1362,7 +1361,7 @@ public static Authentication newServiceAccountAuthentication(User serviceAccount
13621361
final Authentication.RealmRef authenticatedBy = newServiceAccountRealmRef(nodeName);
13631362
Authentication authentication = new Authentication(
13641363
new Subject(serviceAccountUser, authenticatedBy, TransportVersion.current(), metadata),
1365-
TOKEN
1364+
AuthenticationType.TOKEN
13661365
);
13671366
return authentication;
13681367
}
@@ -1387,7 +1386,8 @@ public static Authentication newCloudAccessTokenAuthentication(
13871386
) {
13881387
assert authResult.isAuthenticated() : "cloud access token authn result must be successful";
13891388
final User user = authResult.getValue();
1390-
return new Authentication(new Subject(user, realmRef, TransportVersion.current(), authResult.getMetadata()), TOKEN);
1389+
return new Authentication(new Subject(user, realmRef, TransportVersion.current(), authResult.getMetadata()),
1390+
AuthenticationType.TOKEN);
13911391
}
13921392

13931393
public static Authentication newCloudApiKeyAuthentication(AuthenticationResult<User> authResult, String nodeName) {

0 commit comments

Comments
 (0)