Search in sources :

Example 1 with UnboundIDCertificatePlusPasswordBindRequest

use of com.unboundid.ldap.sdk.unboundidds.UnboundIDCertificatePlusPasswordBindRequest in project ldapsdk by pingidentity.

the class SASLUtilsTestCase method testValidCertificatePlusPasswordBindPWProvided.

/**
 * Tests the ability to create a valid UNBOUNDID-CERTIFICATE-PLUS-PASSWORD
 * bind request when a password was provided.
 *
 * @throws  Exception  If an unexpected problem occurs.
 */
@Test()
public void testValidCertificatePlusPasswordBindPWProvided() throws Exception {
    final BindRequest bindRequest = SASLUtils.createBindRequest(null, "password", null, "mech=UNBOUNDID-CERTIFICATE-PLUS-PASSWORD");
    assertNotNull(bindRequest);
    assertTrue(bindRequest instanceof UnboundIDCertificatePlusPasswordBindRequest);
    final UnboundIDCertificatePlusPasswordBindRequest certPlusPWBind = (UnboundIDCertificatePlusPasswordBindRequest) bindRequest;
    assertNotNull(certPlusPWBind.getPassword());
    assertEquals(certPlusPWBind.getPassword().stringValue(), "password");
}
Also used : UnboundIDCertificatePlusPasswordBindRequest(com.unboundid.ldap.sdk.unboundidds.UnboundIDCertificatePlusPasswordBindRequest) ANONYMOUSBindRequest(com.unboundid.ldap.sdk.ANONYMOUSBindRequest) GSSAPIBindRequest(com.unboundid.ldap.sdk.GSSAPIBindRequest) UnboundIDCertificatePlusPasswordBindRequest(com.unboundid.ldap.sdk.unboundidds.UnboundIDCertificatePlusPasswordBindRequest) BindRequest(com.unboundid.ldap.sdk.BindRequest) SCRAMSHA512BindRequest(com.unboundid.ldap.sdk.SCRAMSHA512BindRequest) SingleUseTOTPBindRequest(com.unboundid.ldap.sdk.unboundidds.SingleUseTOTPBindRequest) PLAINBindRequest(com.unboundid.ldap.sdk.PLAINBindRequest) UnboundIDYubiKeyOTPBindRequest(com.unboundid.ldap.sdk.unboundidds.UnboundIDYubiKeyOTPBindRequest) EXTERNALBindRequest(com.unboundid.ldap.sdk.EXTERNALBindRequest) DIGESTMD5BindRequest(com.unboundid.ldap.sdk.DIGESTMD5BindRequest) UnboundIDDeliveredOTPBindRequest(com.unboundid.ldap.sdk.unboundidds.UnboundIDDeliveredOTPBindRequest) OAUTHBEARERBindRequest(com.unboundid.ldap.sdk.OAUTHBEARERBindRequest) UnboundIDTOTPBindRequest(com.unboundid.ldap.sdk.unboundidds.UnboundIDTOTPBindRequest) SCRAMSHA1BindRequest(com.unboundid.ldap.sdk.SCRAMSHA1BindRequest) SCRAMSHA256BindRequest(com.unboundid.ldap.sdk.SCRAMSHA256BindRequest) CRAMMD5BindRequest(com.unboundid.ldap.sdk.CRAMMD5BindRequest) Test(org.testng.annotations.Test)

Example 2 with UnboundIDCertificatePlusPasswordBindRequest

use of com.unboundid.ldap.sdk.unboundidds.UnboundIDCertificatePlusPasswordBindRequest in project ldapsdk by pingidentity.

the class SASLUtilsTestCase method testValidCertificatePlusPasswordBindPWPrompted.

/**
 * Tests the ability to create a valid UNBOUNDID-CERTIFICATE-PLUS-PASSWORD
 * bind request when a password must be obtained via prompt.
 *
 * @throws  Exception  If an unexpected problem occurs.
 */
@Test()
public void testValidCertificatePlusPasswordBindPWPrompted() throws Exception {
    final LDAPSearch tool = new LDAPSearch(null, null);
    final BindRequest bindRequest;
    try {
        PasswordReader.setTestReader(new BufferedReader(new InputStreamReader(new ByteArrayInputStream("password\n".getBytes("UTF-8")))));
        bindRequest = SASLUtils.createBindRequest(null, (byte[]) null, false, tool, null, Arrays.asList("mech=UNBOUNDID-CERTIFICATE-PLUS-PASSWORD"));
    } finally {
        PasswordReader.setTestReader(null);
    }
    assertNotNull(bindRequest);
    assertTrue(bindRequest instanceof UnboundIDCertificatePlusPasswordBindRequest);
    final UnboundIDCertificatePlusPasswordBindRequest certPlusPWBind = (UnboundIDCertificatePlusPasswordBindRequest) bindRequest;
    assertNotNull(certPlusPWBind.getPassword());
    assertEquals(certPlusPWBind.getPassword().stringValue(), "password");
}
Also used : UnboundIDCertificatePlusPasswordBindRequest(com.unboundid.ldap.sdk.unboundidds.UnboundIDCertificatePlusPasswordBindRequest) InputStreamReader(java.io.InputStreamReader) ByteArrayInputStream(java.io.ByteArrayInputStream) LDAPSearch(com.unboundid.ldap.sdk.examples.LDAPSearch) ANONYMOUSBindRequest(com.unboundid.ldap.sdk.ANONYMOUSBindRequest) GSSAPIBindRequest(com.unboundid.ldap.sdk.GSSAPIBindRequest) UnboundIDCertificatePlusPasswordBindRequest(com.unboundid.ldap.sdk.unboundidds.UnboundIDCertificatePlusPasswordBindRequest) BindRequest(com.unboundid.ldap.sdk.BindRequest) SCRAMSHA512BindRequest(com.unboundid.ldap.sdk.SCRAMSHA512BindRequest) SingleUseTOTPBindRequest(com.unboundid.ldap.sdk.unboundidds.SingleUseTOTPBindRequest) PLAINBindRequest(com.unboundid.ldap.sdk.PLAINBindRequest) UnboundIDYubiKeyOTPBindRequest(com.unboundid.ldap.sdk.unboundidds.UnboundIDYubiKeyOTPBindRequest) EXTERNALBindRequest(com.unboundid.ldap.sdk.EXTERNALBindRequest) DIGESTMD5BindRequest(com.unboundid.ldap.sdk.DIGESTMD5BindRequest) UnboundIDDeliveredOTPBindRequest(com.unboundid.ldap.sdk.unboundidds.UnboundIDDeliveredOTPBindRequest) OAUTHBEARERBindRequest(com.unboundid.ldap.sdk.OAUTHBEARERBindRequest) UnboundIDTOTPBindRequest(com.unboundid.ldap.sdk.unboundidds.UnboundIDTOTPBindRequest) SCRAMSHA1BindRequest(com.unboundid.ldap.sdk.SCRAMSHA1BindRequest) SCRAMSHA256BindRequest(com.unboundid.ldap.sdk.SCRAMSHA256BindRequest) CRAMMD5BindRequest(com.unboundid.ldap.sdk.CRAMMD5BindRequest) BufferedReader(java.io.BufferedReader) Test(org.testng.annotations.Test)

Aggregations

ANONYMOUSBindRequest (com.unboundid.ldap.sdk.ANONYMOUSBindRequest)2 BindRequest (com.unboundid.ldap.sdk.BindRequest)2 CRAMMD5BindRequest (com.unboundid.ldap.sdk.CRAMMD5BindRequest)2 DIGESTMD5BindRequest (com.unboundid.ldap.sdk.DIGESTMD5BindRequest)2 EXTERNALBindRequest (com.unboundid.ldap.sdk.EXTERNALBindRequest)2 GSSAPIBindRequest (com.unboundid.ldap.sdk.GSSAPIBindRequest)2 OAUTHBEARERBindRequest (com.unboundid.ldap.sdk.OAUTHBEARERBindRequest)2 PLAINBindRequest (com.unboundid.ldap.sdk.PLAINBindRequest)2 SCRAMSHA1BindRequest (com.unboundid.ldap.sdk.SCRAMSHA1BindRequest)2 SCRAMSHA256BindRequest (com.unboundid.ldap.sdk.SCRAMSHA256BindRequest)2 SCRAMSHA512BindRequest (com.unboundid.ldap.sdk.SCRAMSHA512BindRequest)2 SingleUseTOTPBindRequest (com.unboundid.ldap.sdk.unboundidds.SingleUseTOTPBindRequest)2 UnboundIDCertificatePlusPasswordBindRequest (com.unboundid.ldap.sdk.unboundidds.UnboundIDCertificatePlusPasswordBindRequest)2 UnboundIDDeliveredOTPBindRequest (com.unboundid.ldap.sdk.unboundidds.UnboundIDDeliveredOTPBindRequest)2 UnboundIDTOTPBindRequest (com.unboundid.ldap.sdk.unboundidds.UnboundIDTOTPBindRequest)2 UnboundIDYubiKeyOTPBindRequest (com.unboundid.ldap.sdk.unboundidds.UnboundIDYubiKeyOTPBindRequest)2 Test (org.testng.annotations.Test)2 LDAPSearch (com.unboundid.ldap.sdk.examples.LDAPSearch)1 BufferedReader (java.io.BufferedReader)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1