Skip to content

Commit d9e5bb9

Browse files
authored
Rename authorizing_realms to authorization_realms (#32391)
The previous name incorrectly implies that the realms are actively authorizing something, however the reality is that they are realms that are consulted for the purposes of authorization.
1 parent f2ede8e commit d9e5bb9

File tree

6 files changed

+18
-17
lines changed

6 files changed

+18
-17
lines changed

x-pack/plugin/core/src/main/java/org/elasticsearch/license/XPackLicenseState.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,9 +415,10 @@ public boolean isCustomRoleProvidersAllowed() {
415415
}
416416

417417
/**
418-
* @return whether "authorizing_realms" are allowed based on the license {@link OperationMode}
418+
* @return whether "authorization_realms" are allowed based on the license {@link OperationMode}
419+
* @see org.elasticsearch.xpack.core.security.authc.support.DelegatedAuthorizationSettings
419420
*/
420-
public boolean isAuthorizingRealmAllowed() {
421+
public boolean isAuthorizationRealmAllowed() {
421422
final Status localStatus = status;
422423
return (localStatus.mode == OperationMode.PLATINUM || localStatus.mode == OperationMode.TRIAL)
423424
&& localStatus.active;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919
public class DelegatedAuthorizationSettings {
2020

21-
public static final Setting<List<String>> AUTHZ_REALMS = Setting.listSetting("authorizing_realms",
21+
public static final Setting<List<String>> AUTHZ_REALMS = Setting.listSetting("authorization_realms",
2222
Collections.emptyList(), Function.identity(), Setting.Property.NodeScope);
2323

2424
public static Collection<Setting<?>> getSettings() {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import static org.elasticsearch.common.Strings.collectionToDelimitedString;
2626

2727
/**
28-
* Utility class for supporting "delegated authorization" (aka "authorizing_realms", aka "lookup realms").
28+
* Utility class for supporting "delegated authorization" (aka "authorization_realms", aka "lookup realms").
2929
* A {@link Realm} may support delegating authorization to another realm. It does this by registering a
3030
* setting for {@link DelegatedAuthorizationSettings#AUTHZ_REALMS}, and constructing an instance of this
3131
* class. Then, after the realm has performed any authentication steps, if {@link #hasDelegation()} is
@@ -74,7 +74,7 @@ public boolean hasDelegation() {
7474
* with a meaningful diagnostic message.
7575
*/
7676
public void resolve(String username, ActionListener<AuthenticationResult> resultListener) {
77-
if (licenseState.isAuthorizingRealmAllowed() == false) {
77+
if (licenseState.isAuthorizationRealmAllowed() == false) {
7878
resultListener.onResponse(AuthenticationResult.unsuccessful(
7979
DelegatedAuthorizationSettings.AUTHZ_REALMS.getKey() + " are not permitted",
8080
LicenseUtils.newComplianceException(DelegatedAuthorizationSettings.AUTHZ_REALMS.getKey())

x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authc/ldap/LdapRealmTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public void init() throws Exception {
8484
defaultGlobalSettings = Settings.builder().put("path.home", createTempDir()).build();
8585
sslService = new SSLService(defaultGlobalSettings, TestEnvironment.newEnvironment(defaultGlobalSettings));
8686
licenseState = mock(XPackLicenseState.class);
87-
when(licenseState.isAuthorizingRealmAllowed()).thenReturn(true);
87+
when(licenseState.isAuthorizationRealmAllowed()).thenReturn(true);
8888
}
8989

9090
@After

x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authc/pki/PkiRealmTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public void setup() throws Exception {
7070
.put("path.home", createTempDir())
7171
.build();
7272
licenseState = mock(XPackLicenseState.class);
73-
when(licenseState.isAuthorizingRealmAllowed()).thenReturn(true);
73+
when(licenseState.isAuthorizationRealmAllowed()).thenReturn(true);
7474
}
7575

7676
public void testTokenSupport() {
@@ -350,7 +350,7 @@ public void testDelegatedAuthorization() throws Exception {
350350
otherRealm.registerUser(lookupUser);
351351

352352
final Settings realmSettings = Settings.builder()
353-
.putList("authorizing_realms", "other_realm")
353+
.putList("authorization_realms", "other_realm")
354354
.build();
355355
final UserRoleMapper roleMapper = buildRoleMapper(Collections.emptySet(), token.dn());
356356
final PkiRealm pkiRealm = buildRealm(roleMapper, realmSettings, otherRealm);

x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authc/support/DelegatedAuthorizationSupportTests.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,13 @@ public void testEmptyDelegationList() throws ExecutionException, InterruptedExce
7575
final AuthenticationResult result = future.get();
7676
assertThat(result.getStatus(), equalTo(AuthenticationResult.Status.CONTINUE));
7777
assertThat(result.getUser(), nullValue());
78-
assertThat(result.getMessage(), equalTo("No [authorizing_realms] have been configured"));
78+
assertThat(result.getMessage(), equalTo("No [authorization_realms] have been configured"));
7979
}
8080

8181
public void testMissingRealmInDelegationList() {
8282
final XPackLicenseState license = getLicenseState(true);
8383
final Settings settings = Settings.builder()
84-
.putList("authorizing_realms", "no-such-realm")
84+
.putList("authorization_realms", "no-such-realm")
8585
.build();
8686
final IllegalArgumentException ex = expectThrows(IllegalArgumentException.class, () ->
8787
new DelegatedAuthorizationSupport(realms, buildRealmConfig("r", settings), license)
@@ -93,7 +93,7 @@ public void testMatchInDelegationList() throws Exception {
9393
final XPackLicenseState license = getLicenseState(true);
9494
final List<MockLookupRealm> useRealms = shuffle(randomSubsetOf(randomIntBetween(1, realms.size()), realms));
9595
final Settings settings = Settings.builder()
96-
.putList("authorizing_realms", useRealms.stream().map(Realm::name).collect(Collectors.toList()))
96+
.putList("authorization_realms", useRealms.stream().map(Realm::name).collect(Collectors.toList()))
9797
.build();
9898
final User user = new User("my_user");
9999
randomFrom(useRealms).registerUser(user);
@@ -111,7 +111,7 @@ public void testRealmsAreOrdered() throws Exception {
111111
final List<MockLookupRealm> useRealms = shuffle(randomSubsetOf(randomIntBetween(3, realms.size()), realms));
112112
final List<String> names = useRealms.stream().map(Realm::name).collect(Collectors.toList());
113113
final Settings settings = Settings.builder()
114-
.putList("authorizing_realms", names)
114+
.putList("authorization_realms", names)
115115
.build();
116116
final List<User> users = new ArrayList<>(names.size());
117117
final String username = randomAlphaOfLength(8);
@@ -135,7 +135,7 @@ public void testNoMatchInDelegationList() throws Exception {
135135
final XPackLicenseState license = getLicenseState(true);
136136
final List<MockLookupRealm> useRealms = shuffle(randomSubsetOf(randomIntBetween(1, realms.size()), realms));
137137
final Settings settings = Settings.builder()
138-
.putList("authorizing_realms", useRealms.stream().map(Realm::name).collect(Collectors.toList()))
138+
.putList("authorization_realms", useRealms.stream().map(Realm::name).collect(Collectors.toList()))
139139
.build();
140140
final DelegatedAuthorizationSupport das = new DelegatedAuthorizationSupport(realms, buildRealmConfig("r", settings), license);
141141
assertThat(das.hasDelegation(), equalTo(true));
@@ -151,7 +151,7 @@ public void testNoMatchInDelegationList() throws Exception {
151151
public void testLicenseRejection() throws Exception {
152152
final XPackLicenseState license = getLicenseState(false);
153153
final Settings settings = Settings.builder()
154-
.putList("authorizing_realms", realms.get(0).name())
154+
.putList("authorization_realms", realms.get(0).name())
155155
.build();
156156
final DelegatedAuthorizationSupport das = new DelegatedAuthorizationSupport(realms, buildRealmConfig("r", settings), license);
157157
assertThat(das.hasDelegation(), equalTo(true));
@@ -160,14 +160,14 @@ public void testLicenseRejection() throws Exception {
160160
final AuthenticationResult result = future.get();
161161
assertThat(result.getStatus(), equalTo(AuthenticationResult.Status.CONTINUE));
162162
assertThat(result.getUser(), nullValue());
163-
assertThat(result.getMessage(), equalTo("authorizing_realms are not permitted"));
163+
assertThat(result.getMessage(), equalTo("authorization_realms are not permitted"));
164164
assertThat(result.getException(), instanceOf(ElasticsearchSecurityException.class));
165-
assertThat(result.getException().getMessage(), equalTo("current license is non-compliant for [authorizing_realms]"));
165+
assertThat(result.getException().getMessage(), equalTo("current license is non-compliant for [authorization_realms]"));
166166
}
167167

168168
private XPackLicenseState getLicenseState(boolean authzRealmsAllowed) {
169169
final XPackLicenseState license = mock(XPackLicenseState.class);
170-
when(license.isAuthorizingRealmAllowed()).thenReturn(authzRealmsAllowed);
170+
when(license.isAuthorizationRealmAllowed()).thenReturn(authzRealmsAllowed);
171171
return license;
172172
}
173173
}

0 commit comments

Comments
 (0)