Package org.jboss.security.client

Examples of org.jboss.security.client.SecurityClient.login()


            fail("Unexpected exception");
         }
      }
      SecurityClient client = SecurityClientFactory.getSecurityClient();
      client.setSimple("scott", "echoman");
      client.login();
      try
      {
         bean = home.create();
         bean.echo("hi");
      }
View Full Code Here


   {
      Context ctx = new InitialContext();
      CompleteXMLDD completeXMLDDBean = (CompleteXMLDD) ctx.lookup("CompleteXMLDD/remote");
      SecurityClient securityClient = SecurityClientFactory.getSecurityClient();
      securityClient.setSimple("jai", "jai123");
      securityClient.login();
     
      System.out.println("jai is a normal user");
      // call sayHello
      System.out.println(completeXMLDDBean.sayHello("jai"));
View Full Code Here

      }
      securityClient.logout();
     
      // let's login with other user
      securityClient.setSimple("bill", "bill123");
      securityClient.login();
      System.out.println("bill is an admin");
      // Now work on the other bean
      PartialXMLDD partialXMLDDBean = (PartialXMLDD) ctx.lookup("PartialXMLDD/remote");
      System.out.println("Sending Hello World message to bean. We expect the bean to change it");
      System.out.println(partialXMLDDBean.changeMessage("Hello world"));
View Full Code Here

   private static void testShoppingCart() throws Exception
   {
      // Establish the proxy with an incorrect security identity
      SecurityClient securityClient = SecurityClientFactory.getSecurityClient();
      securityClient.setSimple("bill", "incorrectpassword");
      securityClient.login();
     
      Context ctx = new InitialContext();
      ShoppingCart cart = (ShoppingCart) ctx.lookup("ShoppingCart");

      System.out.println("Attempting to buy 1 memory stick with incorrect password");
View Full Code Here

      System.out.println("Setting user/password");
      securityClient.logout();
     
      securityClient.setSimple("bill", "password-test");
      securityClient.login();

      System.out.println("bill is a shopper, so is allowed to buy");
      System.out.println("Buying 1 memory stick");
      cart.buy("Memory stick", 1);
      System.out.println("Buying another memory stick");
View Full Code Here

      InitialContext jndiContext = new InitialContext();
      StatelessTest stateless = (StatelessTest) jndiContext.lookup("StatelessTest");

      SecurityClient securityClient = SecurityClientFactory.getSecurityClient();
      securityClient.setSimple("bill2", "invalidpassword");
      securityClient.login();
     
      try
      {
         stateless.testSecurity();
         throw new RuntimeException("ERROR - User with incorrect password accessed the bean");
View Full Code Here

      // logout and login back with correct credentials
      System.out.println("Now passing the correct user/password to access the SLSB");
      securityClient.logout();
      securityClient.setSimple("bill2", "password-default");
      securityClient.login();
     
      // call the bean method
      stateless.testSecurity();

      System.out.println("Successfully accessed SLSB");
View Full Code Here

    @Test
    public void testAuthz() throws Exception {
        SecurityClient securityClient = SecurityClientFactory.getSecurityClient();
        securityClient.setSimple("jduke", "theduke");
        try {
            securityClient.login();
            assertEquals(HelloBean.HELLO_WORLD, hello.sayHelloWorld());
        } finally {
            securityClient.logout();
        }
    }
View Full Code Here

    @Test
    public void testNotAuthz() throws Exception {
        SecurityClient securityClient = SecurityClientFactory.getSecurityClient();
        securityClient.setSimple("JohnDoe", "jdoe");
        try {
            securityClient.login();
            hello.sayHelloWorld();
            fail("Access to sayHelloWorld() should be denied for JohnDoe.");
        } catch (EJBAccessException e) {
            //OK - expected
        } finally {
View Full Code Here

            //OK
        }
        SecurityClient securityClient = SecurityClientFactory.getSecurityClient();
        securityClient.setSimple("jduke", "theduke");
        try {
            securityClient.login();
            assertEquals(HelloBean.HELLO_WORLD, hello.sayHelloWorld());
        } finally {
            securityClient.logout();
        }
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.