Package org.apache.directory.api.ldap.model.constants

Examples of org.apache.directory.api.ldap.model.constants.LdapSecurityConstants


        }

        BinaryValue userPassword = ( BinaryValue ) pwdAt.get();

        // check if the given password is already hashed
        LdapSecurityConstants existingAlgo = PasswordUtil.findAlgorithm( userPassword.getValue() );

        // if there exists NO algorithm, then hash the password
        if ( existingAlgo == null )
        {
            byte[] hashedPassword = PasswordUtil.createStoragePassword( userPassword.getValue(), algorithm );
View Full Code Here


     * @param storedCredentials the credentials stored in the server
     * @return true if they are equal, false otherwise
     */
    public static boolean compareCredentials( byte[] receivedCredentials, byte[] storedCredentials )
    {
        LdapSecurityConstants algorithm = findAlgorithm( storedCredentials );

        if ( algorithm != null )
        {
            EncryptionMethod encryptionMethod = new EncryptionMethod( algorithm, null );

View Full Code Here

     * @param storedCredentials the credentials stored in the server
     * @return true if they are equal, false otherwise
     */
    public static boolean compareCredentials( byte[] receivedCredentials, byte[] storedCredentials )
    {
        LdapSecurityConstants algorithm = findAlgorithm( storedCredentials );

        if ( algorithm != null )
        {
            EncryptionMethod encryptionMethod = new EncryptionMethod( algorithm, null );

View Full Code Here

            returnPassword = null;
        }

        // save selected hash method to dialog settings, selected tab will be
        // saved on close()
        LdapSecurityConstants selectedHashMethod = getSelectedNewPasswordHashMethod();

        if ( selectedHashMethod == null )
        {
            ValueEditorsActivator.getDefault().getDialogSettings().put( SELECTED_HASH_METHOD_DIALOGSETTINGS_KEY,
                NO_HASH_METHOD );
        }
        else
        {
            ValueEditorsActivator.getDefault().getDialogSettings().put( SELECTED_HASH_METHOD_DIALOGSETTINGS_KEY,
                selectedHashMethod.getName() );
        }

        super.okPressed();
    }
View Full Code Here

        try
        {
            String hashMethodName = ValueEditorsActivator.getDefault().getDialogSettings().get(
                SELECTED_HASH_METHOD_DIALOGSETTINGS_KEY );

            LdapSecurityConstants hashMethod = LdapSecurityConstants.getAlgorithm( hashMethodName );

            if ( ( hashMethod == null ) || NO_HASH_METHOD.equals( hashMethodName ) )
            {
                newPasswordHashMethodComboViewer.setSelection( new StructuredSelection( NO_HASH_METHOD ) );
            }
View Full Code Here

     */
    private String getHashMethodName( Object o )
    {
        if ( o instanceof LdapSecurityConstants )
        {
            LdapSecurityConstants hashMethod = ( LdapSecurityConstants ) o;

            return hashMethod.getName();
        }
        else if ( ( o instanceof String ) && NO_HASH_METHOD.equals( o ) )
        {
            return BrowserCoreMessages.model__no_hash;
        }
View Full Code Here

     *
     * @return the current password hash method name
     */
    private String getCurrentPasswordHashMethodName()
    {
        LdapSecurityConstants hashMethod = currentPassword.getHashMethod();

        if ( hashMethod != null )
        {
            return Utils.getNonNullString( getHashMethodName( hashMethod ) );
        }
View Full Code Here

     * @param s the hash method string
     * @return the name of the associated hash method or the given string
     */
    private String getHashMethodName( String s )
    {
        LdapSecurityConstants hashMethod = LdapSecurityConstants.getAlgorithm( s );

        if ( hashMethod != null )
        {
            return hashMethod.getName();
        }

        return s;
    }
View Full Code Here

        {
            public String getText( Object element )
            {
                if ( element instanceof LdapSecurityConstants )
                {
                    LdapSecurityConstants hashingMethod = ( LdapSecurityConstants ) element;

                    switch ( hashingMethod )
                    {
                        case HASH_METHOD_SHA:
                            return "SHA"; //$NON-NLS-1$
View Full Code Here

            setEnabled( hashingMethodComboViewer.getCombo(), enableServerSidePasswordHashingCheckbox.getSelection() );
            setSelection( hashingMethodComboViewer, LdapSecurityConstants.HASH_METHOD_SSHA );
        }
        else
        {
            LdapSecurityConstants hashingMethod = getHashingMethodFromInterceptor( hashingMethodInterceptor );
            if ( hashingMethod != null )
            {
                // Setting selection for the hashing method
                setSelection( enableServerSidePasswordHashingCheckbox, hashingMethodInterceptor.isEnabled() );
                setEnabled( hashingMethodComboViewer.getCombo(), enableServerSidePasswordHashingCheckbox.getSelection() );
View Full Code Here

TOP

Related Classes of org.apache.directory.api.ldap.model.constants.LdapSecurityConstants

Copyright © 2018 www.massapicom. 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.