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");
}
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");
}
Aggregations