Skip to content

Commit

Permalink
JCR-4467: Remove all usage of java.security.acl.Group for Java 14
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/trunk@1866144 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
reschke committed Aug 30, 2019
1 parent 121539b commit b23af0d
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
/**
* The EveryonePrincipal contains all principals (excluding itself).
*/
public final class EveryonePrincipal implements java.security.acl.Group, GroupPrincipal, JackrabbitPrincipal {
public final class EveryonePrincipal implements GroupPrincipal, JackrabbitPrincipal {

public static final String NAME = "everyone";
private static final EveryonePrincipal INSTANCE = new EveryonePrincipal();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package org.apache.jackrabbit.core.security.principal;

import java.security.Principal;
import java.security.acl.Group;
import java.util.Collections;
import java.util.Enumeration;

Expand All @@ -41,7 +40,7 @@ private GroupPrincipals() {
* @return true if the principal is of type group.
*/
public static boolean isGroup(Principal principal) {
return principal instanceof Group || principal instanceof GroupPrincipal;
return principal instanceof GroupPrincipal;
}

/**
Expand All @@ -50,9 +49,6 @@ public static boolean isGroup(Principal principal) {
* @return an enumeration of the group members.
*/
public static Enumeration<? extends Principal> members(Principal principal) {
if (principal instanceof Group) {
return ((Group) principal).members();
}
if (principal instanceof GroupPrincipal) {
return ((GroupPrincipal) principal).members();
}
Expand All @@ -66,9 +62,6 @@ public static Enumeration<? extends Principal> members(Principal principal) {
* @return true if the principal is a member of this group, false otherwise.
*/
public static boolean isMember(Principal principal, Principal member) {
if (principal instanceof Group) {
return ((Group) principal).isMember(member);
}
if (principal instanceof GroupPrincipal) {
return ((GroupPrincipal) principal).isMember(member);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package org.apache.jackrabbit.core.security.principal;

import java.security.Principal;
import java.security.acl.Group;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
Expand Down Expand Up @@ -212,7 +211,7 @@ private Principal disguise(Principal principal, PrincipalProvider provider) {
* due to the fact, that the principal provider is not bound to a particular
* Session object.
*/
private class CheckedGroup implements Group, GroupPrincipal, JackrabbitPrincipal {
private class CheckedGroup implements GroupPrincipal, JackrabbitPrincipal {

final Principal delegatee;
private final PrincipalProvider provider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ static PropertySequence getPropertySequence(Node nMembers, UserManagerImpl userM
/**
* Principal Implementation
*/
private class NodeBasedGroup extends NodeBasedPrincipal implements java.security.acl.Group, GroupPrincipal {
private class NodeBasedGroup extends NodeBasedPrincipal implements GroupPrincipal {

private NodeBasedGroup(String name) {
super(name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@

import java.rmi.RemoteException;
import java.security.Principal;
import java.security.acl.Group;
import java.util.Enumeration;
import java.util.Iterator;

import org.apache.jackrabbit.api.security.principal.GroupPrincipal;
import org.apache.jackrabbit.rmi.client.LocalAdapterFactory;
import org.apache.jackrabbit.rmi.client.RemoteRuntimeException;
import org.apache.jackrabbit.rmi.remote.RemoteIterator;
Expand All @@ -38,7 +38,7 @@
* @see Group
* @see RemoteGroup
*/
public class ClientGroup extends ClientPrincipal implements Group {
public class ClientGroup extends ClientPrincipal implements GroupPrincipal {

private final LocalAdapterFactory factory;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@org.osgi.annotation.versioning.Version("3.1.0")
@org.osgi.annotation.versioning.Version("4.0.0")
package org.apache.jackrabbit.rmi.client.principal;
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

import java.rmi.RemoteException;
import java.security.Principal;
import java.security.acl.Group;
import java.util.Collections;
import java.util.Enumeration;
import java.util.Iterator;
Expand All @@ -32,7 +31,7 @@

public class ServerGroup extends ServerPrincipal implements RemoteGroup {

public ServerGroup(final Group principal, final RemoteAdapterFactory factory)
public ServerGroup(final GroupPrincipal principal, final RemoteAdapterFactory factory)
throws RemoteException {
super(principal, factory);
}
Expand Down Expand Up @@ -81,16 +80,13 @@ private static boolean isMember(final String memberName, final Principal group)
}

public static boolean isGroup(Principal principal) {
return principal instanceof Group || principal instanceof GroupPrincipal;
return principal instanceof GroupPrincipal;
}

private static Enumeration<? extends Principal> members(Principal principal) {
if (principal instanceof Group) {
return ((Group) principal).members();
}
if (principal instanceof GroupPrincipal) {
return ((GroupPrincipal) principal).members();
}
return Collections.emptyEnumeration();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@org.osgi.annotation.versioning.Version("3.1.0")
@org.osgi.annotation.versioning.Version("4.0.0")
package org.apache.jackrabbit.rmi.server.principal;

0 comments on commit b23af0d

Please sign in to comment.