Package org.jboss.embedded.test.ejb

Examples of org.jboss.embedded.test.ejb.Secured


      Hashtable env = new Hashtable();
      env.put(Context.SECURITY_PRINCIPAL, "scott");
      env.put(Context.SECURITY_CREDENTIALS, "invalidpassword");

      InitialContext ctx = new InitialContext(env);
      Secured secured = (Secured)ctx.lookup("SecuredBean/local");
      boolean exceptionThrown = false;
      try
      {
         secured.allowed();
      }
      catch (EJBAccessException ignored)
      {
         exceptionThrown = true;
      }
      assertTrue("Security exception not thrown for invalid password", exceptionThrown);
      env.put(Context.SECURITY_CREDENTIALS, "password");
      ctx = new InitialContext(env);

      secured.allowed();

      exceptionThrown = false;
      try
      {
         secured.nobody();
      }
      catch (EJBAccessException ignored)
      {
         exceptionThrown = true;
      }
View Full Code Here

TOP

Related Classes of org.jboss.embedded.test.ejb.Secured

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.