/** * Creates a new instance of MemoryClearingBuffer from a * <code>byte[]</code>. * * @param bytes A byte[] * @return A buffer */ public static MemoryClearingBuffer newInstance( byte[] bytes ) { return new MemoryClearingBuffer( bytes, null, false, false ); }
/** * Returns the <code>byte[]</code> used to create this buffer, or * getComputedBytes() if created with a <code>char[]</code>. * * @return A byte[] */ public byte[] getBytes() { return originalBytes == null ? getComputedBytes() : originalBytes; }
/** * Returns the <code>char[]</code> used to create this buffer, or * getComputedChars() if created with a <code>byte[]</code>. * * @return A byte[] */ public char[] getChars() { return precomputedChars == null ? getComputedChars() : precomputedChars; } }
@Override public ResultResponse process() throws LdapException { MemoryClearingBuffer passwordBuffer = MemoryClearingBuffer.newInstance( password ); try { BindRequest bindRequest = new BindRequestImpl() .setDn( userDn ) .setCredentials( passwordBuffer.getBytes() ) .addControl( passwordPolicyRequestControl ); return connection.bind( bindRequest ); } finally { passwordBuffer.clear(); } } } );
@Override public ResultResponse process() throws PasswordException, LdapException { // Can't use Password Modify: // https://issues.apache.org/jira/browse/DIRSERVER-1935 // So revert to regular Modify MemoryClearingBuffer newPasswordBuffer = MemoryClearingBuffer.newInstance( newPassword ); try { ModifyRequest modifyRequest = new ModifyRequestImpl() .setName( userDn ) .replace( "userPassword", newPasswordBuffer.getComputedBytes() ) .addControl( passwordPolicyRequestControl ); return connection.modify( modifyRequest ); } finally { newPasswordBuffer.clear(); } } } );
@Override public ResultResponse process() throws LdapException { MemoryClearingBuffer passwordBuffer = MemoryClearingBuffer.newInstance( password ); try { BindRequest bindRequest = new BindRequestImpl() .setDn( userDn ) .setCredentials( passwordBuffer.getBytes() ) .addControl( passwordPolicyRequestControl ); return connection.bind( bindRequest ); } finally { passwordBuffer.clear(); } } } );
@Override public ResultResponse process() throws PasswordException, LdapException { // Can't use Password Modify: // https://issues.apache.org/jira/browse/DIRSERVER-1935 // So revert to regular Modify MemoryClearingBuffer newPasswordBuffer = MemoryClearingBuffer.newInstance( newPassword ); try { ModifyRequest modifyRequest = new ModifyRequestImpl() .setName( userDn ) .replace( "userPassword", newPasswordBuffer.getComputedBytes() ) .addControl( passwordPolicyRequestControl ); return connection.modify( modifyRequest ); } finally { newPasswordBuffer.clear(); } } } );
@Override public ResultResponse process() throws LdapException { MemoryClearingBuffer passwordBuffer = MemoryClearingBuffer.newInstance( password ); try { BindRequest bindRequest = new BindRequestImpl() .setDn( userDn ) .setCredentials( passwordBuffer.getBytes() ) .addControl( passwordPolicyRequestControl ); return connection.bind( bindRequest ); } finally { passwordBuffer.clear(); } } } );
@Override public ResultResponse process() throws PasswordException, LdapException { // Can't use Password Modify: // https://issues.apache.org/jira/browse/DIRSERVER-1935 // So revert to regular Modify MemoryClearingBuffer newPasswordBuffer = MemoryClearingBuffer.newInstance( newPassword ); try { ModifyRequest modifyRequest = new ModifyRequestImpl() .setName( userDn ) .replace( "userPassword", newPasswordBuffer.getComputedBytes() ) .addControl( passwordPolicyRequestControl ); return connection.modify( modifyRequest ); } finally { newPasswordBuffer.clear(); } } } );
/** * Creates a new instance of MemoryClearingBuffer from a * <code>char[]</code>. * * @param chars A char[] * @return A buffer */ public static MemoryClearingBuffer newInstance( char[] chars ) { return new MemoryClearingBuffer( null, chars, false, false ); }
/** * Returns the <code>byte[]</code> used to create this buffer, or * getComputedBytes() if created with a <code>char[]</code>. * * @return A byte[] */ public byte[] getBytes() { return originalBytes == null ? getComputedBytes() : originalBytes; }
/** * Returns the <code>char[]</code> used to create this buffer, or * getComputedChars() if created with a <code>byte[]</code>. * * @return A byte[] */ public char[] getChars() { return precomputedChars == null ? getComputedChars() : precomputedChars; } }
/** * Creates a new instance of MemoryClearingBuffer from a * <code>byte[]</code>. * * @param bytes A byte[] * @return A buffer */ public static MemoryClearingBuffer newInstance( byte[] bytes ) { return new MemoryClearingBuffer( bytes, null, false, false ); }
/** * Returns the <code>byte[]</code> used to create this buffer, or * getComputedBytes() if created with a <code>char[]</code>. * * @return A byte[] */ public byte[] getBytes() { return originalBytes == null ? getComputedBytes() : originalBytes; }
/** * Returns the <code>char[]</code> used to create this buffer, or * getComputedChars() if created with a <code>byte[]</code>. * * @return A byte[] */ public char[] getChars() { return precomputedChars == null ? getComputedChars() : precomputedChars; } }
/** * Creates a new instance of MemoryClearingBuffer from a * <code>char[]</code>. * * @param chars A char[] * @return A buffer */ public static MemoryClearingBuffer newInstance( char[] chars ) { return new MemoryClearingBuffer( null, chars, false, false ); }
/** * Creates a new instance of MemoryClearingBuffer from a * <code>byte[]</code>. * * @param bytes A byte[] * @return A buffer */ public static MemoryClearingBuffer newInstance( byte[] bytes ) { return new MemoryClearingBuffer( bytes, null, false, false ); }
/** * Creates a new instance of MemoryClearingBuffer from a * <code>char[]</code>. * * @param chars A char[] * @return A buffer */ public static MemoryClearingBuffer newInstance( char[] chars ) { return new MemoryClearingBuffer( null, chars, false, false ); }
/** * Creates a new instance of MemoryClearingBuffer from a * <code>char[]</code>, optionally performing whitespace trimming and * conversion to lower case. * * @param chars A char[] * @param trim If true, whitespace will be trimmed off of both ends of the * <code>char[]</code> * @param lowerCase If true, the characters will be converted to lower case * @return A buffer */ public static MemoryClearingBuffer newInstance( char[] chars, boolean trim, boolean lowerCase ) { return new MemoryClearingBuffer( null, chars, trim, lowerCase ); }
/** * Creates a new instance of MemoryClearingBuffer from a * <code>char[]</code>, optionally performing whitespace trimming and * conversion to lower case. * * @param chars A char[] * @param trim If true, whitespace will be trimmed off of both ends of the * <code>char[]</code> * @param lowerCase If true, the characters will be converted to lower case * @return A buffer */ public static MemoryClearingBuffer newInstance( char[] chars, boolean trim, boolean lowerCase ) { return new MemoryClearingBuffer( null, chars, trim, lowerCase ); }