Skip to content

Commit 4d2572a

Browse files
committed
Build with Java 25ea
Update actions to v5 Use Maven 3.9.11 Get rid of oak-security-spi dependency at compile time
1 parent 7e731f1 commit 4d2572a

File tree

12 files changed

+101
-40
lines changed

12 files changed

+101
-40
lines changed

.github/workflows/maven.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
strategy:
1313
matrix:
1414
os: [ubuntu-latest, windows-latest, macOS-latest]
15-
jdk: [11, 17, 21]
15+
jdk: [11, 17, 21, 25-ea]
1616
include:
1717
# lengthy build steps should only be performed on linux with Java 17 (Sonarcloud analysis, deployment)
1818
- os: ubuntu-latest
@@ -25,10 +25,10 @@ jobs:
2525

2626
steps:
2727
- name: Checkout
28-
uses: actions/checkout@v3
28+
uses: actions/checkout@v5
2929

3030
- name: Set up JDK
31-
uses: actions/setup-java@v3
31+
uses: actions/setup-java@v5
3232
with:
3333
distribution: 'temurin'
3434
java-version: ${{ matrix.jdk }}

.mvn/wrapper/maven-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616
# under the License.
1717
wrapperVersion=3.3.2
1818
distributionType=only-script
19-
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip
19+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.11/apache-maven-3.9.11-bin.zip

accesscontroltool-bundle/pom.xml

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
<properties>
2727
<tomcat.el.version>10.1.44</tomcat.el.version>
28-
<oak.testing.version>1.48.0</oak.testing.version><!-- ITs require a newer version of Oak otherwise it won't work with Java 11 and certain classes for running the IT are not available -->
28+
<oak.testing.version>1.74.0</oak.testing.version><!-- ITs require a newer version of Oak otherwise it won't work with Java 23+ (https://issues.apache.org/jira/browse/OAK-11199) and certain classes for running the IT are not available -->
2929

3030
</properties>
3131

@@ -168,18 +168,7 @@
168168
<artifactId>org.apache.sling.hc.api</artifactId>
169169
<scope>provided</scope>
170170
</dependency>
171-
<!-- mainly constants and some principal impls -->
172-
<dependency>
173-
<groupId>org.apache.jackrabbit</groupId>
174-
<artifactId>oak-security-spi</artifactId>
175-
<scope>provided</scope>
176-
<exclusions>
177-
<exclusion>
178-
<groupId>*</groupId>
179-
<artifactId>*</artifactId>
180-
</exclusion>
181-
</exclusions>
182-
</dependency>
171+
<!-- API for creating external groups (those which are connected to LDAP/IDP) -->
183172
<dependency>
184173
<groupId>org.apache.jackrabbit</groupId>
185174
<artifactId>oak-auth-external</artifactId>

accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/aceinstaller/AceBeanInstallerClassic.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
import org.apache.commons.lang3.StringUtils;
3636
import org.apache.jackrabbit.api.security.JackrabbitAccessControlEntry;
3737
import org.apache.jackrabbit.api.security.JackrabbitAccessControlList;
38-
import org.apache.jackrabbit.oak.spi.security.principal.PrincipalImpl;
3938
import org.osgi.service.component.annotations.Component;
4039
import org.slf4j.Logger;
4140
import org.slf4j.LoggerFactory;
@@ -45,6 +44,7 @@
4544
import biz.netcentric.cq.tools.actool.helper.AccessControlUtils;
4645
import biz.netcentric.cq.tools.actool.helper.RestrictionsHolder;
4746
import biz.netcentric.cq.tools.actool.history.InstallationLogger;
47+
import biz.netcentric.cq.tools.actool.impl.SimpleNamePrincipal;
4848

4949
/** The way ACEs were installed in version one is still available and can be configured in "global_config" section by setting
5050
* "installAclsIncrementally=false". */
@@ -71,7 +71,7 @@ protected void installAcl(Set<AceBean> aceBeanSetFromConfig, String path, Set<St
7171

7272
LOG.debug("Writing bean to repository {}", bean);
7373

74-
Principal currentPrincipal = new PrincipalImpl(bean.getPrincipalName());
74+
Principal currentPrincipal = new SimpleNamePrincipal(bean.getPrincipalName());
7575
installAce(bean, session, currentPrincipal, installLog);
7676

7777
}

accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/aceinstaller/AceBeanInstallerIncremental.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040

4141
import org.apache.commons.lang3.StringUtils;
4242
import org.apache.jackrabbit.api.security.JackrabbitAccessControlList;
43-
import org.apache.jackrabbit.oak.spi.security.principal.PrincipalImpl;
4443
import org.apache.sling.jcr.api.SlingRepository;
4544
import org.osgi.service.component.annotations.Component;
4645
import org.osgi.service.component.annotations.Reference;
@@ -54,6 +53,7 @@
5453
import biz.netcentric.cq.tools.actool.helper.AcHelper;
5554
import biz.netcentric.cq.tools.actool.helper.AccessControlUtils;
5655
import biz.netcentric.cq.tools.actool.history.InstallationLogger;
56+
import biz.netcentric.cq.tools.actool.impl.SimpleNamePrincipal;
5757

5858
@Component
5959
public class AceBeanInstallerIncremental extends BaseAceBeanInstaller implements AceBeanInstaller {
@@ -146,7 +146,7 @@ protected void installAcl(Set<AceBean> aceBeanSetFromConfig, String path, Set<St
146146
for (int i = currentPositionConfig; i < configuredAceEntries.size(); i++) {
147147
AceBean aceBeanToAppend = configuredAceEntries.get(i);
148148

149-
installPrivileges(aceBeanToAppend, new PrincipalImpl(aceBeanToAppend.getPrincipalName()), acl, session, acMgr);
149+
installPrivileges(aceBeanToAppend, new SimpleNamePrincipal(aceBeanToAppend.getPrincipalName()), acl, session, acMgr);
150150
diffLog.append(" APPENDED (from Config) " + toAceCompareString(aceBeanToAppend, acMgr) + "\n");
151151

152152
countAdded++;
@@ -358,7 +358,7 @@ Set<AceBean> getPrincipalAceBeansForActionAceBean(AceBean origAceBean, Session s
358358

359359
Principal getTestActionMapperPrincipal() {
360360
String groupPrincipalId = "actool-tester-action-mapper"; // does not have to exist since the ACEs for it are not saved
361-
Principal principal = new PrincipalImpl(groupPrincipalId);
361+
Principal principal = new SimpleNamePrincipal(groupPrincipalId);
362362
return principal;
363363
}
364364

accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/authorizableinstaller/impl/AuthInstallerUserManagerPrefetchingImpl.java

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
import org.apache.jackrabbit.api.security.user.QueryBuilder;
3636
import org.apache.jackrabbit.api.security.user.User;
3737
import org.apache.jackrabbit.api.security.user.UserManager;
38-
import org.apache.jackrabbit.oak.spi.security.user.UserConstants;
3938
import org.slf4j.Logger;
4039
import org.slf4j.LoggerFactory;
4140

@@ -68,6 +67,18 @@ class AuthInstallerUserManagerPrefetchingImpl implements AuthInstallerUserManage
6867

6968
private static final Logger LOG = LoggerFactory.getLogger(AuthInstallerUserManagerPrefetchingImpl.class);
7069

70+
/**
71+
* Node type used for system users in Oak/JR2.
72+
* Defined for Oak in {@code org.apache.jackrabbit.oak.spi.security.user.UserConstants.NT_REP_SYSTEM_USER}.
73+
*/
74+
private static final String NT_REP_SYSTEM_USER = "rep:SystemUser";
75+
76+
/**
77+
* Node type used for groups in Oak/JR2.
78+
* Defined for Oak in {@code org.apache.jackrabbit.oak.spi.security.user.UserConstants.NT_REP_GROUP}.
79+
*/
80+
private static final String NT_REP_GROUP = "rep:Group";
81+
7182
private final UserManager delegate;
7283

7384
private final Map<String, Set<String>> nonRegularUserMembersByAuthorizableId = new CaseInsensitiveMap<>();
@@ -83,8 +94,8 @@ public AuthInstallerUserManagerPrefetchingImpl(UserManager delegate, final Value
8394
public <T> void build(QueryBuilder<T> builder) {
8495
builder.setCondition(
8596
builder.or(
86-
builder.eq("@" + JcrConstants.JCR_PRIMARYTYPE, valueFactory.createValue(UserConstants.NT_REP_SYSTEM_USER)),
87-
builder.eq("@" + JcrConstants.JCR_PRIMARYTYPE, valueFactory.createValue(UserConstants.NT_REP_GROUP))
97+
builder.eq("@" + JcrConstants.JCR_PRIMARYTYPE, valueFactory.createValue(NT_REP_SYSTEM_USER)),
98+
builder.eq("@" + JcrConstants.JCR_PRIMARYTYPE, valueFactory.createValue(NT_REP_GROUP))
8899
)
89100
);
90101
}
@@ -100,7 +111,7 @@ public <T> void build(QueryBuilder<T> builder) {
100111
authorizableIdsAndPaths.put(auth.getID(), auth.getPath());
101112
}
102113

103-
Authorizable anonymous = delegate.getAuthorizable(UserConstants.DEFAULT_ANONYMOUS_ID);
114+
Authorizable anonymous = delegate.getAuthorizable(Constants.USER_ANONYMOUS);
104115
if (anonymous != null) {
105116
membershipCount += prefetchAuthorizable(anonymous);
106117
authorizableIdsAndPaths.put(anonymous.getID(), anonymous.getPath());

accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/authorizableinstaller/impl/AuthorizableInstallerServiceImpl.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import java.io.IOException;
2020
import java.security.GeneralSecurityException;
21+
import java.security.Principal;
2122
import java.security.cert.Certificate;
2223
import java.util.Arrays;
2324
import java.util.Collection;
@@ -45,7 +46,6 @@
4546
import org.apache.jackrabbit.api.security.user.AuthorizableExistsException;
4647
import org.apache.jackrabbit.api.security.user.Group;
4748
import org.apache.jackrabbit.api.security.user.User;
48-
import org.apache.jackrabbit.oak.spi.security.principal.PrincipalImpl;
4949
import org.apache.sling.api.SlingIOException;
5050
import org.apache.sling.api.resource.LoginException;
5151
import org.apache.sling.api.resource.PersistenceException;
@@ -79,6 +79,7 @@
7979
import biz.netcentric.cq.tools.actool.helper.Constants;
8080
import biz.netcentric.cq.tools.actool.helper.ContentHelper;
8181
import biz.netcentric.cq.tools.actool.history.InstallationLogger;
82+
import biz.netcentric.cq.tools.actool.impl.SimpleNamePrincipal;
8283

8384
@org.osgi.service.component.annotations.Component()
8485
public class AuthorizableInstallerServiceImpl implements
@@ -705,7 +706,7 @@ private Authorizable createNewGroup(
705706
LOG.info("Successfully created new external group: {}", groupID);
706707
} else {
707708

708-
PrincipalImpl principalForNewGroup = new PrincipalImpl(groupID);
709+
Principal principalForNewGroup = new SimpleNamePrincipal(groupID);
709710
if (StringUtils.isNotBlank(intermediatePath)) {
710711
newGroup = userManager.createGroup(principalForNewGroup, intermediatePath);
711712
} else {
@@ -841,7 +842,7 @@ private Authorizable createNewUser(
841842
}
842843
newUser = userManager.createSystemUser(authorizableId, intermediatePath);
843844
} else {
844-
newUser = userManager.createUser(authorizableId, password, new PrincipalImpl(authorizableId), intermediatePath);
845+
newUser = userManager.createUser(authorizableId, password, new SimpleNamePrincipal(authorizableId), intermediatePath);
845846
}
846847
setAuthorizableProperties(newUser, principalConfigBean, authorizablesConfig, session, installLog);
847848

accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/authorizableinstaller/impl/ImpersonationInstallerServiceImpl.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@
2525
import org.apache.jackrabbit.api.security.principal.PrincipalIterator;
2626
import org.apache.jackrabbit.api.security.user.Impersonation;
2727
import org.apache.jackrabbit.api.security.user.User;
28-
import org.apache.jackrabbit.oak.spi.security.principal.PrincipalImpl;
2928
import org.osgi.service.component.annotations.Component;
3029
import org.slf4j.Logger;
3130
import org.slf4j.LoggerFactory;
3231

3332
import biz.netcentric.cq.tools.actool.configmodel.AuthorizableConfigBean;
3433
import biz.netcentric.cq.tools.actool.configmodel.AuthorizablesConfig;
3534
import biz.netcentric.cq.tools.actool.history.InstallationLogger;
35+
import biz.netcentric.cq.tools.actool.impl.SimpleNamePrincipal;
3636

3737
/** Installs impersonators to users. */
3838
@Component(service = ImpersonationInstallerServiceImpl.class)
@@ -61,7 +61,7 @@ private void applyChanges(User user, InstallationLogger installationLog, List<St
6161
Iterator<String> impersonatorsToAddIt = impersonatorsToAdd.iterator();
6262
while (impersonatorsToAddIt.hasNext()) {
6363
String impersonatorToAdd = impersonatorsToAddIt.next();
64-
boolean success = impersonation.grantImpersonation(new PrincipalImpl(impersonatorToAdd));
64+
boolean success = impersonation.grantImpersonation(new SimpleNamePrincipal(impersonatorToAdd));
6565
if (!success) {
6666
impersonatorsToAddIt.remove();
6767
installationLog.addWarning(LOG, "Impersonator '" + impersonatorToAdd + "' can not be added to user " + user);
@@ -74,7 +74,7 @@ private void applyChanges(User user, InstallationLogger installationLog, List<St
7474
Iterator<String> impersonatorsToRemoveIt = impersonatorsToRemove.iterator();
7575
while (impersonatorsToRemoveIt.hasNext()) {
7676
String impersonatorToRemove = impersonatorsToRemoveIt.next();
77-
boolean success = impersonation.revokeImpersonation(new PrincipalImpl(impersonatorToRemove));
77+
boolean success = impersonation.revokeImpersonation(new SimpleNamePrincipal(impersonatorToRemove));
7878
if (!success) {
7979
impersonatorsToRemoveIt.remove();
8080
installationLog.addWarning(LOG, "Impersonator '" + impersonatorToRemove + "' can not be removed from user " + user);

accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/dumpservice/impl/DumpServiceImpl.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@
5454
import org.apache.jackrabbit.api.security.user.QueryBuilder.Direction;
5555
import org.apache.jackrabbit.api.security.user.User;
5656
import org.apache.jackrabbit.api.security.user.UserManager;
57-
import org.apache.jackrabbit.oak.spi.security.principal.EveryonePrincipal;
58-
import org.apache.jackrabbit.oak.spi.security.principal.PrincipalImpl;
5957
import org.apache.jackrabbit.util.Text;
6058
import org.apache.sling.jcr.api.SlingRepository;
6159
import org.osgi.service.component.annotations.Activate;
@@ -87,6 +85,7 @@
8785
import biz.netcentric.cq.tools.actool.helper.Constants;
8886
import biz.netcentric.cq.tools.actool.helper.QueryHelper;
8987
import biz.netcentric.cq.tools.actool.history.impl.HistoryUtils;
88+
import biz.netcentric.cq.tools.actool.impl.SimpleNamePrincipal;
9089

9190
@Component
9291
@Designate(ocd=Configuration.class)
@@ -308,7 +307,7 @@ private Set<User> getUsersFromAces(int mapOrder, Session session,
308307
userIds = aclDumpMap.keySet();
309308

310309
for (String id : userIds) {
311-
Authorizable authorizable = um.getAuthorizable(new PrincipalImpl(id));
310+
Authorizable authorizable = um.getAuthorizable(new SimpleNamePrincipal(id));
312311
if (!authorizable.isGroup()) {
313312
User user = (User) authorizable;
314313
usersFromACEs.add(user);
@@ -322,7 +321,7 @@ private Set<User> getUsersFromAces(int mapOrder, Session session,
322321

323322
for (AceBean aceBean : aceBeanSet) {
324323
String principalId = aceBean.getPrincipalName();
325-
Authorizable authorizable = um.getAuthorizable(new PrincipalImpl(principalId));
324+
Authorizable authorizable = um.getAuthorizable(new SimpleNamePrincipal(principalId));
326325
if (!authorizable.isGroup()) {
327326
User user = (User) authorizable;
328327
usersFromACEs.add(user);
@@ -438,7 +437,7 @@ public AceDumpData createAclDumpMap(final int keyOrder, final int aclOrdering,
438437
}
439438
}
440439

441-
Authorizable authorizable = um.getAuthorizable(new PrincipalImpl(tmpAceBean.getPrincipalName()));
440+
Authorizable authorizable = um.getAuthorizable(new SimpleNamePrincipal(tmpAceBean.getPrincipalName()));
442441

443442
// if this group exists under home
444443
if (authorizable != null) {
@@ -593,7 +592,7 @@ private void addDeclaredMembers(Authorizable authorizable,
593592

594593
while (it.hasNext()) {
595594
String groupId = it.next().getID();
596-
if (StringUtils.equals(groupId, EveryonePrincipal.NAME)) {
595+
if (StringUtils.equals(groupId, Constants.PRINCIPAL_EVERYONE)) {
597596
continue;
598597
}
599598
memberOfList.add(groupId);

accesscontroltool-bundle/src/main/java/biz/netcentric/cq/tools/actool/helper/Constants.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,14 @@ private Constants() {
3838
ACE_CONFIGURATION_KEY,
3939
OBSOLETE_AUTHORIZABLES_KEY));
4040

41+
/**
42+
* Default user ID for the anonymous user in Oak/JR2.
43+
* Defined for Oak in {@code org.apache.jackrabbit.oak.spi.security.user.UserConstants.DEFAULT_ANONYMOUS_ID}.
44+
*/
4145
public static final String USER_ANONYMOUS = "anonymous";
46+
/**
47+
* Principal name for the everyone principal in Oak/JR2.
48+
*/
4249
public static final String PRINCIPAL_EVERYONE = "everyone";
4350

4451
public static final String GROUPS_ROOT = "/home/groups";

0 commit comments

Comments
 (0)