Package com.mucommander.auth

Examples of com.mucommander.auth.CredentialsMapping


      // Show some progress in the progress bar to give hope
      folderPanel.setProgressValue(10);

      boolean userCancelled = false;
      CredentialsMapping newCredentialsMapping = null;
      // True if Guest authentication was selected in the authentication dialog (guest credentials must not be
      // added to CredentialsManager)
      boolean guestCredentialsSelected = false;

      AuthenticationType authenticationType = folderURL.getAuthenticationType();
View Full Code Here


            FileURL serverURL = currentServerPanel.getServerURL()// Can throw a MalformedURLException

            // Create a CredentialsMapping instance and pass to Folder so that it uses it to connect to the folder and
            // adds to CredentialsManager once the folder has been successfully changed
            Credentials credentials = serverURL.getCredentials();
            CredentialsMapping credentialsMapping;
            if(credentials!=null) {
                credentialsMapping = new CredentialsMapping(credentials, serverURL, saveCredentialsCheckBox.isSelected());
            }
            else {
                credentialsMapping = null;
            }
View Full Code Here

                Credentials credentials = url.getCredentials();

                // If the URL contains credentials, import them into CredentialsManager and remove credentials
                // from the bookmark's location
                if(credentials!=null) {
                    CredentialsManager.addCredentials(new CredentialsMapping(credentials, url, true));
                    bookmarkLocation = url.toString(false);
                }
                else {
                    bookmarkLocation = characters.toString().trim();
                }
View Full Code Here

        if(urlCredentials!=null) {
            selectedCredentials = urlCredentials;
        }
        // Else if CredentialsManager had matching credentials, use the best ones 
        else if(nbCredentials>0) {
            CredentialsMapping bestCredentialsMapping = credentialsMappings[0];

            selectedCredentials = bestCredentialsMapping.getCredentials();
            saveCredentialsCheckBoxSelected = bestCredentialsMapping.isPersistent();
        }

        yPanel.add(compPanel);

        this.saveCredentialsCheckBox = new JCheckBox(Translator.get("auth_dialog.store_credentials"), saveCredentialsCheckBoxSelected);
View Full Code Here

     * been pressed in a text field.
     */
    private void setCredentialMapping() {
        if(guestRadioButton!=null && guestRadioButton.isSelected()) {
            guestCredentialsSelected = true;
            selectedCredentialsMapping = new CredentialsMapping(fileURL.getGuestCredentials(), fileURL, false);
        }
        else {
            Credentials enteredCredentials = new Credentials(loginField.getText(), new String(passwordField.getPassword()));
            guestCredentialsSelected = false;

            boolean isPersistent = saveCredentialsCheckBox.isSelected();
            selectedCredentialsMapping = new CredentialsMapping(enteredCredentials, fileURL, isPersistent);

            // Look for an existing matching CredentialsMapping instance to re-use the realm which may contain
            // connection properties.
            int nbCredentials = credentialsMappings.length;
            CredentialsMapping cm;
            for(int i=0; i<nbCredentials; i++) {
                cm = credentialsMappings[i];
                if(cm.getCredentials().equals(enteredCredentials, true)) {  // Comparison must be password-sensitive
                    // Create a new CredentialsMapping instance in case the 'isPersistent' flag has changed.
                    // (original credentials may have originally been added as 'volatile' and then made persistent by
                    // ticking the checkbox, or vice-versa)
                    selectedCredentialsMapping = new CredentialsMapping(cm.getCredentials(), cm.getRealm(), isPersistent);
                    break;
                }
            }
        }
    }
View Full Code Here

    /////////////////////////////////////////////
    // EditableComboBoxListener implementation //
    /////////////////////////////////////////////

    public void comboBoxSelectionChanged(SaneComboBox source) {
        CredentialsMapping selectedCredentialsMapping = credentialsMappings[loginComboBox.getSelectedIndex()];
        Credentials selectedCredentials = selectedCredentialsMapping.getCredentials();
        loginField.setText(selectedCredentials.getLogin());
        passwordField.setText(selectedCredentials.getPassword());

        // Enable/disable 'save credentials' checkbox depending on whether the selected credentials are persistent or not
        if(saveCredentialsCheckBox!=null)
            saveCredentialsCheckBox.setSelected(selectedCredentialsMapping.isPersistent());
    }
View Full Code Here

        boolean componentsEnabled = false;

        if(!credentialsList.isSelectionEmpty() && credentials.size()>0) {
            componentsEnabled = true;

            CredentialsMapping credentialsMapping = (CredentialsMapping) credentialsList.getSelectedValue();
            Credentials credentials = credentialsMapping.getCredentials();
            loginValue = credentials.getLogin();
            passwordValue = credentials.getPassword();
        }

        loginField.setText(loginValue);
View Full Code Here

     */
    private void modifyCredentials() {
        // Make sure that the item still exists (could have been removed) before trying to modify its value
        int itemIndex = credentials.indexOf(lastSelectedItem);
        if(lastSelectedItem!=null && itemIndex!=-1) {
            credentials.setElementAt(new CredentialsMapping(new Credentials(loginField.getText(), new String(passwordField.getPassword())), lastSelectedItem.getRealm(), true), itemIndex);
        }
       
        this.lastSelectedItem = (CredentialsMapping) credentialsList.getSelectedValue();
    }
View Full Code Here

        if(path == null)
            return getHomeFolder().getURL();

        // Tries the specified path as-is.
        AbstractFile file;
        CredentialsMapping newCredentialsMapping;

        while(true) {
            try {
                file = FileFactory.getFile(path, true);
                if(!file.exists())
View Full Code Here

TOP

Related Classes of com.mucommander.auth.CredentialsMapping

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.