Examples of AnonymousSASLMechanismHandler


Examples of org.nasutekds.server.extensions.AnonymousSASLMechanismHandler

   */
  @Test()
  public void testDoSASLBindAnonymous()
         throws Exception
  {
    AnonymousSASLMechanismHandler handler = new AnonymousSASLMechanismHandler();
    handler.initializeSASLMechanismHandler(null);

    Socket s = new Socket("127.0.0.1", TestCaseUtils.getServerLdapPort());
    LDAPReader r = new LDAPReader(s);
    LDAPWriter w = new LDAPWriter(s);

    AtomicInteger          messageID        = new AtomicInteger(1);
    ArrayList<Control> requestControls  = new ArrayList<Control>();
    ArrayList<Control> responseControls = new ArrayList<Control>();

    LinkedHashMap<String,List<String>> saslProperties =
         new LinkedHashMap<String,List<String>>();
    ArrayList<String> propList = new ArrayList<String>();
    propList.add("testDoSASLBindAnonymous");
    saslProperties.put("trace", propList);

    LDAPAuthenticationHandler authHandler =
         new LDAPAuthenticationHandler(r, w, "localhost", messageID);

    authHandler.doSASLBind(ByteString.empty(), ByteString.empty(),
                           "ANONYMOUS", saslProperties, requestControls,
                           responseControls);
    s.close();
    handler.finalizeSASLMechanismHandler();
  }
View Full Code Here

Examples of org.nasutekds.server.extensions.AnonymousSASLMechanismHandler

   */
  @Test()
  public void testDoSASLBindAnonymousNoTrace()
         throws Exception
  {
    AnonymousSASLMechanismHandler handler = new AnonymousSASLMechanismHandler();
    handler.initializeSASLMechanismHandler(null);

    Socket s = new Socket("127.0.0.1", TestCaseUtils.getServerLdapPort());
    LDAPReader r = new LDAPReader(s);
    LDAPWriter w = new LDAPWriter(s);

    AtomicInteger          messageID        = new AtomicInteger(1);
    ArrayList<Control> requestControls  = new ArrayList<Control>();
    ArrayList<Control> responseControls = new ArrayList<Control>();

    LinkedHashMap<String,List<String>> saslProperties =
         new LinkedHashMap<String,List<String>>();

    LDAPAuthenticationHandler authHandler =
         new LDAPAuthenticationHandler(r, w, "localhost", messageID);

    authHandler.doSASLBind(ByteString.empty(), ByteString.empty(),
                           "ANONYMOUS", saslProperties, requestControls,
                           responseControls);
    s.close();
    handler.finalizeSASLMechanismHandler();
  }
View Full Code Here

Examples of org.nasutekds.server.extensions.AnonymousSASLMechanismHandler

   */
  @Test(expectedExceptions = { ClientException.class })
  public void testDoSASLBindAnonymousMultivaluedTrace()
         throws Exception
  {
    AnonymousSASLMechanismHandler handler = new AnonymousSASLMechanismHandler();
    handler.initializeSASLMechanismHandler(null);

    Socket s = new Socket("127.0.0.1", TestCaseUtils.getServerLdapPort());
    LDAPReader r = new LDAPReader(s);
    LDAPWriter w = new LDAPWriter(s);

    AtomicInteger          messageID        = new AtomicInteger(1);
    ArrayList<Control> requestControls  = new ArrayList<Control>();
    ArrayList<Control> responseControls = new ArrayList<Control>();

    LinkedHashMap<String,List<String>> saslProperties =
         new LinkedHashMap<String,List<String>>();
    ArrayList<String> propList = new ArrayList<String>();
    propList.add("testDoSASLBindAnonymousMultivaluedTrace");
    propList.add("aSecondTraceStringWhichIsInvalid");
    saslProperties.put("trace", propList);

    LDAPAuthenticationHandler authHandler =
         new LDAPAuthenticationHandler(r, w, "localhost", messageID);

    try
    {
      authHandler.doSASLBind(ByteString.empty(), ByteString.empty(),
                             "ANONYMOUS", saslProperties, requestControls,
                             responseControls);
    }
    finally
    {
      s.close();
      handler.finalizeSASLMechanismHandler();
    }
  }
View Full Code Here

Examples of org.nasutekds.server.extensions.AnonymousSASLMechanismHandler

   */
  @Test(expectedExceptions = { ClientException.class })
  public void testDoSASLBindAnonymousInvalidProperty()
         throws Exception
  {
    AnonymousSASLMechanismHandler handler = new AnonymousSASLMechanismHandler();
    handler.initializeSASLMechanismHandler(null);

    Socket s = new Socket("127.0.0.1", TestCaseUtils.getServerLdapPort());
    LDAPReader r = new LDAPReader(s);
    LDAPWriter w = new LDAPWriter(s);

    AtomicInteger          messageID        = new AtomicInteger(1);
    ArrayList<Control> requestControls  = new ArrayList<Control>();
    ArrayList<Control> responseControls = new ArrayList<Control>();

    LinkedHashMap<String,List<String>> saslProperties =
         new LinkedHashMap<String,List<String>>();
    ArrayList<String> propList = new ArrayList<String>();
    propList.add("testDoSASLBindAnonymousInvalidProperty");
    saslProperties.put("invalid", propList);

    LDAPAuthenticationHandler authHandler =
         new LDAPAuthenticationHandler(r, w, "localhost", messageID);

    try
    {
      authHandler.doSASLBind(ByteString.empty(), ByteString.empty(),
                             "ANONYMOUS", saslProperties, requestControls,
                             responseControls);
    }
    finally
    {
      s.close();
      handler.finalizeSASLMechanismHandler();
    }
  }
View Full Code Here

Examples of org.nasutekds.server.extensions.AnonymousSASLMechanismHandler

   */
  @Test()
  public void testDoSASLBindAnonymousWithPasswordPolicyControl()
         throws Exception
  {
    AnonymousSASLMechanismHandler handler = new AnonymousSASLMechanismHandler();
    handler.initializeSASLMechanismHandler(null);

    Socket s = new Socket("127.0.0.1", TestCaseUtils.getServerLdapPort());
    LDAPReader r = new LDAPReader(s);
    LDAPWriter w = new LDAPWriter(s);

    AtomicInteger          messageID        = new AtomicInteger(1);
    ArrayList<Control> requestControls  = new ArrayList<Control>();
    ArrayList<Control> responseControls = new ArrayList<Control>();

    requestControls.add(new PasswordPolicyRequestControl());

    LinkedHashMap<String,List<String>> saslProperties =
         new LinkedHashMap<String,List<String>>();
    ArrayList<String> propList = new ArrayList<String>();
    propList.add("testDoSASLBindAnonymous");
    saslProperties.put("trace", propList);

    LDAPAuthenticationHandler authHandler =
         new LDAPAuthenticationHandler(r, w, "localhost", messageID);

    authHandler.doSASLBind(ByteString.empty(), ByteString.empty(),
                           "ANONYMOUS", saslProperties, requestControls,
                           responseControls);
    s.close();
    handler.finalizeSASLMechanismHandler();
  }
View Full Code Here

Examples of org.nasutekds.server.extensions.AnonymousSASLMechanismHandler

   */
  @Test()
  public void testRequestAuthorizationIdentitySASLAnonymous()
         throws Exception
  {
    AnonymousSASLMechanismHandler handler = new AnonymousSASLMechanismHandler();
    handler.initializeSASLMechanismHandler(null);

    Socket s = new Socket("127.0.0.1", TestCaseUtils.getServerLdapPort());
    LDAPReader r = new LDAPReader(s);
    LDAPWriter w = new LDAPWriter(s);

    AtomicInteger          messageID        = new AtomicInteger(1);
    ArrayList<Control> requestControls  = new ArrayList<Control>();
    ArrayList<Control> responseControls = new ArrayList<Control>();

    LinkedHashMap<String,List<String>> saslProperties =
         new LinkedHashMap<String,List<String>>();
    ArrayList<String> propList = new ArrayList<String>();
    propList.add("testDoSASLBindAnonymous");
    saslProperties.put("trace", propList);

    LDAPAuthenticationHandler authHandler =
         new LDAPAuthenticationHandler(r, w, "localhost", messageID);

    authHandler.doSASLBind(ByteString.empty(), ByteString.empty(),
                           "ANONYMOUS", saslProperties, requestControls,
                           responseControls);
    assertNull(authHandler.requestAuthorizationIdentity());

    s.close();
    handler.finalizeSASLMechanismHandler();
  }
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.