use of com.fsck.k9.mail.ServerSettings in project k-9 by k9mail.
the class SmtpTransportTest method startServerAndCreateSmtpTransport.
private SmtpTransport startServerAndCreateSmtpTransport(MockSmtpServer server, AuthType authenticationType, ConnectionSecurity connectionSecurity, String password) throws IOException, MessagingException {
server.start();
String host = server.getHost();
int port = server.getPort();
ServerSettings serverSettings = new ServerSettings(Type.SMTP, host, port, connectionSecurity, authenticationType, USERNAME, password, CLIENT_CERTIFICATE_ALIAS);
String uri = SmtpTransport.createUri(serverSettings);
StoreConfig storeConfig = createStoreConfigWithTransportUri(uri);
return new TestSmtpTransport(storeConfig, socketFactory, oAuth2TokenProvider);
}
use of com.fsck.k9.mail.ServerSettings in project k-9 by k9mail.
the class SmtpTransportUriTest method createUri_canEncodeSmtpUri.
@Test
public void createUri_canEncodeSmtpUri() {
ServerSettings serverSettings = new ServerSettings(ServerSettings.Type.SMTP, "server", 123456, ConnectionSecurity.NONE, AuthType.CRAM_MD5, "user", "password", "clientCert");
String result = SmtpTransport.createUri(serverSettings);
assertEquals("smtp://user:password:CRAM_MD5@server:123456", result);
}
use of com.fsck.k9.mail.ServerSettings in project k-9 by k9mail.
the class SmtpTransportUriTest method decodeUri_canDecodeClientCert.
@Test
public void decodeUri_canDecodeClientCert() {
String storeUri = "smtp+ssl+://user:clientCert:EXTERNAL@server:123456";
ServerSettings result = SmtpTransport.decodeUri(storeUri);
assertEquals("clientCert", result.clientCertificateAlias);
}
use of com.fsck.k9.mail.ServerSettings in project k-9 by k9mail.
the class AccountSetupBasics method onManualSetup.
private void onManualSetup() {
String email = mEmailView.getText().toString();
String[] emailParts = splitEmail(email);
String user = email;
String domain = emailParts[1];
String password = null;
String clientCertificateAlias = null;
AuthType authenticationType;
if (mClientCertificateCheckBox.isChecked()) {
authenticationType = AuthType.EXTERNAL;
clientCertificateAlias = mClientCertificateSpinner.getAlias();
} else {
authenticationType = AuthType.PLAIN;
password = mPasswordView.getText().toString();
}
if (mAccount == null) {
mAccount = Preferences.getPreferences(this).newAccount();
}
mAccount.setName(getOwnerName());
mAccount.setEmail(email);
// set default uris
// NOTE: they will be changed again in AccountSetupAccountType!
ServerSettings storeServer = new ServerSettings(ServerSettings.Type.IMAP, "mail." + domain, -1, ConnectionSecurity.SSL_TLS_REQUIRED, authenticationType, user, password, clientCertificateAlias);
ServerSettings transportServer = new ServerSettings(ServerSettings.Type.SMTP, "mail." + domain, -1, ConnectionSecurity.SSL_TLS_REQUIRED, authenticationType, user, password, clientCertificateAlias);
String storeUri = RemoteStore.createStoreUri(storeServer);
String transportUri = Transport.createTransportUri(transportServer);
mAccount.setStoreUri(storeUri);
mAccount.setTransportUri(transportUri);
setupFolderNames(domain);
AccountSetupAccountType.actionSelectAccountType(this, mAccount, false);
finish();
}
use of com.fsck.k9.mail.ServerSettings in project k-9 by k9mail.
the class AccountSetupOutgoing method onNext.
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(Type.SMTP, newHost, newPort, securityType, authType, username, password, clientCertificateAlias);
uri = Transport.createTransportUri(server);
mAccount.deleteCertificate(newHost, newPort, CheckDirection.OUTGOING);
mAccount.setTransportUri(uri);
AccountSetupCheckSettings.actionCheckSettings(this, mAccount, CheckDirection.OUTGOING);
}
Aggregations