[prev in list] [next in list] [prev in thread] [next in thread]
List: jboss-cvs-commits
Subject: [jboss-cvs] jbosstest/src/main/org/jboss/test/security/ejb/jbas1852 ...
From: Scott Stark <scott.stark () jboss ! com>
Date: 2005-05-31 23:15:27
Message-ID: E1DdFxH-0004xo-Ub () committer01 ! frg ! pub ! inap ! atl ! jboss ! com
[Download RAW message or body]
User: starksm
Date: 05/05/31 19:15:27
Added: src/main/org/jboss/test/security/ejb/jbas1852
PrivateSessionBean.java PublicSessionBean.java
PublicSessionFacade.java Session.java
SessionFacade.java SessionFacadeHome.java
SessionHome.java
Log:
EJBs for JBAS-1852 tests
Revision Changes Path
1.1 date: 2005/05/31 23:15:27; author: starksm; state: \
Exp;jbosstest/src/main/org/jboss/test/security/ejb/jbas1852/PrivateSessionBean.java
Index: PrivateSessionBean.java
===================================================================
/*
* JBoss, Home of Professional Open Source
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jboss.test.security.ejb.jbas1852;
import java.security.Principal;
import javax.ejb.CreateException;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
/** An implmentation of the Session interface that should not
be accessible by external users.
@author Scott.Stark@jboss.org
@version $Revision: 1.1 $
*/
public class PrivateSessionBean implements SessionBean
{
private SessionContext sessionContext;
public void ejbCreate() throws CreateException
{
System.out.println("PrivateSessionBean.ejbCreate() called");
}
public void ejbActivate()
{
System.out.println("PrivateSessionBean.ejbActivate() called");
}
public void ejbPassivate()
{
System.out.println("PrivateSessionBean.ejbPassivate() called");
}
public void ejbRemove()
{
System.out.println("PrivateSessionBean.ejbRemove() called");
}
public void setSessionContext(SessionContext context)
{
sessionContext = context;
}
public String echo(String arg)
{
System.out.println("PrivateSessionBean.echo, arg="+arg);
Principal p = sessionContext.getCallerPrincipal();
System.out.println("PrivateSessionBean.echo, callerPrincipal="+p);
System.out.println("PrivateSessionBean.echo, \
isCallerInRole('InternalUser')="+sessionContext.isCallerInRole("InternalUser")); \
return arg; }
public void noop()
{
System.out.println("PrivateSessionBean.noop");
Principal p = sessionContext.getCallerPrincipal();
System.out.println("PrivateSessionBean.noop, callerPrincipal="+p);
}
public void restricted()
{
System.out.println("PrivateSessionBean.restricted");
Principal p = sessionContext.getCallerPrincipal();
System.out.println("PrivateSessionBean.restricted, callerPrincipal="+p);
}
}
1.1 date: 2005/05/31 23:15:27; author: starksm; state: \
Exp;jbosstest/src/main/org/jboss/test/security/ejb/jbas1852/PublicSessionBean.java
Index: PublicSessionBean.java
===================================================================
/*
* JBoss, Home of Professional Open Source
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jboss.test.security.ejb.jbas1852;
import java.security.Principal;
import javax.ejb.CreateException;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
import javax.naming.InitialContext;
/** An implmentation of the Session interface that delegates its
echo method call to the PrivateSession bean to test run-as.
@author Scott.Stark@jboss.org
@version $Revision: 1.1 $
*/
public class PublicSessionBean implements SessionBean
{
private SessionContext sessionContext;
public void ejbCreate() throws CreateException
{
System.out.println("PublicSessionBean.ejbCreate() called");
}
public void ejbActivate()
{
System.out.println("PublicSessionBean.ejbActivate() called");
}
public void ejbPassivate()
{
System.out.println("PublicSessionBean.ejbPassivate() called");
}
public void ejbRemove()
{
System.out.println("PublicSessionBean.ejbRemove() called");
}
public void setSessionContext(SessionContext context)
{
sessionContext = context;
}
public String echo(String arg)
{
System.out.println("PublicSessionBean.echo, arg="+arg);
Principal p = sessionContext.getCallerPrincipal();
System.out.println("PublicSessionBean.echo, callerPrincipal="+p);
System.out.println("PublicSessionBean.echo, \
isCallerInRole('EchoUser')="+sessionContext.isCallerInRole("EchoUser")); try
{
InitialContext ctx = new InitialContext();
SessionHome home = (SessionHome) ctx.lookup("java:comp/env/ejb/PrivateSession");
Session bean = home.create();
System.out.println("PublicSessionBean.echo, created PrivateSession");
arg = bean.echo(arg);
}
catch(Exception e)
{
}
return arg;
}
public void noop()
{
System.out.println("PublicSessionBean.noop");
Principal p = sessionContext.getCallerPrincipal();
System.out.println("PublicSessionBean.noop, callerPrincipal="+p);
}
public void restricted()
{
System.out.println("PublicSessionBean.restricted");
Principal p = sessionContext.getCallerPrincipal();
System.out.println("PublicSessionBean.restricted, callerPrincipal="+p);
}
}
1.1 date: 2005/05/31 23:15:27; author: starksm; state: \
Exp;jbosstest/src/main/org/jboss/test/security/ejb/jbas1852/PublicSessionFacade.java \
Index: PublicSessionFacade.java
===================================================================
/*
* JBoss, Home of Professional Open Source
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jboss.test.security.ejb.jbas1852;
import java.security.Principal;
import java.rmi.RemoteException;
import javax.ejb.CreateException;
import javax.ejb.SessionContext;
import javax.ejb.SessionBean;
import javax.naming.InitialContext;
import javax.naming.NamingException;
/**
* @author Scott.Stark@jboss.org
* @version $Revision: 1.1 $
*/
public class PublicSessionFacade implements SessionBean
{
private SessionContext sessionContext;
public void ejbCreate() throws CreateException
{
System.out.println("PublicSessionBean.ejbCreate() called");
}
public void ejbActivate()
{
System.out.println("PublicSessionBean.ejbActivate() called");
}
public void ejbPassivate()
{
System.out.println("PublicSessionBean.ejbPassivate() called");
}
public void ejbRemove()
{
System.out.println("PublicSessionBean.ejbRemove() called");
}
public void setSessionContext(SessionContext context)
{
sessionContext = context;
}
public String callEcho(String arg)
throws RemoteException
{
Principal user = sessionContext.getCallerPrincipal();
String echoMsg = null;
try
{
InitialContext ctx = new InitialContext();
String jndiName = "java:comp/env/ejb/TargetEJB";
SessionHome home = (SessionHome) ctx.lookup(jndiName);
Session bean = home.create();
echoMsg = bean.echo("Hello, arg="+arg);
echoMsg = bean.echo("Hello 2, arg="+arg);
}
catch (NamingException e)
{
throw new RemoteException("callEcho failed", e);
}
catch (CreateException e)
{
throw new RemoteException("callEcho failed", e);
}
return echoMsg;
}
}
1.1 date: 2005/05/31 23:15:27; author: starksm; state: \
Exp;jbosstest/src/main/org/jboss/test/security/ejb/jbas1852/Session.java
Index: Session.java
===================================================================
/*
* JBoss, Home of Professional Open Source
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jboss.test.security.ejb.jbas1852;
import javax.ejb.*;
import java.rmi.*;
/** A simple stateless session bean interface used by the example beans.
@author Scott.Stark@jboss.org
@version $Revision: 1.1 $
*/
public interface Session extends EJBObject
{
public String echo(String arg) throws RemoteException;
public void noop() throws RemoteException;
public void restricted() throws RemoteException;
}
1.1 date: 2005/05/31 23:15:27; author: starksm; state: \
Exp;jbosstest/src/main/org/jboss/test/security/ejb/jbas1852/SessionFacade.java
Index: SessionFacade.java
===================================================================
/*
* JBoss, Home of Professional Open Source
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jboss.test.security.ejb.jbas1852;
import javax.ejb.*;
import java.rmi.*;
/** A simple stateless session bean interface used by the example beans.
@author Scott.Stark@jboss.org
@version $Revision: 1.1 $
*/
public interface SessionFacade extends EJBObject
{
public String callEcho(String arg) throws RemoteException;
}
1.1 date: 2005/05/31 23:15:27; author: starksm; state: \
Exp;jbosstest/src/main/org/jboss/test/security/ejb/jbas1852/SessionFacadeHome.java
Index: SessionFacadeHome.java
===================================================================
/*
* JBoss, Home of Professional Open Source
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jboss.test.security.ejb.jbas1852;
import javax.ejb.*;
import java.rmi.*;
/** The home interface for the example stateless session beans
*/
public interface SessionFacadeHome extends EJBHome
{
public SessionFacade create() throws RemoteException, CreateException;
}
1.1 date: 2005/05/31 23:15:27; author: starksm; state: \
Exp;jbosstest/src/main/org/jboss/test/security/ejb/jbas1852/SessionHome.java
Index: SessionHome.java
===================================================================
/*
* JBoss, Home of Professional Open Source
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jboss.test.security.ejb.jbas1852;
import javax.ejb.*;
import java.rmi.*;
/** The home interface for the example stateless session beans
*/
public interface SessionHome extends EJBHome
{
public Session create() throws RemoteException, CreateException;
}
-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
jboss-cvs-commits mailing list
jboss-cvs-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-cvs-commits
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic