Package org.jboss.test.security.interfaces

Examples of org.jboss.test.security.interfaces.StatelessSession


      login();
      Object obj = getInitialContext().lookup("spec.UncheckedSessionRemoteLast");
      obj = PortableRemoteObject.narrow(obj, StatelessSessionHome.class);
      StatelessSessionHome home = (StatelessSessionHome) obj;
      log.debug("Found UncheckedSessionRemoteLast");
      StatelessSession bean = home.create();
      log.debug("Created spec.UncheckedSessionRemoteLast");
      log.debug("Bean.echo('testUncheckedRemote') -> " + bean.echo("testUncheckedRemote"));
      try
      {
         bean.excluded();
         fail("Was able to call UncheckedSessionRemoteLast.excluded");
      }
      catch (RemoteException e)
      {
         log.debug("UncheckedSessionRemoteLast.excluded failed as expected");
      }
      bean.remove();
      logout();
   }
View Full Code Here


      login();
      Object obj = getInitialContext().lookup("spec.UncheckedSessionRemoteFirst");
      obj = PortableRemoteObject.narrow(obj, StatelessSessionHome.class);
      StatelessSessionHome home = (StatelessSessionHome) obj;
      log.debug("Found UncheckedSessionRemoteFirst");
      StatelessSession bean = home.create();
      log.debug("Created spec.UncheckedSessionRemoteFirst");
      log.debug("Bean.echo('testRemoteUnchecked') -> " + bean.echo("testRemoteUnchecked"));
      try
      {
         bean.excluded();
         fail("Was able to call UncheckedSessionRemoteFirst.excluded");
      }
      catch (RemoteException e)
      {
         log.debug("UncheckedSessionRemoteFirst.excluded failed as expected");
      }
      bean.remove();
      logout();
   }
View Full Code Here

      login();
      Object obj = getInitialContext().lookup("spec.StatelessSession");
      obj = PortableRemoteObject.narrow(obj, StatelessSessionHome.class);
      StatelessSessionHome home = (StatelessSessionHome) obj;
      log.debug("Found spec.StatelessSession Home");
      StatelessSession bean = home.create();
      log.debug("Created spec.StatelessSession");
      // Logout and login back in as stark to test access to the unchecked method
      logout();
      login("stark", "javaman".toCharArray());
      bean.unchecked();
      log.debug("Called Bean.unchecked()");
      logout();
   }
View Full Code Here

      login();
      Object obj = getInitialContext().lookup("spec.UncheckedSession");
      obj = PortableRemoteObject.narrow(obj, StatelessSessionHome.class);
      StatelessSessionHome home = (StatelessSessionHome) obj;
      log.debug("Found spec.StatelessSession Home");
      StatelessSession bean = home.create();
      log.debug("Created spec.StatelessSession");
      bean.unchecked();
      log.debug("Called Bean.unchecked()");
      logout();
   }
View Full Code Here

      login();
      Object obj = getInitialContext().lookup("spec.StatelessSession2");
      obj = PortableRemoteObject.narrow(obj, StatelessSessionHome.class);
      StatelessSessionHome home = (StatelessSessionHome) obj;
      log.debug("Found spec.StatelessSession2 Home");
      StatelessSession bean = home.create();
      log.debug("Created spec.StatelessSession2");
      try
      {
         bean.excluded();
         fail("Was able to call Bean.excluded()");
      }
      catch (Exception e)
      {
         log.debug("Bean.excluded() failed as expected");
View Full Code Here

      login();
      Object obj = getInitialContext().lookup("spec.RunAsStatelessSession");
      obj = PortableRemoteObject.narrow(obj, StatelessSessionHome.class);
      StatelessSessionHome home = (StatelessSessionHome) obj;
      log.debug("Found RunAsStatelessSession Home");
      StatelessSession bean = home.create();
      log.debug("Created spec.RunAsStatelessSession");
      log.debug("Bean.echo('testRunAs') -> " + bean.echo("testRunAs"));
      bean.noop();
      log.debug("Bean.noop(), ok");

      try
      {
         // This should not be allowed
         bean.forward("Hello");
         fail("Was able to call RunAsStatelessSession.forward");
      }
      catch (RemoteException e)
      {
         log.debug("StatelessSession.forward failed as expected");
      }
      bean.remove();
   }
View Full Code Here

      login();
      Object obj = getInitialContext().lookup("spec.StatelessSession");
      obj = PortableRemoteObject.narrow(obj, StatelessSessionHome.class);
      StatelessSessionHome home = (StatelessSessionHome) obj;
      log.debug("Found StatelessSessionHome");
      StatelessSession bean = home.create();
      log.debug("Created spec.StatelessSession");
      Handle h = bean.getHandle();
      log.debug("Obtained handle: " + h);
      bean = (StatelessSession) h.getEJBObject();
      log.debug("Obtained bean from handle: " + bean);
      log.debug("Bean.echo('testHandle') -> " + bean.echo("testHandle"));
      logout();

      /*
       * Attempting to obtain the EJB fron the handle without security association present should fail
       */
      try
      {
         bean = (StatelessSession) h.getEJBObject();
         fail("Should not be able to obtain a bean without login info");
      }
      catch (Exception e)
      {
         log.debug("Obtaining bean from handle failed as expected, e=" + e.getMessage());
      }

      // One should be able to obtain a handle without a login
      h = bean.getHandle();
      login();
      // Now we should be able to obtain and use the secure bean
      bean = (StatelessSession) h.getEJBObject();
      log.debug("Obtained bean from handle: " + bean);
      log.debug("Bean.echo('testHandle2') -> " + bean.echo("testHandle2"));
      logout();
   }
View Full Code Here

               lc.login();
               Object obj = ctx.lookup("spec.StatelessSession");
               obj = PortableRemoteObject.narrow(obj, StatelessSessionHome.class);
               StatelessSessionHome home = (StatelessSessionHome) obj;
               log.debug("Found StatelessSessionHome");
               StatelessSession bean = home.create();
               log.debug("Created spec.StatelessSession");
               log.debug("Bean.echo('Hello') -> " + bean.echo("Hello"));
               bean.remove();
               log.debug("Removed bean");
               lc.logout();
            }
         }
         catch (Throwable e)
View Full Code Here

        String echo = null;
        try
        {
            InitialContext ctx = new InitialContext();
            StatelessSessionHome home = (StatelessSessionHome) ctx.lookup("java:comp/env/ejb/Session");
            StatelessSession bean = home.create();
            echo = bean.echo(echoArg);
        }
        catch(Exception e)
        {
            log.debug("StatelessSession.echo failed", e);
            e.fillInStackTrace();
View Full Code Here

   {
      Object obj = getInitialContext().lookup("DeploymentLevelRoleMappingBean");
      obj = PortableRemoteObject.narrow(obj, StatelessSessionHome.class);
      StatelessSessionHome home = (StatelessSessionHome) obj;
      log.debug("Found Unsecure StatelessSessionHome");
      StatelessSession bean = null;
      try
      {
         bean = home.create();
         log.debug("Created spec.UnsecureStatelessSession2");
         bean.echo("Hello from nobody?")
         fail("Should not be allowed");
      }
      catch(RemoteException re)
      {
      }
      finally
      {
         if(bean != null)
           bean.remove()
      }
     
      login();
      obj = getInitialContext().lookup("DeploymentLevelRoleMappingBean");
      obj = PortableRemoteObject.narrow(obj, StatelessSessionHome.class);
      home = (StatelessSessionHome) obj;
      log.debug("Found spec.StatelessSession2");
      bean = home.create();
      log.debug("Created spec.StatelessSession2");
      // Test that the Entity bean sees username as its principal
      String echo = bean.echo("jduke");
      log.debug("bean.echo(username) = "+echo);
      assertTrue("username == echo", echo.equals("jduke"));
      bean.remove();
      logout();
   }
View Full Code Here

TOP

Related Classes of org.jboss.test.security.interfaces.StatelessSession

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.