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());
}
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();
}
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);
}
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);
}
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));
}
}
}
Aggregations