Package org.jboss.security.client

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


    @Test
    public void testTaskSubmit() throws Exception {
        SecurityClient client = SecurityClientFactory.getSecurityClient();
        client.setSimple("guest", "guest");
        client.login();
        try {
            final DefaultManagedExecutorServiceTestEJB testEJB = (DefaultManagedExecutorServiceTestEJB) new InitialContext().lookup("java:module/" + DefaultManagedExecutorServiceTestEJB.class.getSimpleName());
            testEJB.submit(new TestEJBRunnable()).get();
        } finally {
            client.logout();
View Full Code Here


    @Test
    public void testTaskSubmit() throws Exception {
        SecurityClient client = SecurityClientFactory.getSecurityClient();
        client.setSimple("guest", "guest");
        client.login();
        try {
            final DefaultManagedScheduledExecutorServiceTestEJB testEJB = (DefaultManagedScheduledExecutorServiceTestEJB) new InitialContext().lookup("java:module/" + DefaultManagedScheduledExecutorServiceTestEJB.class.getSimpleName());
            testEJB.schedule(new TestEJBRunnable(), 10L, TimeUnit.MILLISECONDS).get();
        } finally {
            client.logout();
View Full Code Here

    @Test
    public void testTaskSubmit() throws Exception {
        SecurityClient client = SecurityClientFactory.getSecurityClient();
        client.setSimple("guest", "guest");
        client.login();
        try {
            final DefaultManagedThreadFactoryTestEJB testEJB = (DefaultManagedThreadFactoryTestEJB) new InitialContext().lookup("java:module/" + DefaultManagedThreadFactoryTestEJB.class.getSimpleName());
            testEJB.run(new TestEJBRunnable());
        } finally {
            client.logout();
View Full Code Here

    @Test
    public void testTaskSubmit() throws Exception {
        SecurityClient client = SecurityClientFactory.getSecurityClient();
        client.setSimple("guest", "guest");
        client.login();
        try {
            final DefaultContextServiceTestEJB testEJB = (DefaultContextServiceTestEJB) new InitialContext().lookup("java:module/" + DefaultContextServiceTestEJB.class.getSimpleName());
            testEJB.submit(new TestEJBRunnable()).get();
        } finally {
            client.logout();
View Full Code Here

            if (samlCredential != null)
            {
               SecurityClient client = SecurityClientFactory.getSecurityClient();
               // Simple login just updates the security context
               client.setSimple(new UserPrincipal(httpRequest.getRemoteUser()), samlCredential);
               client.login();

               if (log.isTraceEnabled())
               {
                  log.trace("SecurityClient successfully updated with SAMLCredential");
               }
View Full Code Here

   public void testClient() throws Exception
   {
      SecurityClient client = SecurityClientFactory.getSecurityClient();
      assertEquals("JBossSecurityClient", JBossSecurityClient.class,client.getClass());
      client.setSimple("anil", "pass");
      client.login();
      SecurityContext sc = SecurityContextAssociation.getSecurityContext();
      assertNotNull("SecurityContext is not null", sc);
      SubjectInfo si = sc.getSubjectInfo();
      assertNotNull("SubjectInfo is not null", si);
      assertNotNull("Principal is not null", sc.getUtil().getUserPrincipal());
View Full Code Here

      SecurityContextAssociation.setSecurityContext(prev);
     
      SecurityClient client = SecurityClientFactory.getSecurityClient();
      assertEquals("JBossSecurityClient", JBossSecurityClient.class,client.getClass());
      client.setSimple("anil", "pass");
      client.login();
     
      SecurityContext sc = SecurityContextAssociation.getSecurityContext();
      assertNotNull("SecurityContext is not null", sc);
      SubjectInfo si = sc.getSubjectInfo();
      assertNotNull("SubjectInfo is not null", si);
View Full Code Here

   {
      // Establish the proxy with an incorrect security identity
      // Initially login with an incorrect password
      SecurityClient securityClient = SecurityClientFactory.getSecurityClient();
      securityClient.setSimple("kabir", "invalidpassword");
      securityClient.login();

      InitialContext ctx = new InitialContext();
      Calculator calculator = (Calculator) ctx.lookup("CalculatorBean/remote");

      System.out.println("Kabir is a student.");
View Full Code Here

      System.out.println("Kabir does unchecked addition.");

      // Re-establish the proxy with the correct security identity
      securityClient.logout();
      securityClient.setSimple("kabir", "validpassword");
      securityClient.login();

      calculator = (Calculator) ctx.lookup("CalculatorBean/remote");

      System.out.println("1 + 1 = " + calculator.add(1, 1));
View Full Code Here

   public static void main(String[] args) throws Exception
   {
      // Establish the proxy with an incorrect security identity
      SecurityClient securityClient = SecurityClientFactory.getSecurityClient();
      securityClient.setSimple("kabir","invalidpassword");
      securityClient.login();
     
      InitialContext ctx = new InitialContext();
      // let's use the bean whose proxy communicates via ssl
      Calculator sslCalculator = (Calculator) ctx.lookup("CalculatorBean/remote");
      System.out.println("Invoking bean methods on a proxy through sslsocket");
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.