Search in sources :

Example 16 with Credentials

use of com.mucommander.commons.file.Credentials in project mucommander by mucommander.

the class AuthDialog method comboBoxSelectionChanged.

// ///////////////////////////////////////////
// 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());
}
Also used : Credentials(com.mucommander.commons.file.Credentials) CredentialsMapping(com.mucommander.auth.CredentialsMapping)

Example 17 with Credentials

use of com.mucommander.commons.file.Credentials in project mucommander by mucommander.

the class EditCredentialsDialog method modifyCredentials.

/**
 * Updates the value of the item that was being editing. Should be called whenever the list selection has changed.
 */
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();
}
Also used : Credentials(com.mucommander.commons.file.Credentials) CredentialsMapping(com.mucommander.auth.CredentialsMapping)

Example 18 with Credentials

use of com.mucommander.commons.file.Credentials in project mucommander by mucommander.

the class Activator method start.

@Override
public void start(BundleContext context) throws Exception {
    FileProtocolService service = new FileProtocolService() {

        @Override
        public String getSchema() {
            return "dropbox";
        }

        @Override
        public ProtocolProvider getProtocolProvider() {
            return new DropboxProtocolProvider();
        }

        @Override
        public SchemeHandler getSchemeHandler() {
            return new DefaultSchemeHandler(new DefaultSchemeParser(), 21, "/", AuthenticationType.NO_AUTHENTICATION, new Credentials("anonymous", "anonymous_coward@mucommander.com"));
        }
    };
    ProtocolPanelProvider panelProvider = new ProtocolPanelProvider() {

        @Override
        public String getSchema() {
            return "dropbox";
        }

        @Override
        public ServerPanel get(ServerPanelListener listener, JFrame mainFrame) {
            return new DropboxPanel(listener, mainFrame);
        }

        @Override
        public int priority() {
            return 5000;
        }

        @Override
        public Class<? extends ServerPanel> getPanelClass() {
            return DropboxPanel.class;
        }
    };
    serviceRegistration = context.registerService(FileProtocolService.class, service, null);
    uiServiceRegistration = context.registerService(ProtocolPanelProvider.class, panelProvider, null);
}
Also used : ServerPanelListener(com.mucommander.protocol.ui.ServerPanelListener) DefaultSchemeParser(com.mucommander.commons.file.DefaultSchemeParser) JFrame(javax.swing.JFrame) ProtocolPanelProvider(com.mucommander.protocol.ui.ProtocolPanelProvider) Credentials(com.mucommander.commons.file.Credentials) FileProtocolService(com.mucommander.commons.file.osgi.FileProtocolService) DefaultSchemeHandler(com.mucommander.commons.file.DefaultSchemeHandler)

Example 19 with Credentials

use of com.mucommander.commons.file.Credentials in project mucommander by mucommander.

the class Activator method start.

@Override
public void start(BundleContext context) throws Exception {
    FileProtocolService service = new FileProtocolService() {

        @Override
        public String getSchema() {
            return "ftp";
        }

        @Override
        public ProtocolProvider getProtocolProvider() {
            return new FTPProtocolProvider();
        }

        @Override
        public SchemeHandler getSchemeHandler() {
            return new DefaultSchemeHandler(new DefaultSchemeParser(), 21, "/", AuthenticationType.AUTHENTICATION_REQUIRED, new Credentials("anonymous", "anonymous_coward@mucommander.com"));
        }
    };
    ProtocolPanelProvider panelProvider = new ProtocolPanelProvider() {

        @Override
        public String getSchema() {
            return "ftp";
        }

        @Override
        public ServerPanel get(ServerPanelListener listener, JFrame mainFrame) {
            return new FTPPanel(listener, mainFrame);
        }

        @Override
        public int priority() {
            return 5000;
        }

        @Override
        public Class<? extends ServerPanel> getPanelClass() {
            return FTPPanel.class;
        }
    };
    serviceRegistration = context.registerService(FileProtocolService.class, service, null);
    uiServiceRegistration = context.registerService(ProtocolPanelProvider.class, panelProvider, null);
}
Also used : ServerPanelListener(com.mucommander.protocol.ui.ServerPanelListener) DefaultSchemeParser(com.mucommander.commons.file.DefaultSchemeParser) JFrame(javax.swing.JFrame) ProtocolPanelProvider(com.mucommander.protocol.ui.ProtocolPanelProvider) Credentials(com.mucommander.commons.file.Credentials) FileProtocolService(com.mucommander.commons.file.osgi.FileProtocolService) DefaultSchemeHandler(com.mucommander.commons.file.DefaultSchemeHandler)

Example 20 with Credentials

use of com.mucommander.commons.file.Credentials in project mucommander by mucommander.

the class CredentialsManager method authenticateImplicit.

/**
 * Looks for the best set of credentials matching the given location (if any) and use it to authenticate the
 * URL by calling {@link #authenticate(com.mucommander.commons.file.FileURL, CredentialsMapping)}.
 * Returns <code>true</code> if a set of credentials was found and used to authenticate the URL, <code>false</code>
 * otherwise.
 *
 * <p>Credentials are first looked for using {@link #getMatchingCredentials(com.mucommander.commons.file.FileURL)}.
 * If there is no match, guest credentials are retrieved from the URL and used (if any).</p>
 *
 * @param location the FileURL to authenticate
 */
private static void authenticateImplicit(FileURL location) {
    LOGGER.trace("called, fileURL=" + location + " containsCredentials=" + location.containsCredentials());
    CredentialsMapping[] creds = getMatchingCredentials(location);
    if (creds.length > 0) {
        authenticate(location, creds[0]);
    } else {
        Credentials guestCredentials = location.getGuestCredentials();
        if (guestCredentials != null) {
            authenticate(location, new CredentialsMapping(guestCredentials, location.getRealm(), false));
        }
    }
}
Also used : Credentials(com.mucommander.commons.file.Credentials)

Aggregations

Credentials (com.mucommander.commons.file.Credentials)25 FileURL (com.mucommander.commons.file.FileURL)16 CredentialsMapping (com.mucommander.auth.CredentialsMapping)5 DefaultSchemeHandler (com.mucommander.commons.file.DefaultSchemeHandler)4 DefaultSchemeParser (com.mucommander.commons.file.DefaultSchemeParser)4 FileProtocolService (com.mucommander.commons.file.osgi.FileProtocolService)4 ProtocolPanelProvider (com.mucommander.protocol.ui.ProtocolPanelProvider)4 ServerPanelListener (com.mucommander.protocol.ui.ServerPanelListener)4 JFrame (javax.swing.JFrame)4 AuthException (com.mucommander.commons.file.AuthException)2 IOException (java.io.IOException)2 JSch (com.jcraft.jsch.JSch)1 JSchException (com.jcraft.jsch.JSchException)1 XmlAttributes (com.mucommander.commons.util.xml.XmlAttributes)1 XmlWriter (com.mucommander.commons.util.xml.XmlWriter)1 InterruptedIOException (java.io.InterruptedIOException)1 StringTokenizer (java.util.StringTokenizer)1 Jets3tProperties (org.jets3t.service.Jets3tProperties)1 S3Service (org.jets3t.service.S3Service)1 RestS3Service (org.jets3t.service.impl.rest.httpclient.RestS3Service)1