Package org.apache.directory.ldapstudio.browser.core.internal.model

Examples of org.apache.directory.ldapstudio.browser.core.internal.model.Credentials


    public ICredentials getCredentials( final ConnectionParameter connectionParameter )
    {

        if ( connectionParameter.getBindPrincipal() == null || "".equals( connectionParameter.getBindPrincipal() ) )
        {
            return new Credentials( "", "", connectionParameter );
        }
        else if ( connectionParameter.getBindPassword() != null && !"".equals( connectionParameter.getBindPassword() ) )
        {
            return new Credentials( connectionParameter.getBindPrincipal(), connectionParameter.getBindPassword(),
                connectionParameter );
        }
        else
        {
            final String[] pw = new String[1];
            PlatformUI.getWorkbench().getDisplay().syncExec( new Runnable()
            {
                public void run()
                {
                    CredentialsDialog dialog = new CredentialsDialog( PlatformUI.getWorkbench().getDisplay()
                        .getActiveShell(), "Enter Password for '" + connectionParameter.getName() + "'",
                        "Please enter password of user " + connectionParameter.getBindPrincipal() + ":", "", null );
                    if ( dialog.open() == CredentialsDialog.OK )
                    {
                        pw[0] = dialog.getValue();
                    }
                    else
                    {
                        pw[0] = null;
                    }
                }
            } );

            if ( pw[0] == null )
            {
                return null;
            }
            else
            {
                return new Credentials( connectionParameter.getBindPrincipal(), pw[0], connectionParameter );
            }
        }

    }
View Full Code Here


    public ICredentials getCredentials( final ConnectionParameter connectionParameter )
    {

        if ( connectionParameter.getBindPrincipal() == null || "".equals( connectionParameter.getBindPrincipal() ) )
        {
            return new Credentials( "", "", connectionParameter );
        }
        else if ( connectionParameter.getBindPassword() != null && !"".equals( connectionParameter.getBindPassword() ) )
        {
            return new Credentials( connectionParameter.getBindPrincipal(), connectionParameter.getBindPassword(),
                connectionParameter );
        }
        else
        {
            final String[] pw = new String[1];
            PlatformUI.getWorkbench().getDisplay().syncExec( new Runnable()
            {
                public void run()
                {
                    CredentialsDialog dialog = new CredentialsDialog( PlatformUI.getWorkbench().getDisplay()
                        .getActiveShell(), "Enter Password for '" + connectionParameter.getName() + "'",
                        "Please enter password of user " + connectionParameter.getBindPrincipal() + ":", "", null );
                    if ( dialog.open() == CredentialsDialog.OK )
                    {
                        pw[0] = dialog.getValue();
                    }
                    else
                    {
                        pw[0] = null;
                    }
                }
            } );

            if ( pw[0] == null )
            {
                return null;
            }
            else
            {
                return new Credentials( connectionParameter.getBindPrincipal(), pw[0], connectionParameter );
            }
        }

    }
View Full Code Here

TOP

Related Classes of org.apache.directory.ldapstudio.browser.core.internal.model.Credentials

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.