public ServerSettings newPassword(String newPassword) { return new ServerSettings(type, host, port, connectionSecurity, authenticationType, username, newPassword, clientCertificateAlias); }
Map<String, String> extra = server.getExtra(); if (extra != null) { String path = extra.get(WebDavStoreSettings.PATH_KEY);
/** * Creates an "empty" {@code ServerSettings} object. * * Everything but {@link ServerSettings#type} is unused. * * @param type * see {@link ServerSettings#type} */ public ServerSettings(String type) { this.type = checkType(type); host = null; port = -1; connectionSecurity = ConnectionSecurity.NONE; authenticationType = null; username = null; password = null; clientCertificateAlias = null; extra = null; }
ServerSettings newIncoming = incoming.newPassword(mIncomingPassword); String newStoreUri = backendManager.createStoreUri(newIncoming); mAccount.setStoreUri(newStoreUri); ServerSettings newOutgoing = outgoing.newPassword(mOutgoingPassword); String newTransportUri = backendManager.createTransportUri(newOutgoing); mAccount.setTransportUri(newTransportUri);
public ServerSettings newClientCertificateAlias(String newAlias) { return new ServerSettings(type, host, port, connectionSecurity, AuthType.EXTERNAL, username, password, newAlias); }
Map<String, String> extra = server.getExtra(); String path; if (extra != null) {
ConnectionSecurity connectionSecurity, AuthType authenticationType, String username, String password, String clientCertificateAlias) { this.type = checkType(type); this.host = host; this.port = port;
private ServerSettings createServerSettings() { return new ServerSettings( "pop3", "server", 12345, ConnectionSecurity.SSL_TLS_REQUIRED, AuthType.PLAIN, "user", "password", null); } }
@Test public void testDecodeStoreUriImapPrefixOnly() { String uri = "imap://PLAIN:user:pass@server:143/customPathPrefix"; ServerSettings settings = ImapStoreUriDecoder.decode(uri); assertEquals(AuthType.PLAIN, settings.authenticationType); assertEquals("user", settings.username); assertEquals("pass", settings.password); assertEquals("server", settings.host); assertEquals(143, settings.port); assertEquals("false", settings.getExtra().get("autoDetectNamespace")); assertEquals("customPathPrefix", settings.getExtra().get("pathPrefix")); }
ConnectionSecurity connectionSecurity, AuthType authenticationType, String username, String password, String clientCertificateAlias, Map<String, String> extra) { this.type = checkType(type); this.host = host; this.port = port;
protected void onNext() { ConnectionSecurity securityType = getSelectedSecurity(); String uri; String username = null; String password = null; String clientCertificateAlias = null; AuthType authType = null; if (mRequireLoginView.isChecked()) { username = mUsernameView.getText().toString(); authType = getSelectedAuthType(); if (AuthType.EXTERNAL == authType) { clientCertificateAlias = mClientCertificateSpinner.getAlias(); } else { password = mPasswordView.getText().toString(); } } String newHost = mServerView.getText().toString(); int newPort = Integer.parseInt(mPortView.getText().toString()); ServerSettings server = new ServerSettings(Protocols.SMTP, newHost, newPort, securityType, authType, username, password, clientCertificateAlias); uri = backendManager.createTransportUri(server); DI.get(LocalKeyStoreManager.class).deleteCertificate(mAccount, newHost, newPort, MailServerDirection.OUTGOING); mAccount.setTransportUri(uri); AccountSetupCheckSettings.actionCheckSettings(this, mAccount, CheckDirection.OUTGOING); }
@Test public void testDecodeStoreUriImapAutodetectAndPrefix() { String uri = "imap://PLAIN:user:pass@server:143/1%7CcustomPathPrefix"; ServerSettings settings = ImapStoreUriDecoder.decode(uri); assertEquals(AuthType.PLAIN, settings.authenticationType); assertEquals("user", settings.username); assertEquals("pass", settings.password); assertEquals("server", settings.host); assertEquals(143, settings.port); assertEquals("true", settings.getExtra().get("autoDetectNamespace")); assertNull(settings.getExtra().get("pathPrefix")); }
ServerSettings settings = new ServerSettings(mStoreType, host, port, connectionSecurity, authType, username, password, clientCertificateAlias, extra);
@Test public void testDecodeStoreUriImapAllExtras() { String uri = "imap://PLAIN:user:pass@server:143/0%7CcustomPathPrefix"; ServerSettings settings = ImapStoreUriDecoder.decode(uri); assertEquals(AuthType.PLAIN, settings.authenticationType); assertEquals("user", settings.username); assertEquals("pass", settings.password); assertEquals("server", settings.host); assertEquals(143, settings.port); assertEquals("false", settings.getExtra().get("autoDetectNamespace")); assertEquals("customPathPrefix", settings.getExtra().get("pathPrefix")); }
return new ServerSettings("pop3", host, port, connectionSecurity, authType, username, password, clientCertificateAlias);
@Test public void testDecodeStoreUriImapEmptyPrefix() { String uri = "imap://PLAIN:user:pass@server:143/0%7C"; ServerSettings settings = ImapStoreUriDecoder.decode(uri); assertEquals(AuthType.PLAIN, settings.authenticationType); assertEquals("user", settings.username); assertEquals("pass", settings.password); assertEquals("server", settings.host); assertEquals(143, settings.port); assertEquals("false", settings.getExtra().get("autoDetectNamespace")); assertEquals("", settings.getExtra().get("pathPrefix")); }
return new ServerSettings("smtp", host, port, connectionSecurity, authType, username, password, clientCertificateAlias);
@Test public void createTransportUri_canEncodeSmtpSslUri() { ServerSettings serverSettings = new ServerSettings( "smtp", "server", 123456, ConnectionSecurity.SSL_TLS_REQUIRED, AuthType.EXTERNAL, "user", "password", "clientCert"); String result = SmtpTransportUriCreator.createSmtpUri(serverSettings); assertEquals("smtp+ssl+://user:clientCert:EXTERNAL@server:123456", result); }
@Test public void testDecodeStoreUriImapNoExtras() { String uri = "imap://PLAIN:user:pass@server:143/"; ServerSettings settings = ImapStoreUriDecoder.decode(uri); assertEquals(AuthType.PLAIN, settings.authenticationType); assertEquals("user", settings.username); assertEquals("pass", settings.password); assertEquals("server", settings.host); assertEquals(143, settings.port); assertEquals("true", settings.getExtra().get("autoDetectNamespace")); }