[jboss-cvs] JBossAS SVN: r65178 - trunk/ejb3/src/main/org/jboss/ejb3/security.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Sep 6 13:18:14 EDT 2007
Author: anil.saldhana at jboss.com
Date: 2007-09-06 13:18:14 -0400 (Thu, 06 Sep 2007)
New Revision: 65178
Added:
trunk/ejb3/src/main/org/jboss/ejb3/security/NullInterceptor.java
Modified:
trunk/ejb3/src/main/org/jboss/ejb3/security/RoleBasedAuthorizationInterceptorFactory.java
Log:
return null action interceptor if no @SecurityDomain annotation injection has happened
Added: trunk/ejb3/src/main/org/jboss/ejb3/security/NullInterceptor.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/security/NullInterceptor.java (rev 0)
+++ trunk/ejb3/src/main/org/jboss/ejb3/security/NullInterceptor.java 2007-09-06 17:18:14 UTC (rev 65178)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.security;
+
+import org.jboss.aop.advice.Interceptor;
+import org.jboss.aop.joinpoint.Invocation;
+
+/**
+ * Null Action Interceptor
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision: 61136 $
+ */
+public class NullInterceptor implements Interceptor
+{
+ public String getName()
+ {
+ return NullInterceptor.class.getName();
+ }
+
+ public Object invoke(Invocation invocation) throws Throwable
+ {
+ return invocation.invokeNext();
+ }
+}
Modified: trunk/ejb3/src/main/org/jboss/ejb3/security/RoleBasedAuthorizationInterceptorFactory.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/security/RoleBasedAuthorizationInterceptorFactory.java 2007-09-06 17:01:26 UTC (rev 65177)
+++ trunk/ejb3/src/main/org/jboss/ejb3/security/RoleBasedAuthorizationInterceptorFactory.java 2007-09-06 17:18:14 UTC (rev 65178)
@@ -26,6 +26,7 @@
import javax.naming.InitialContext;
import javax.naming.NamingException;
+import org.jboss.annotation.security.SecurityDomain;
import org.jboss.aop.Advisor;
import org.jboss.aop.advice.AspectFactory;
import org.jboss.ejb3.Container;
@@ -51,7 +52,12 @@
try
{
InitialContext ctx = container.getInitialContext();
- org.jboss.annotation.security.SecurityDomain securityAnnotation = (org.jboss.annotation.security.SecurityDomain) advisor.resolveAnnotation(org.jboss.annotation.security.SecurityDomain.class);
+ SecurityDomain securityAnnotation = (SecurityDomain) advisor.resolveAnnotation(SecurityDomain.class);
+
+ //If there is no annotation, return a null action interceptor
+ if(securityAnnotation == null)
+ return new NullInterceptor();
+
domain = SecurityDomainManager.getSecurityManager(securityAnnotation.value(), ctx);
}
catch (NamingException e)
More information about the jboss-cvs-commits
mailing list