[JBoss-dev] CVS update: jbosstest/src/main/org/jboss/test/security/ejb EntityBeanImpl.java RunAsMDB.java StatelessSessionBean2.java StatelessSessionBean3.java
User: user57 Date: 02/02/16 03:27:02 Modified:src/main/org/jboss/test/security/ejb EntityBeanImpl.java RunAsMDB.java StatelessSessionBean2.java StatelessSessionBean3.java Log: o System.err, System.out printStackTrace() 99.9% gone. Revision ChangesPath 1.7 +2 -2 jbosstest/src/main/org/jboss/test/security/ejb/EntityBeanImpl.java Index: EntityBeanImpl.java === RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/security/ejb/EntityBeanImpl.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- EntityBeanImpl.java 15 Feb 2002 06:15:55 - 1.6 +++ EntityBeanImpl.java 16 Feb 2002 11:27:02 - 1.7 @@ -17,7 +17,7 @@ using the echo method. @author [EMAIL PROTECTED] -@version $Revision: 1.6 $ +@version $Revision: 1.7 $ */ public class EntityBeanImpl implements EntityBean { @@ -82,7 +82,7 @@ } catch(NamingException e) { - e.printStackTrace(); + log.debug(failed, e); throw new EJBException(Naming exception: +e.toString(true)); } return p.getName(); 1.5 +2 -2 jbosstest/src/main/org/jboss/test/security/ejb/RunAsMDB.java Index: RunAsMDB.java === RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/security/ejb/RunAsMDB.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- RunAsMDB.java 15 Feb 2002 06:15:55 - 1.4 +++ RunAsMDB.java 16 Feb 2002 11:27:02 - 1.5 @@ -23,7 +23,7 @@ the InternalRole assigned in the MDB descriptor run-as element. @author [EMAIL PROTECTED] - @version $Revision: 1.4 $ + @version $Revision: 1.5 $ */ public class RunAsMDB implements MessageDrivenBean, MessageListener { @@ -73,7 +73,7 @@ } catch(Throwable e) { - e.printStackTrace(); + log.debug(failed, e); } } } 1.5 +3 -3 jbosstest/src/main/org/jboss/test/security/ejb/StatelessSessionBean2.java Index: StatelessSessionBean2.java === RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/security/ejb/StatelessSessionBean2.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- StatelessSessionBean2.java15 Feb 2002 06:15:55 - 1.4 +++ StatelessSessionBean2.java16 Feb 2002 11:27:02 - 1.5 @@ -17,7 +17,7 @@ identity propagation. @author [EMAIL PROTECTED] -@version $Revision: 1.4 $ +@version $Revision: 1.5 $ */ public class StatelessSessionBean2 implements SessionBean { @@ -66,7 +66,7 @@ } catch(Exception e) { -e.printStackTrace(); +log.debug(failed, e); e.fillInStackTrace(); throw new EJBException(e); } @@ -86,7 +86,7 @@ } catch(Exception e) { -e.printStackTrace(); +log.debug(failed, e); e.fillInStackTrace(); throw new EJBException(e); } 1.3 +3 -3 jbosstest/src/main/org/jboss/test/security/ejb/StatelessSessionBean3.java Index: StatelessSessionBean3.java === RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/security/ejb/StatelessSessionBean3.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- StatelessSessionBean3.java15 Feb 2002 06:15:55 - 1.2 +++ StatelessSessionBean3.java16 Feb 2002 11:27:02 - 1.3 @@ -19,7 +19,7 @@ remote interface. @author [EMAIL PROTECTED] -@version $Revision: 1.2 $ +@version $Revision: 1.3 $ */ public class StatelessSessionBean3 implements SessionBean { @@ -73,7 +73,7 @@ } catch(Exception e) { -e.printStackTrace(); +log.debug(failed, e); e.fillInStackTrace(); throw new EJBException(e); } @@ -93,7 +93,7 @@ } catch(Exception e) { -e.printStackTrace(); +log.debug(failed, e); e.fillInStackTrace(); throw new EJBException(e); } ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jbosstest/src/main/org/jboss/test/security/ejb EntityBeanImpl.java RunAsMDB.java
User: user57 Date: 01/07/30 23:14:06 Modified:src/main/org/jboss/test/security/ejb Tag: jboss_buildmagic EntityBeanImpl.java RunAsMDB.java Log: o updated from HEAD Revision ChangesPath No revision No revision 1.4.2.1 +2 -24 jbosstest/src/main/org/jboss/test/security/ejb/EntityBeanImpl.java Index: EntityBeanImpl.java === RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/security/ejb/EntityBeanImpl.java,v retrieving revision 1.4 retrieving revision 1.4.2.1 diff -u -r1.4 -r1.4.2.1 --- EntityBeanImpl.java 2001/07/14 16:02:43 1.4 +++ EntityBeanImpl.java 2001/07/31 06:14:06 1.4.2.1 @@ -17,7 +17,7 @@ using the echo method. @author [EMAIL PROTECTED] -@version $Revision: 1.4 $ +@version $Revision: 1.4.2.1 $ */ public class EntityBeanImpl implements EntityBean { @@ -73,32 +73,10 @@ if( securityMgr == null ) throw new EJBException(Failed to find security mgr under: java:comp/env/security/security-domain); System.out.println(Found SecurityManager: +securityMgr); - /* I'm using this runtime introspection to determin if the security -manager supports a getActiveSubject() method because the -org.jboss.security.SubjectSecurityManager interface is not part of -the standard client jars which are used to build the jbosstest suite. -Not legal EJB code, but this is test code. -*/ - Class securityMgrClass = securityMgr.getClass(); - Class[] parameterTypes = {}; - Method getActiveSubject = securityMgrClass.getDeclaredMethod(getActiveSubject, parameterTypes); - Object[] args = {}; - Subject activeSubject = (Subject) getActiveSubject.invoke(securityMgr, args); + Subject activeSubject = (Subject) ctx.lookup(java:comp/env/security/subject); System.out.println(ActiveSubject: +activeSubject); if( activeSubject == null ) throw new EJBException(No ActiveSubject found); -} -catch(NoSuchMethodException e) -{ - // Ok, not a SubjectSecurityManager -} -catch(InvocationTargetException e) -{ - // Ok, not a SubjectSecurityManager -} -catch(IllegalAccessException e) -{ - // Ok, not a SubjectSecurityManager } catch(NamingException e) { 1.2.2.1 +77 -77jbosstest/src/main/org/jboss/test/security/ejb/RunAsMDB.java Index: RunAsMDB.java === RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/security/ejb/RunAsMDB.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- RunAsMDB.java 2001/07/09 20:20:48 1.2 +++ RunAsMDB.java 2001/07/31 06:14:06 1.2.2.1 @@ -1,77 +1,77 @@ -/* - * jBoss, the OpenSource EJB server - * - * Distributable under LGPL license. - * See terms of license at gnu.org. - */ -package org.jboss.test.security.ejb; - -import javax.ejb.MessageDrivenBean; -import javax.ejb.MessageDrivenContext; -import javax.ejb.EJBException; -import javax.jms.Destination; -import javax.jms.MessageListener; -import javax.jms.Message; -import javax.naming.InitialContext; -import javax.naming.NamingException; - -import org.jboss.test.security.interfaces.Entity; -import org.jboss.test.security.interfaces.EntityHome; - -/** An MDB that takes the string from the msg passed to onMessage - and invokes the echo(String) method on an internal Entity using - the InternalRole assigned in the MDB descriptor run-as element. - - @author [EMAIL PROTECTED] - @version $Revision: 1.2 $ - */ -public class RunAsMDB implements MessageDrivenBean, MessageListener -{ - private MessageDrivenContext ctx = null; - private InitialContext iniCtx; - - public RunAsMDB() - { - } - - public void setMessageDrivenContext(MessageDrivenContext ctx) - throws EJBException - { - this.ctx = ctx; - try - { - iniCtx = new InitialContext(); - } - catch(NamingException e) - { - throw new EJBException(e); - } - } - - public void ejbCreate() - { - } - - public void ejbRemove() - { - ctx = null; - } - - public void onMessage(Message message) - { - try - { - String arg = message.getStringProperty(arg); - EntityHome home = (EntityHome) iniCtx.lookup(java:comp/env/ejb/Entity); - Entity bean = home.findByPrimaryKey(arg); - String
[JBoss-dev] CVS update: jbosstest/src/main/org/jboss/test/security/ejb EntityBeanImpl.java RunAsMDB.java
User: starksm Date: 01/07/25 19:55:35 Modified:src/main/org/jboss/test/security/ejb EntityBeanImpl.java RunAsMDB.java Log: Update active subject access test Revision ChangesPath 1.5 +2 -24 jbosstest/src/main/org/jboss/test/security/ejb/EntityBeanImpl.java Index: EntityBeanImpl.java === RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/security/ejb/EntityBeanImpl.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- EntityBeanImpl.java 2001/07/14 16:02:43 1.4 +++ EntityBeanImpl.java 2001/07/26 02:55:35 1.5 @@ -17,7 +17,7 @@ using the echo method. @author [EMAIL PROTECTED] -@version $Revision: 1.4 $ +@version $Revision: 1.5 $ */ public class EntityBeanImpl implements EntityBean { @@ -73,32 +73,10 @@ if( securityMgr == null ) throw new EJBException(Failed to find security mgr under: java:comp/env/security/security-domain); System.out.println(Found SecurityManager: +securityMgr); - /* I'm using this runtime introspection to determin if the security -manager supports a getActiveSubject() method because the -org.jboss.security.SubjectSecurityManager interface is not part of -the standard client jars which are used to build the jbosstest suite. -Not legal EJB code, but this is test code. -*/ - Class securityMgrClass = securityMgr.getClass(); - Class[] parameterTypes = {}; - Method getActiveSubject = securityMgrClass.getDeclaredMethod(getActiveSubject, parameterTypes); - Object[] args = {}; - Subject activeSubject = (Subject) getActiveSubject.invoke(securityMgr, args); + Subject activeSubject = (Subject) ctx.lookup(java:comp/env/security/subject); System.out.println(ActiveSubject: +activeSubject); if( activeSubject == null ) throw new EJBException(No ActiveSubject found); -} -catch(NoSuchMethodException e) -{ - // Ok, not a SubjectSecurityManager -} -catch(InvocationTargetException e) -{ - // Ok, not a SubjectSecurityManager -} -catch(IllegalAccessException e) -{ - // Ok, not a SubjectSecurityManager } catch(NamingException e) { 1.3 +77 -77jbosstest/src/main/org/jboss/test/security/ejb/RunAsMDB.java Index: RunAsMDB.java === RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/security/ejb/RunAsMDB.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- RunAsMDB.java 2001/07/09 20:20:48 1.2 +++ RunAsMDB.java 2001/07/26 02:55:35 1.3 @@ -1,77 +1,77 @@ -/* - * jBoss, the OpenSource EJB server - * - * Distributable under LGPL license. - * See terms of license at gnu.org. - */ -package org.jboss.test.security.ejb; - -import javax.ejb.MessageDrivenBean; -import javax.ejb.MessageDrivenContext; -import javax.ejb.EJBException; -import javax.jms.Destination; -import javax.jms.MessageListener; -import javax.jms.Message; -import javax.naming.InitialContext; -import javax.naming.NamingException; - -import org.jboss.test.security.interfaces.Entity; -import org.jboss.test.security.interfaces.EntityHome; - -/** An MDB that takes the string from the msg passed to onMessage - and invokes the echo(String) method on an internal Entity using - the InternalRole assigned in the MDB descriptor run-as element. - - @author [EMAIL PROTECTED] - @version $Revision: 1.2 $ - */ -public class RunAsMDB implements MessageDrivenBean, MessageListener -{ - private MessageDrivenContext ctx = null; - private InitialContext iniCtx; - - public RunAsMDB() - { - } - - public void setMessageDrivenContext(MessageDrivenContext ctx) - throws EJBException - { - this.ctx = ctx; - try - { - iniCtx = new InitialContext(); - } - catch(NamingException e) - { - throw new EJBException(e); - } - } - - public void ejbCreate() - { - } - - public void ejbRemove() - { - ctx = null; - } - - public void onMessage(Message message) - { - try - { - String arg = message.getStringProperty(arg); - EntityHome home = (EntityHome) iniCtx.lookup(java:comp/env/ejb/Entity); - Entity bean = home.findByPrimaryKey(arg); - String echo = bean.echo(arg); - System.out.println(RunAsMDB echo(+arg+) - +echo); - Destination
[JBoss-dev] CVS update: jbosstest/src/main/org/jboss/test/security/ejb EntityBeanImpl.java RunAsMDB.java
User: starksm Date: 01/07/19 03:20:26 Modified:src/main/org/jboss/test/security/ejb Tag: Branch_2_4 EntityBeanImpl.java RunAsMDB.java Log: Update active subject access test Revision ChangesPath No revision No revision 1.2.2.2 +2 -24 jbosstest/src/main/org/jboss/test/security/ejb/EntityBeanImpl.java Index: EntityBeanImpl.java === RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/security/ejb/EntityBeanImpl.java,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- EntityBeanImpl.java 2001/07/14 17:10:52 1.2.2.1 +++ EntityBeanImpl.java 2001/07/19 10:20:26 1.2.2.2 @@ -17,7 +17,7 @@ using the echo method. @author [EMAIL PROTECTED] -@version $Revision: 1.2.2.1 $ +@version $Revision: 1.2.2.2 $ */ public class EntityBeanImpl implements EntityBean { @@ -73,32 +73,10 @@ if( securityMgr == null ) throw new EJBException(Failed to find security mgr under: java:comp/env/security/security-domain); System.out.println(Found SecurityManager: +securityMgr); - /* I'm using this runtime introspection to determin if the security -manager supports a getActiveSubject() method because the -org.jboss.security.SubjectSecurityManager interface is not part of -the standard client jars which are used to build the jbosstest suite. -Not legal EJB code, but this is test code. -*/ - Class securityMgrClass = securityMgr.getClass(); - Class[] parameterTypes = {}; - Method getActiveSubject = securityMgrClass.getDeclaredMethod(getActiveSubject, parameterTypes); - Object[] args = {}; - Subject activeSubject = (Subject) getActiveSubject.invoke(securityMgr, args); + Subject activeSubject = (Subject) ctx.lookup(java:comp/env/security/subject); System.out.println(ActiveSubject: +activeSubject); if( activeSubject == null ) throw new EJBException(No ActiveSubject found); -} -catch(NoSuchMethodException e) -{ - // Ok, not a SubjectSecurityManager -} -catch(InvocationTargetException e) -{ - // Ok, not a SubjectSecurityManager -} -catch(IllegalAccessException e) -{ - // Ok, not a SubjectSecurityManager } catch(NamingException e) { 1.1.2.3 +77 -77jbosstest/src/main/org/jboss/test/security/ejb/RunAsMDB.java Index: RunAsMDB.java === RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/security/ejb/RunAsMDB.java,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -u -r1.1.2.2 -r1.1.2.3 --- RunAsMDB.java 2001/07/14 17:10:52 1.1.2.2 +++ RunAsMDB.java 2001/07/19 10:20:26 1.1.2.3 @@ -1,77 +1,77 @@ -/* - * jBoss, the OpenSource EJB server - * - * Distributable under LGPL license. - * See terms of license at gnu.org. - */ -package org.jboss.test.security.ejb; - -import javax.ejb.MessageDrivenBean; -import javax.ejb.MessageDrivenContext; -import javax.ejb.EJBException; -import javax.jms.Destination; -import javax.jms.MessageListener; -import javax.jms.Message; -import javax.naming.InitialContext; -import javax.naming.NamingException; - -import org.jboss.test.security.interfaces.Entity; -import org.jboss.test.security.interfaces.EntityHome; - -/** An MDB that takes the string from the msg passed to onMessage - and invokes the echo(String) method on an internal Entity using - the InternalRole assigned in the MDB descriptor run-as element. - - @author [EMAIL PROTECTED] - @version $Revision: 1.1.2.2 $ - */ -public class RunAsMDB implements MessageDrivenBean, MessageListener -{ - private MessageDrivenContext ctx = null; - private InitialContext iniCtx; - - public RunAsMDB() - { - } - - public void setMessageDrivenContext(MessageDrivenContext ctx) - throws EJBException - { - this.ctx = ctx; - try - { - iniCtx = new InitialContext(); - } - catch(NamingException e) - { - throw new EJBException(e); - } - } - - public void ejbCreate() - { - } - - public void ejbRemove() - { - ctx = null; - } - - public void onMessage(Message message) - { - try - { - String arg = message.getStringProperty(arg); - EntityHome home = (EntityHome) iniCtx.lookup(java:comp/env/ejb/Entity); - Entity bean =
[JBoss-dev] CVS update: jbosstest/src/main/org/jboss/test/security/ejb EntityBeanImpl.java RunAsMDB.java
User: starksm Date: 01/07/14 10:10:53 Modified:src/main/org/jboss/test/security/ejb Tag: Branch_2_4 EntityBeanImpl.java RunAsMDB.java Log: Merge latest changes from main Revision ChangesPath No revision No revision 1.2.2.1 +52 -2 jbosstest/src/main/org/jboss/test/security/ejb/EntityBeanImpl.java Index: EntityBeanImpl.java === RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/security/ejb/EntityBeanImpl.java,v retrieving revision 1.2 retrieving revision 1.2.2.1 diff -u -r1.2 -r1.2.2.1 --- EntityBeanImpl.java 2001/06/13 04:55:50 1.2 +++ EntityBeanImpl.java 2001/07/14 17:10:52 1.2.2.1 @@ -1,8 +1,15 @@ package org.jboss.test.security.ejb; +import java.lang.reflect.Method; +import java.lang.reflect.InvocationTargetException; import java.rmi.RemoteException; import java.security.Principal; -import javax.ejb.*; +import javax.ejb.EJBException; +import javax.ejb.EntityBean; +import javax.ejb.EntityContext; +import javax.naming.InitialContext; +import javax.naming.NamingException; +import javax.security.auth.Subject; /** A BMP entity bean that creates beans on the fly with a key equal to that passed to findByPrimaryKey. Obviously @@ -10,7 +17,7 @@ using the echo method. @author [EMAIL PROTECTED] -@version $Revision: 1.2 $ +@version $Revision: 1.2.2.1 $ */ public class EntityBeanImpl implements EntityBean { @@ -54,7 +61,50 @@ { System.out.println(EntityBean.echo, arg=+arg); Principal p = context.getCallerPrincipal(); +boolean isInternalRole = context.isCallerInRole(InternalRole); System.out.println(EntityBean.echo, callerPrincipal=+p); +System.out.println(EntityBean.echo, isCallerInRole('InternalRole')=+isInternalRole); +// Check the java:comp/env/security/security-domain +try +{ + InitialContext ctx = new InitialContext(); + Object securityMgr = ctx.lookup(java:comp/env/security/security-domain); + System.out.println(Checking java:comp/env/security/security-domain); + if( securityMgr == null ) + throw new EJBException(Failed to find security mgr under: java:comp/env/security/security-domain); + System.out.println(Found SecurityManager: +securityMgr); + /* I'm using this runtime introspection to determin if the security +manager supports a getActiveSubject() method because the +org.jboss.security.SubjectSecurityManager interface is not part of +the standard client jars which are used to build the jbosstest suite. +Not legal EJB code, but this is test code. +*/ + Class securityMgrClass = securityMgr.getClass(); + Class[] parameterTypes = {}; + Method getActiveSubject = securityMgrClass.getDeclaredMethod(getActiveSubject, parameterTypes); + Object[] args = {}; + Subject activeSubject = (Subject) getActiveSubject.invoke(securityMgr, args); + System.out.println(ActiveSubject: +activeSubject); + if( activeSubject == null ) + throw new EJBException(No ActiveSubject found); +} +catch(NoSuchMethodException e) +{ + // Ok, not a SubjectSecurityManager +} +catch(InvocationTargetException e) +{ + // Ok, not a SubjectSecurityManager +} +catch(IllegalAccessException e) +{ + // Ok, not a SubjectSecurityManager +} +catch(NamingException e) +{ + e.printStackTrace(); + throw new EJBException(Naming exception: +e.toString(true)); +} return p.getName(); } 1.1.2.2 +1 -1 jbosstest/src/main/org/jboss/test/security/ejb/RunAsMDB.java Index: RunAsMDB.java === RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/security/ejb/RunAsMDB.java,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -r1.1.2.1 -r1.1.2.2 --- RunAsMDB.java 2001/07/09 08:54:12 1.1.2.1 +++ RunAsMDB.java 2001/07/14 17:10:52 1.1.2.2 @@ -23,7 +23,7 @@ the InternalRole assigned in the MDB descriptor run-as element. @author [EMAIL PROTECTED] - @version $Revision: 1.1.2.1 $ + @version $Revision: 1.1.2.2 $ */ public class RunAsMDB implements MessageDrivenBean, MessageListener { ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development