tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jlmonte...@apache.org
Subject [1/2] tomee git commit: TOMEE-1487 implement an CDI event based realm
Date Thu, 08 Jan 2015 14:27:31 GMT
Repository: tomee
Updated Branches:
  refs/heads/develop a7006405b -> 82d7cd49b


TOMEE-1487 implement an CDI event based realm


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/82d7cd49
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/82d7cd49
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/82d7cd49

Branch: refs/heads/develop
Commit: 82d7cd49b13b61ef0d9f6381144f9564d0887974
Parents: 4b4447a
Author: Jean-Louis Monteiro <jeanouii@gmail.com>
Authored: Thu Jan 8 14:56:45 2015 +0100
Committer: Jean-Louis Monteiro <jeanouii@gmail.com>
Committed: Thu Jan 8 14:57:00 2015 +0100

----------------------------------------------------------------------
 .../tests/realm/CdiEventRealmIntegTest.java     |   7 +-
 .../tests/realm/CdiEventRealmTest.java          |  50 ++--------
 .../rest-jaas/src/main/webapp/WEB-INF/web.xml   |   3 +
 .../tomee/catalina/realm/CdiEventRealm.java     | 100 ++++++-------------
 .../event/FindSecurityConstraintsEvent.java     |  40 +++++---
 .../realm/event/HasResourcePermissionEvent.java |  63 ------------
 .../catalina/realm/event/HasRoleEvent.java      |  55 ----------
 .../realm/event/HasUserDataPermissionEvent.java |  55 ----------
 8 files changed, 70 insertions(+), 303 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/82d7cd49/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/realm/CdiEventRealmIntegTest.java
----------------------------------------------------------------------
diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/realm/CdiEventRealmIntegTest.java
b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/realm/CdiEventRealmIntegTest.java
index d8c1b06..e4dd363 100644
--- a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/realm/CdiEventRealmIntegTest.java
+++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/realm/CdiEventRealmIntegTest.java
@@ -55,7 +55,7 @@ public class CdiEventRealmIntegTest
         return ShrinkWrap.create(WebArchive.class, "realm-test.war")
                 .addClasses(MultiAuthenticator.class, MyService.class)
                 .addAsWebResource(EmptyAsset.INSTANCE, "beans.xml")
-                .addAsManifestResource(new StringAsset("<Context preemptive=\"true\" antiJARLocking=\"true\">\n"
+
+                .addAsManifestResource(new StringAsset("<Context preemptiveAuthentication=\"true\"
antiJARLocking=\"true\">\n" +
                         "<Valve className=\"" + BasicAuthenticator.class.getName() + "\"
/>\n" +
                         "<Realm className=\"" + CdiEventRealm.class.getName() + "\" />\n"
+
                         "</Context>"), "context.xml");
@@ -98,7 +98,7 @@ public class CdiEventRealmIntegTest
         @GET
         @RolesAllowed("admin")
         public String hello() {
-            return authenticator.stacked ? "ok" : "ko";
+            return authenticator.isStacked() ? "ok" : "ko";
         }
     }
 
@@ -107,8 +107,7 @@ public class CdiEventRealmIntegTest
         private boolean stacked = false;
 
         public void authenticate(@Observes final UserPasswordAuthenticationEvent event) {
-            System.err.println(">> enter > " + event.getUsername());
-            assertEquals("secret", event.getCredential());
+            if (!"secret".equals(event.getCredential())) return; // not authenticated
             event.setPrincipal(new GenericPrincipal(event.getUsername(), "", Arrays.asList(event.getUsername())));
         }
 

http://git-wip-us.apache.org/repos/asf/tomee/blob/82d7cd49/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/realm/CdiEventRealmTest.java
----------------------------------------------------------------------
diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/realm/CdiEventRealmTest.java
b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/realm/CdiEventRealmTest.java
index c9e1b9e..8c7aae6 100644
--- a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/realm/CdiEventRealmTest.java
+++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/realm/CdiEventRealmTest.java
@@ -17,22 +17,18 @@
 package org.apache.openejb.arquillian.tests.realm;
 
 import org.apache.catalina.Context;
-import org.apache.catalina.Wrapper;
 import org.apache.catalina.connector.Request;
-import org.apache.catalina.connector.Response;
 import org.apache.catalina.realm.GenericPrincipal;
 import org.apache.openejb.jee.WebApp;
 import org.apache.openejb.junit.ApplicationComposer;
 import org.apache.openejb.testing.Classes;
 import org.apache.openejb.testing.Module;
+import org.apache.tomcat.util.descriptor.web.SecurityCollection;
 import org.apache.tomcat.util.descriptor.web.SecurityConstraint;
 import org.apache.tomee.catalina.realm.CdiEventRealm;
 import org.apache.tomee.catalina.realm.event.DigestAuthenticationEvent;
 import org.apache.tomee.catalina.realm.event.FindSecurityConstraintsEvent;
 import org.apache.tomee.catalina.realm.event.GssAuthenticationEvent;
-import org.apache.tomee.catalina.realm.event.HasResourcePermissionEvent;
-import org.apache.tomee.catalina.realm.event.HasRoleEvent;
-import org.apache.tomee.catalina.realm.event.HasUserDataPermissionEvent;
 import org.apache.tomee.catalina.realm.event.SslAuthenticationEvent;
 import org.apache.tomee.catalina.realm.event.UserPasswordAuthenticationEvent;
 import org.ietf.jgss.GSSContext;
@@ -40,13 +36,11 @@ import org.junit.Test;
 import org.junit.runner.RunWith;
 
 import javax.enterprise.event.Observes;
-import java.io.IOException;
 import java.security.Principal;
 import java.security.cert.X509Certificate;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
-import java.util.concurrent.atomic.AtomicInteger;
 
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
@@ -111,18 +105,12 @@ public class CdiEventRealmTest {
     public void find() {
         final SecurityConstraint[] securityConstraints = new CdiEventRealm().findSecurityConstraints(mock(Request.class),
mock(Context.class));
         assertEquals(1, securityConstraints.length);
-        assertEquals("awesome", securityConstraints[0].getDisplayName());
-    }
-
-    @Test
-    public void has() throws IOException {
-        new CdiEventRealm().hasResourcePermission(mock(Request.class), mock(Response.class),
new SecurityConstraint[0], mock(Context.class));
-        new CdiEventRealm().hasRole(mock(Wrapper.class), mock(Principal.class), "admin");
-        new CdiEventRealm().hasUserDataPermission(mock(Request.class), mock(Response.class),
new SecurityConstraint[0]);
-
-        assertEquals(1, MultiAuthenticator.hasResourcePermission.get());
-        assertEquals(1, MultiAuthenticator.hasRole.get());
-        assertEquals(1, MultiAuthenticator.hasUserDataPermission.get());
+        final SecurityConstraint c = securityConstraints[0];
+        assertEquals("CONFIDENTIAL", c.getUserConstraint());
+        assertEquals(2, c.findAuthRoles().length);
+        assertEquals(1, c.findCollections().length);
+        SecurityCollection sc = c.findCollections()[0];
+        assertTrue(sc.findPattern("/*"));
     }
 
     private GenericPrincipal getGenericPrincipal(Principal principal) {
@@ -133,10 +121,6 @@ public class CdiEventRealmTest {
 
     public static class MultiAuthenticator {
 
-        public static final AtomicInteger hasRole = new AtomicInteger(0);
-        public static final AtomicInteger hasResourcePermission = new AtomicInteger(0);
-        public static final AtomicInteger hasUserDataPermission = new AtomicInteger(0);
-
         public void authenticate(@Observes final UserPasswordAuthenticationEvent event) {
             assertEquals("john", event.getUsername());
             assertEquals("secret", event.getCredential());
@@ -166,24 +150,8 @@ public class CdiEventRealmTest {
         }
 
         public void findSecurityConstraints(@Observes FindSecurityConstraintsEvent event)
{
-            SecurityConstraint mock = mock(SecurityConstraint.class);
-            when(mock.getDisplayName()).thenReturn("awesome");
-            event.addSecurityConstraint(mock);
-        }
-
-        public void hasResourcePermission(@Observes HasResourcePermissionEvent event) throws
IOException {
-            hasResourcePermission.incrementAndGet();
-            event.setHasResourcePermission(true);
-        }
-
-        public void hasRole(@Observes final HasRoleEvent event) {
-            hasRole.incrementAndGet();
-            event.setHasRole(true);
-        }
-
-        public void hasUserDataPermission(@Observes final HasUserDataPermissionEvent event)
throws IOException {
-            hasUserDataPermission.incrementAndGet();
-            event.setHasUserDataPermission(true);
+            event.addRoles("admin", "user");
+            event.setUserConstraint("CONFIDENTIAL");
         }
 
     }

http://git-wip-us.apache.org/repos/asf/tomee/blob/82d7cd49/examples/rest-jaas/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/examples/rest-jaas/src/main/webapp/WEB-INF/web.xml b/examples/rest-jaas/src/main/webapp/WEB-INF/web.xml
index 6e61ac2..1c6fb24 100644
--- a/examples/rest-jaas/src/main/webapp/WEB-INF/web.xml
+++ b/examples/rest-jaas/src/main/webapp/WEB-INF/web.xml
@@ -35,6 +35,9 @@
       <role-name>*</role-name>
       <!-- we'll use JAAS so don't filter too much here -->
     </auth-constraint>
+    <user-data-constraint>
+      <transport-guarantee>CONFIDENTIAL</transport-guarantee>
+    </user-data-constraint>
   </security-constraint>
 
   <security-role>

http://git-wip-us.apache.org/repos/asf/tomee/blob/82d7cd49/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/realm/CdiEventRealm.java
----------------------------------------------------------------------
diff --git a/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/realm/CdiEventRealm.java
b/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/realm/CdiEventRealm.java
index 33d1c6b..ce5725f 100644
--- a/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/realm/CdiEventRealm.java
+++ b/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/realm/CdiEventRealm.java
@@ -16,29 +16,20 @@
  */
 package org.apache.tomee.catalina.realm;
 
-import org.apache.catalina.Container;
 import org.apache.catalina.Context;
-import org.apache.catalina.CredentialHandler;
-import org.apache.catalina.Realm;
-import org.apache.catalina.Wrapper;
 import org.apache.catalina.connector.Request;
-import org.apache.catalina.connector.Response;
+import org.apache.catalina.realm.RealmBase;
+import org.apache.tomcat.util.descriptor.web.SecurityCollection;
 import org.apache.tomcat.util.descriptor.web.SecurityConstraint;
 import org.apache.tomee.catalina.realm.event.DigestAuthenticationEvent;
 import org.apache.tomee.catalina.realm.event.FindSecurityConstraintsEvent;
 import org.apache.tomee.catalina.realm.event.GssAuthenticationEvent;
-import org.apache.tomee.catalina.realm.event.HasResourcePermissionEvent;
-import org.apache.tomee.catalina.realm.event.HasRoleEvent;
-import org.apache.tomee.catalina.realm.event.HasUserDataPermissionEvent;
 import org.apache.tomee.catalina.realm.event.SslAuthenticationEvent;
 import org.apache.tomee.catalina.realm.event.UserPasswordAuthenticationEvent;
 import org.apache.webbeans.config.WebBeansContext;
 import org.ietf.jgss.GSSContext;
 
 import javax.enterprise.inject.spi.BeanManager;
-import java.beans.PropertyChangeListener;
-import java.beans.PropertyChangeSupport;
-import java.io.IOException;
 import java.security.Principal;
 import java.security.cert.X509Certificate;
 
@@ -47,12 +38,7 @@ import java.security.cert.X509Certificate;
  *
  * There is one different event per credential types to make it easier to implement.
  */
-public class CdiEventRealm implements Realm {
-
-    protected Container container = null;
-    protected final PropertyChangeSupport support = new PropertyChangeSupport(this);
-    private CredentialHandler credentialHandler;
-
+public class CdiEventRealm extends RealmBase {
 
     @Override
     public Principal authenticate(final String username, final String credentials) {
@@ -107,80 +93,52 @@ public class CdiEventRealm implements Realm {
 
     @Override
     public SecurityConstraint[] findSecurityConstraints(final Request request, final Context
context) {
-        if (beanManager() == null) {
-            return null;
-        }
-
-        final FindSecurityConstraintsEvent event = new FindSecurityConstraintsEvent(request,
context);
-        beanManager().fireEvent(event);
-        return event.getSecurityConstraints();
-    }
+        final SecurityConstraint[] sc = super.findSecurityConstraints(request, context);
 
-    @Override
-    public boolean hasResourcePermission(final Request request, final Response response,
-                                         final SecurityConstraint[] constraint,
-                                         final Context context) throws IOException {
         if (beanManager() == null) {
-            return false;
+            return sc;
         }
 
-        final HasResourcePermissionEvent event = new HasResourcePermissionEvent(request,
response, constraint, context);
+        final FindSecurityConstraintsEvent event = new FindSecurityConstraintsEvent(request.getRequest(),
context.getPath());
         beanManager().fireEvent(event);
-        return event.isHasResourcePermission();
-    }
 
-    @Override
-    public boolean hasRole(final Wrapper wrapper, final Principal principal, final String
role) {
-        if (beanManager() == null) {
-            return false;
-        }
+        if (!event.getRoles().isEmpty()) {
+            final SecurityConstraint s = new SecurityConstraint();
+            final SecurityCollection collection = new SecurityCollection();
 
-        final HasRoleEvent event = new HasRoleEvent(wrapper, principal, role);
-        beanManager().fireEvent(event);
-        return event.isHasRole();
-    }
+            collection.addPattern("/*"); // only for the current request
+            collection.addMethod(request.getMethod());
+            s.addCollection(collection);
 
-    @Override
-    public boolean hasUserDataPermission(final Request request, final Response response,
final SecurityConstraint[] constraint) throws IOException {
-        if (beanManager() == null) {
-            return false;
-        }
+            if (event.getUserConstraint() != null) {
+                s.setUserConstraint(event.getUserConstraint());
+            }
 
-        final HasUserDataPermissionEvent event = new HasUserDataPermissionEvent(request,
response, constraint);
-        beanManager().fireEvent(event);
-        return event.isHasUserDataPermission();
-    }
+            for(final String r: event.getRoles()) {
+                s.addAuthRole(r);
+            }
 
-    @Override
-    public Container getContainer() {
-        return (container);
-    }
-
-    @Override
-    public void setContainer(final Container container) {
-        Container oldContainer = this.container;
-        this.container = container;
-        support.firePropertyChange("container", oldContainer, this.container);
-    }
+            return new SecurityConstraint[] { s };
+        }
 
-    @Override
-    public CredentialHandler getCredentialHandler() {
-        return credentialHandler;
+        return sc;
     }
 
     @Override
-    public void setCredentialHandler(final CredentialHandler credentialHandler) {
-        this.credentialHandler = credentialHandler;
+    protected String getName() {
+        return "CdiEventRealm";
     }
 
     @Override
-    public void addPropertyChangeListener(final PropertyChangeListener listener) {
-        support.addPropertyChangeListener(listener);
+    protected String getPassword(final String username) {
+        // must never happen cause we overridden all authenticate() mthd
+        throw new UnsupportedOperationException();
     }
 
     @Override
-    public void removePropertyChangeListener(final PropertyChangeListener listener) {
-        support.removePropertyChangeListener(listener);
+    protected Principal getPrincipal(final String username) {
+        // must never happen cause we overridden all authenticate() mthd
+        throw new UnsupportedOperationException();
     }
 
     private BeanManager beanManager() {

http://git-wip-us.apache.org/repos/asf/tomee/blob/82d7cd49/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/realm/event/FindSecurityConstraintsEvent.java
----------------------------------------------------------------------
diff --git a/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/realm/event/FindSecurityConstraintsEvent.java
b/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/realm/event/FindSecurityConstraintsEvent.java
index 6d5b3fb..9ef4f8a 100644
--- a/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/realm/event/FindSecurityConstraintsEvent.java
+++ b/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/realm/event/FindSecurityConstraintsEvent.java
@@ -16,37 +16,49 @@
  */
 package org.apache.tomee.catalina.realm.event;
 
-import org.apache.catalina.Context;
-import org.apache.catalina.connector.Request;
-import org.apache.tomcat.util.descriptor.web.SecurityConstraint;
-
+import javax.servlet.ServletRequest;
+import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
 public class FindSecurityConstraintsEvent {
 
-    private final Request request;
-    private final Context context;
-    private List<SecurityConstraint> securityConstraints;
+    private final ServletRequest request;
+    private final String context;
+
+    private final List<String> roles = new ArrayList<>();
+    private String userConstraint;
 
-    public FindSecurityConstraintsEvent(final Request request, final Context context) {
+    public FindSecurityConstraintsEvent(final ServletRequest request, final String context)
{
         this.request = request;
         this.context = context;
     }
 
-    public Request getRequest() {
+    public ServletRequest getRequest() {
         return request;
     }
 
-    public Context getContext() {
+    public String getContext() {
         return context;
     }
 
-    public boolean addSecurityConstraint(final SecurityConstraint constraint) {
-        return securityConstraints.add(constraint);
+    public List<String> getRoles() {
+        return roles;
     }
 
-    public SecurityConstraint[] getSecurityConstraints() {
-        return securityConstraints.toArray(new SecurityConstraint[securityConstraints.size()]);
+    public FindSecurityConstraintsEvent addRoles(final String... roles) {
+        this.roles.addAll(Arrays.asList(roles));
+        return this;
     }
 
+    public void setUserConstraint(String userConstraint) {
+        if (this.userConstraint != null && !this.userConstraint.equals(userConstraint))
{
+            throw new IllegalStateException("User constraint already set to > " + this.userConstraint);
+        }
+        this.userConstraint = userConstraint;
+    }
+
+    public String getUserConstraint() {
+        return userConstraint;
+    }
 }

http://git-wip-us.apache.org/repos/asf/tomee/blob/82d7cd49/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/realm/event/HasResourcePermissionEvent.java
----------------------------------------------------------------------
diff --git a/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/realm/event/HasResourcePermissionEvent.java
b/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/realm/event/HasResourcePermissionEvent.java
deleted file mode 100644
index 2698874..0000000
--- a/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/realm/event/HasResourcePermissionEvent.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tomee.catalina.realm.event;
-
-import org.apache.catalina.Context;
-import org.apache.catalina.connector.Request;
-import org.apache.catalina.connector.Response;
-import org.apache.tomcat.util.descriptor.web.SecurityConstraint;
-
-public class HasResourcePermissionEvent {
-
-    private final Request request;
-    private final Response response;
-    private final SecurityConstraint[] constraints;
-    private final Context context;
-
-    private boolean hasResourcePermission;
-
-    public HasResourcePermissionEvent(final Request request, final Response response, final
SecurityConstraint[] constraints, final Context context) {
-        this.request = request;
-        this.response = response;
-        this.constraints = constraints;
-        this.context = context;
-    }
-
-    public Request getRequest() {
-        return request;
-    }
-
-    public Response getResponse() {
-        return response;
-    }
-
-    public SecurityConstraint[] getConstraints() {
-        return constraints;
-    }
-
-    public Context getContext() {
-        return context;
-    }
-
-    public boolean isHasResourcePermission() {
-        return hasResourcePermission;
-    }
-
-    public void setHasResourcePermission(boolean hasResourcePermission) {
-        this.hasResourcePermission = hasResourcePermission;
-    }
-}

http://git-wip-us.apache.org/repos/asf/tomee/blob/82d7cd49/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/realm/event/HasRoleEvent.java
----------------------------------------------------------------------
diff --git a/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/realm/event/HasRoleEvent.java
b/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/realm/event/HasRoleEvent.java
deleted file mode 100644
index 4ca152d..0000000
--- a/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/realm/event/HasRoleEvent.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tomee.catalina.realm.event;
-
-import org.apache.catalina.Wrapper;
-
-import java.security.Principal;
-
-public class HasRoleEvent {
-    private final Wrapper wrapper;
-    private final Principal principal;
-    private final String role;
-
-    private boolean hasRole;
-
-    public HasRoleEvent(final Wrapper wrapper, final Principal principal, final String role)
{
-        this.wrapper = wrapper;
-        this.principal = principal;
-        this.role = role;
-    }
-
-    public Wrapper getWrapper() {
-        return wrapper;
-    }
-
-    public Principal getPrincipal() {
-        return principal;
-    }
-
-    public String getRole() {
-        return role;
-    }
-
-    public boolean isHasRole() {
-        return hasRole;
-    }
-
-    public void setHasRole(boolean hasRole) {
-        this.hasRole = hasRole;
-    }
-}

http://git-wip-us.apache.org/repos/asf/tomee/blob/82d7cd49/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/realm/event/HasUserDataPermissionEvent.java
----------------------------------------------------------------------
diff --git a/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/realm/event/HasUserDataPermissionEvent.java
b/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/realm/event/HasUserDataPermissionEvent.java
deleted file mode 100644
index f4f2a51..0000000
--- a/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/realm/event/HasUserDataPermissionEvent.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tomee.catalina.realm.event;
-
-import org.apache.catalina.connector.Request;
-import org.apache.catalina.connector.Response;
-import org.apache.tomcat.util.descriptor.web.SecurityConstraint;
-
-public class HasUserDataPermissionEvent {
-    private final Request request;
-    private final Response response;
-    private final SecurityConstraint[] constraint;
-
-    private boolean hasUserDataPermission;
-
-    public HasUserDataPermissionEvent(final Request request, final Response response, final
SecurityConstraint[] constraint) {
-        this.request = request;
-        this.response = response;
-        this.constraint = constraint;
-    }
-
-    public Request getRequest() {
-        return request;
-    }
-
-    public Response getResponse() {
-        return response;
-    }
-
-    public SecurityConstraint[] getConstraint() {
-        return constraint;
-    }
-
-    public boolean isHasUserDataPermission() {
-        return hasUserDataPermission;
-    }
-
-    public void setHasUserDataPermission(boolean hasUserDataPermission) {
-        this.hasUserDataPermission = hasUserDataPermission;
-    }
-}


Mime
View raw message