Package org.jboss.security.plugins

Examples of org.jboss.security.plugins.JaasSecurityManager


      int iterations = Integer.getInteger("jbosstest.iterationcount", 5000).intValue();
      log.info("Creating "+count+" threads doing "+iterations+" iterations");
      PolicyContext.registerHandler(SecurityConstants.SUBJECT_CONTEXT_KEY,
          new SubjectPolicyContextHandler(), false);
      AuthorizationManager am = new JBossAuthorizationManager("testIdentity");
      JaasSecurityManager secMgr = new JaasSecurityManager("testIdentity", new SecurityAssociationHandler());
      TimedCachePolicy cache = new TimedCachePolicy(3, false, 100);
      cache.create();
      cache.start();
      secMgr.setCachePolicy(cache);
      Thread[] testThreads = new Thread[count];
      AuthTester[] testers = new AuthTester[count];
      for(int t = 0; t < count; t ++)
      {
         int userID = t % Nusers;
View Full Code Here


    */
   public void testStringCharArrayCredential()
   {
      SimplePrincipal jduke = new SimplePrincipal("jduke");
      CallbackHandler handler = new SecurityAssociationHandler(jduke, "theduke".toCharArray());
      JaasSecurityManager sm = new JaasSecurityManager("testStringCharArrayCredential", handler);
      TimedCachePolicy cache = new TimedCachePolicy(600, true, 10);
      cache.create();
      cache.start();
      sm.setCachePolicy(cache);

      // Initial validation to populate the cache
      assertTrue(sm.isValid(jduke, "theduke"));
      // Validate that the String credential form uses the cache
      assertTrue(sm.isValid(jduke, "theduke"));
      // Validate that the char[] credential form uses the cache
      assertTrue(sm.isValid(jduke, "theduke".toCharArray()));
   }
View Full Code Here

    */
   public void testCharArrayStringCredential()
   {
      SimplePrincipal jduke = new SimplePrincipal("jduke");
      CallbackHandler handler = new SecurityAssociationHandler(jduke, "theduke".toCharArray());
      JaasSecurityManager sm = new JaasSecurityManager("testStringCharArrayCredential", handler);
      TimedCachePolicy cache = new TimedCachePolicy(600, true, 10);
      cache.create();
      cache.start();
      sm.setCachePolicy(cache);

      // Reset the validation count
      CountedLoginModule.validateCount = 0;
      // Initial validation to populate the cache
      assertTrue(sm.isValid(jduke, "theduke".toCharArray()));
      // Validate that the char[] credential form uses the cache
      assertTrue(sm.isValid(jduke, "theduke".toCharArray()));
      // Validate that the String credential form uses the cache
      assertTrue(sm.isValid(jduke, "theduke"));
   }
View Full Code Here

      ctx.rebind(SECURITY_MGR_PATH, ref);
   }

   private static JaasSecurityManager getSecurityManager(String name)
   {
      JaasSecurityManager manager = cache.get(name);
      if (manager != null)
      {
         //log.info("cache hit");
         return manager;
      }
      synchronized (cache)
      {
         if (manager != null)
            return manager;

         manager = new JaasSecurityManager(name, new SecurityAssociationHandler());
         cache.put(name, manager);
      }
      return manager;
   }
View Full Code Here

/*  82 */     ctx.rebind("java:/jaas", ref);
/*     */   }
/*     */
/*     */   private static JaasSecurityManager getSecurityManager(String name)
/*     */   {
/*  87 */     JaasSecurityManager manager = (JaasSecurityManager)cache.get(name);
/*  88 */     if (manager != null)
/*     */     {
/*  91 */       return manager;
/*     */     }
/*  93 */     synchronized (cache)
/*     */     {
/*  95 */       if (manager != null) {
/*  96 */         return manager;
/*     */       }
/*  98 */       manager = new JaasSecurityManager(name, new SecurityAssociationHandler());
/*  99 */       cache.put(name, manager);
/*     */     }
/* 101 */     return manager;
/*     */   }
View Full Code Here

TOP

Related Classes of org.jboss.security.plugins.JaasSecurityManager

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.