/** * Verifies that the server will reject a CRAM-MD5 bind with credentials containing a malformed * digest. * * @throws Exception If an unexpected problem occurs. */ @Test() public void testMalformedDigest() throws Exception { InternalClientConnection conn = new InternalClientConnection(new AuthenticationInfo()); BindOperation bindOperation = conn.processSASLBind(DN.nullDN(), SASL_MECHANISM_CRAM_MD5, null); assertEquals(bindOperation.getResultCode(), ResultCode.SASL_BIND_IN_PROGRESS); ByteString creds = ByteString.valueOf("dn:cn=Directory Manager malformeddigest"); bindOperation = conn.processSASLBind(DN.nullDN(), SASL_MECHANISM_CRAM_MD5, creds); assertFalse(bindOperation.getResultCode() == ResultCode.SUCCESS); }
/** * Verifies that the server will reject a CRAM-MD5 bind in which the first message contains SASL * credentials (which isn't allowed). * * @throws Exception If an unexpected problem occurs. */ @Test() public void testOutOfSequenceBind() throws Exception { InternalClientConnection conn = new InternalClientConnection(new AuthenticationInfo()); BindOperation bindOperation = conn.processSASLBind(DN.nullDN(), SASL_MECHANISM_CRAM_MD5, ByteString.valueOf("invalid")); assertFalse(bindOperation.getResultCode() == ResultCode.SUCCESS); }