112b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo/* 212b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo * Copyright (C) 2011 The Android Open Source Project 312b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo * 412b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo * Licensed under the Apache License, Version 2.0 (the "License"); 512b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo * you may not use this file except in compliance with the License. 612b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo * You may obtain a copy of the License at 712b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo * 812b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo * http://www.apache.org/licenses/LICENSE-2.0 912b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo * 1012b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo * Unless required by applicable law or agreed to in writing, software 1112b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo * distributed under the License is distributed on an "AS IS" BASIS, 1212b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1312b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo * See the License for the specific language governing permissions and 1412b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo * limitations under the License. 1512b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo */ 1612b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo 1712b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo 1812b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalopackage com.android.emailcommon.provider; 1912b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo 2012b82d9374947c9268217f45befe8a74bd9b60d7Ben Komaloimport android.content.ContentValues; 2112b82d9374947c9268217f45befe8a74bd9b60d7Ben Komaloimport android.content.Context; 2212b82d9374947c9268217f45befe8a74bd9b60d7Ben Komaloimport android.database.Cursor; 2312b82d9374947c9268217f45befe8a74bd9b60d7Ben Komaloimport android.net.Uri; 2412b82d9374947c9268217f45befe8a74bd9b60d7Ben Komaloimport android.os.Parcel; 2512b82d9374947c9268217f45befe8a74bd9b60d7Ben Komaloimport android.os.Parcelable; 2612b82d9374947c9268217f45befe8a74bd9b60d7Ben Komaloimport android.text.TextUtils; 2712b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo 28f65bdbdaf5960951452b148f801c51feca864bfeMarc Blankimport com.android.emailcommon.provider.EmailContent.HostAuthColumns; 29f65bdbdaf5960951452b148f801c51feca864bfeMarc Blankimport com.android.emailcommon.utility.SSLUtils; 30f65bdbdaf5960951452b148f801c51feca864bfeMarc Blankimport com.android.emailcommon.utility.Utility; 31f65bdbdaf5960951452b148f801c51feca864bfeMarc Blank 3212b82d9374947c9268217f45befe8a74bd9b60d7Ben Komaloimport java.net.URI; 3312b82d9374947c9268217f45befe8a74bd9b60d7Ben Komaloimport java.net.URISyntaxException; 3412b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo 3512b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalopublic final class HostAuth extends EmailContent implements HostAuthColumns, Parcelable { 3612b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo public static final String TABLE_NAME = "HostAuth"; 37bc47398187c6ffd132435e51d8d61e6ec79a79dbPaul Westbrook @SuppressWarnings("hiding") 38bc47398187c6ffd132435e51d8d61e6ec79a79dbPaul Westbrook public static final Uri CONTENT_URI = Uri.parse(EmailContent.CONTENT_URI + "/hostauth"); 39bc47398187c6ffd132435e51d8d61e6ec79a79dbPaul Westbrook // TODO the three following constants duplicate constants in Store.java; remove those and 40bc47398187c6ffd132435e51d8d61e6ec79a79dbPaul Westbrook // just reference these. 41bc47398187c6ffd132435e51d8d61e6ec79a79dbPaul Westbrook public static final String SCHEME_IMAP = "imap"; 42bc47398187c6ffd132435e51d8d61e6ec79a79dbPaul Westbrook public static final String SCHEME_POP3 = "pop3"; 43bc47398187c6ffd132435e51d8d61e6ec79a79dbPaul Westbrook public static final String SCHEME_EAS = "eas"; 44bc47398187c6ffd132435e51d8d61e6ec79a79dbPaul Westbrook public static final String SCHEME_SMTP = "smtp"; 45313586c8eb4e23ceec068b82f3dc0be1c8a7045fBen Komalo public static final String SCHEME_TRUST_ALL_CERTS = "trustallcerts"; 4612b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo 4712b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo public static final int PORT_UNKNOWN = -1; 4812b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo 4912b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo public static final int FLAG_NONE = 0x00; // No flags 5012b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo public static final int FLAG_SSL = 0x01; // Use SSL 5112b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo public static final int FLAG_TLS = 0x02; // Use TLS 5212b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo public static final int FLAG_AUTHENTICATE = 0x04; // Use name/password for authentication 5312b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo public static final int FLAG_TRUST_ALL = 0x08; // Trust all certificates 5412b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo // Mask of settings directly configurable by the user 5512b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo public static final int USER_CONFIG_MASK = 0x0b; 5612b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo 5712b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo public String mProtocol; 5812b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo public String mAddress; 5912b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo public int mPort; 6012b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo public int mFlags; 6112b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo public String mLogin; 6212b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo public String mPassword; 6312b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo public String mDomain; 64313586c8eb4e23ceec068b82f3dc0be1c8a7045fBen Komalo public String mClientCertAlias = null; 6512b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo 6612b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo public static final int CONTENT_ID_COLUMN = 0; 6712b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo public static final int CONTENT_PROTOCOL_COLUMN = 1; 6812b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo public static final int CONTENT_ADDRESS_COLUMN = 2; 6912b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo public static final int CONTENT_PORT_COLUMN = 3; 7012b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo public static final int CONTENT_FLAGS_COLUMN = 4; 7112b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo public static final int CONTENT_LOGIN_COLUMN = 5; 7212b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo public static final int CONTENT_PASSWORD_COLUMN = 6; 7312b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo public static final int CONTENT_DOMAIN_COLUMN = 7; 74313586c8eb4e23ceec068b82f3dc0be1c8a7045fBen Komalo public static final int CONTENT_CLIENT_CERT_ALIAS_COLUMN = 8; 7512b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo 7612b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo public static final String[] CONTENT_PROJECTION = new String[] { 7712b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo RECORD_ID, HostAuthColumns.PROTOCOL, HostAuthColumns.ADDRESS, HostAuthColumns.PORT, 7812b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo HostAuthColumns.FLAGS, HostAuthColumns.LOGIN, 79313586c8eb4e23ceec068b82f3dc0be1c8a7045fBen Komalo HostAuthColumns.PASSWORD, HostAuthColumns.DOMAIN, HostAuthColumns.CLIENT_CERT_ALIAS 8012b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo }; 8112b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo 8212b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo /** 8312b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo * no public constructor since this is a utility class 8412b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo */ 8512b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo public HostAuth() { 8612b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo mBaseUri = CONTENT_URI; 8712b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo 8812b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo // other defaults policy) 8912b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo mPort = PORT_UNKNOWN; 9012b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo } 9112b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo 9212b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo /** 9312b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo * Restore a HostAuth from the database, given its unique id 9412b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo * @param context 9512b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo * @param id 9612b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo * @return the instantiated HostAuth 9712b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo */ 9812b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo public static HostAuth restoreHostAuthWithId(Context context, long id) { 9912b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo return EmailContent.restoreContentWithId(context, HostAuth.class, 10012b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo HostAuth.CONTENT_URI, HostAuth.CONTENT_PROJECTION, id); 10112b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo } 10212b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo 10312b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo 10412b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo /** 10512b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo * Returns the scheme for the specified flags. 10612b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo */ 10712b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo public static String getSchemeString(String protocol, int flags) { 108313586c8eb4e23ceec068b82f3dc0be1c8a7045fBen Komalo return getSchemeString(protocol, flags, null); 109313586c8eb4e23ceec068b82f3dc0be1c8a7045fBen Komalo } 110313586c8eb4e23ceec068b82f3dc0be1c8a7045fBen Komalo 111313586c8eb4e23ceec068b82f3dc0be1c8a7045fBen Komalo /** 112313586c8eb4e23ceec068b82f3dc0be1c8a7045fBen Komalo * Builds a URI scheme name given the parameters for a {@code HostAuth}. 113313586c8eb4e23ceec068b82f3dc0be1c8a7045fBen Komalo * If a {@code clientAlias} is provided, this indicates that a secure connection must be used. 114313586c8eb4e23ceec068b82f3dc0be1c8a7045fBen Komalo */ 115313586c8eb4e23ceec068b82f3dc0be1c8a7045fBen Komalo public static String getSchemeString(String protocol, int flags, String clientAlias) { 11612b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo String security = ""; 11712b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo switch (flags & USER_CONFIG_MASK) { 11812b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo case FLAG_SSL: 11912b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo security = "+ssl+"; 12012b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo break; 12112b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo case FLAG_SSL | FLAG_TRUST_ALL: 12212b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo security = "+ssl+trustallcerts"; 12312b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo break; 12412b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo case FLAG_TLS: 12512b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo security = "+tls+"; 12612b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo break; 12712b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo case FLAG_TLS | FLAG_TRUST_ALL: 12812b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo security = "+tls+trustallcerts"; 12912b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo break; 13012b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo } 131313586c8eb4e23ceec068b82f3dc0be1c8a7045fBen Komalo 132313586c8eb4e23ceec068b82f3dc0be1c8a7045fBen Komalo if (!TextUtils.isEmpty(clientAlias)) { 133313586c8eb4e23ceec068b82f3dc0be1c8a7045fBen Komalo if (TextUtils.isEmpty(security)) { 134313586c8eb4e23ceec068b82f3dc0be1c8a7045fBen Komalo throw new IllegalArgumentException( 135313586c8eb4e23ceec068b82f3dc0be1c8a7045fBen Komalo "Can't specify a certificate alias for a non-secure connection"); 136313586c8eb4e23ceec068b82f3dc0be1c8a7045fBen Komalo } 137313586c8eb4e23ceec068b82f3dc0be1c8a7045fBen Komalo if (!security.endsWith("+")) { 138313586c8eb4e23ceec068b82f3dc0be1c8a7045fBen Komalo security += "+"; 139313586c8eb4e23ceec068b82f3dc0be1c8a7045fBen Komalo } 140724c3a81cd3649b48ab47c6e49cb42f73f20c815Ben Komalo security += SSLUtils.escapeForSchemeName(clientAlias); 141313586c8eb4e23ceec068b82f3dc0be1c8a7045fBen Komalo } 142313586c8eb4e23ceec068b82f3dc0be1c8a7045fBen Komalo 14312b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo return protocol + security; 14412b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo } 14512b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo 14612b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo /** 14712b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo * Returns the flags for the specified scheme. 14812b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo */ 14912b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo public static int getSchemeFlags(String scheme) { 15012b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo String[] schemeParts = scheme.split("\\+"); 15112b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo int flags = HostAuth.FLAG_NONE; 15212b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo if (schemeParts.length >= 2) { 15312b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo String part1 = schemeParts[1]; 15412b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo if ("ssl".equals(part1)) { 15512b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo flags |= HostAuth.FLAG_SSL; 15612b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo } else if ("tls".equals(part1)) { 15712b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo flags |= HostAuth.FLAG_TLS; 15812b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo } 15912b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo if (schemeParts.length >= 3) { 16012b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo String part2 = schemeParts[2]; 161313586c8eb4e23ceec068b82f3dc0be1c8a7045fBen Komalo if (SCHEME_TRUST_ALL_CERTS.equals(part2)) { 16212b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo flags |= HostAuth.FLAG_TRUST_ALL; 16312b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo } 16412b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo } 16512b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo } 16612b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo return flags; 16712b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo } 16812b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo 16912b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo @Override 17012b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo public void restore(Cursor cursor) { 17112b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo mBaseUri = CONTENT_URI; 17212b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo mId = cursor.getLong(CONTENT_ID_COLUMN); 17312b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo mProtocol = cursor.getString(CONTENT_PROTOCOL_COLUMN); 17412b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo mAddress = cursor.getString(CONTENT_ADDRESS_COLUMN); 17512b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo mPort = cursor.getInt(CONTENT_PORT_COLUMN); 17612b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo mFlags = cursor.getInt(CONTENT_FLAGS_COLUMN); 17712b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo mLogin = cursor.getString(CONTENT_LOGIN_COLUMN); 17812b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo mPassword = cursor.getString(CONTENT_PASSWORD_COLUMN); 17912b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo mDomain = cursor.getString(CONTENT_DOMAIN_COLUMN); 180313586c8eb4e23ceec068b82f3dc0be1c8a7045fBen Komalo mClientCertAlias = cursor.getString(CONTENT_CLIENT_CERT_ALIAS_COLUMN); 18112b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo } 18212b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo 18312b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo @Override 18412b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo public ContentValues toContentValues() { 18512b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo ContentValues values = new ContentValues(); 18612b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo values.put(HostAuthColumns.PROTOCOL, mProtocol); 18712b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo values.put(HostAuthColumns.ADDRESS, mAddress); 18812b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo values.put(HostAuthColumns.PORT, mPort); 18912b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo values.put(HostAuthColumns.FLAGS, mFlags); 19012b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo values.put(HostAuthColumns.LOGIN, mLogin); 19112b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo values.put(HostAuthColumns.PASSWORD, mPassword); 19212b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo values.put(HostAuthColumns.DOMAIN, mDomain); 193313586c8eb4e23ceec068b82f3dc0be1c8a7045fBen Komalo values.put(HostAuthColumns.CLIENT_CERT_ALIAS, mClientCertAlias); 19412b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo values.put(HostAuthColumns.ACCOUNT_KEY, 0); // Need something to satisfy the DB 19512b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo return values; 19612b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo } 19712b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo 19812b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo /** 19912b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo * Sets the user name and password from URI user info string 20012b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo */ 20112b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo public void setLogin(String userInfo) { 20212b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo String userName = null; 20312b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo String userPassword = null; 20412b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo if (!TextUtils.isEmpty(userInfo)) { 20512b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo String[] userInfoParts = userInfo.split(":", 2); 20612b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo userName = userInfoParts[0]; 20712b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo if (userInfoParts.length > 1) { 20812b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo userPassword = userInfoParts[1]; 20912b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo } 21012b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo } 21112b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo setLogin(userName, userPassword); 21212b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo } 21312b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo 21412b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo /** 21512b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo * Sets the user name and password 21612b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo */ 21712b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo public void setLogin(String userName, String userPassword) { 21812b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo mLogin = userName; 21912b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo mPassword = userPassword; 22012b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo 22112b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo if (mLogin == null) { 22212b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo mFlags &= ~FLAG_AUTHENTICATE; 22312b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo } else { 22412b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo mFlags |= FLAG_AUTHENTICATE; 22512b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo } 22612b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo } 22712b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo 22812b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo /** 22912b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo * Returns the login information. [0] is the username and [1] is the password. If 23012b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo * {@link #FLAG_AUTHENTICATE} is not set, {@code null} is returned. 23112b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo */ 23212b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo public String[] getLogin() { 23312b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo if ((mFlags & FLAG_AUTHENTICATE) != 0) { 23412b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo String trimUser = (mLogin != null) ? mLogin.trim() : ""; 23512b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo String password = (mPassword != null) ? mPassword : ""; 23612b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo return new String[] { trimUser, password }; 23712b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo } 23812b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo return null; 23912b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo } 24012b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo 24112b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo public void setConnection(String protocol, String address, int port, int flags) { 242313586c8eb4e23ceec068b82f3dc0be1c8a7045fBen Komalo setConnection(protocol, address, port, flags, null); 243313586c8eb4e23ceec068b82f3dc0be1c8a7045fBen Komalo } 244313586c8eb4e23ceec068b82f3dc0be1c8a7045fBen Komalo 245313586c8eb4e23ceec068b82f3dc0be1c8a7045fBen Komalo /** 246313586c8eb4e23ceec068b82f3dc0be1c8a7045fBen Komalo * Sets the internal connection parameters based on the specified parameter values. 247313586c8eb4e23ceec068b82f3dc0be1c8a7045fBen Komalo * @param protocol the mail protocol to use (e.g. "eas", "imap"). 248313586c8eb4e23ceec068b82f3dc0be1c8a7045fBen Komalo * @param address the address of the server 249313586c8eb4e23ceec068b82f3dc0be1c8a7045fBen Komalo * @param port the port for the connection 250313586c8eb4e23ceec068b82f3dc0be1c8a7045fBen Komalo * @param flags flags indicating the security and type of the connection 251313586c8eb4e23ceec068b82f3dc0be1c8a7045fBen Komalo * @param clientCertAlias an optional alias to use if a client user certificate is to be 252313586c8eb4e23ceec068b82f3dc0be1c8a7045fBen Komalo * presented during connection establishment. If this is non-empty, it must be the case 253313586c8eb4e23ceec068b82f3dc0be1c8a7045fBen Komalo * that flags indicates use of a secure connection 254313586c8eb4e23ceec068b82f3dc0be1c8a7045fBen Komalo */ 255313586c8eb4e23ceec068b82f3dc0be1c8a7045fBen Komalo public void setConnection(String protocol, String address, 256313586c8eb4e23ceec068b82f3dc0be1c8a7045fBen Komalo int port, int flags, String clientCertAlias) { 25712b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo // Set protocol, security, and additional flags based on uri scheme 25812b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo mProtocol = protocol; 25912b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo 26012b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo mFlags &= ~(FLAG_SSL | FLAG_TLS | FLAG_TRUST_ALL); 26112b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo mFlags |= (flags & USER_CONFIG_MASK); 26212b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo 263313586c8eb4e23ceec068b82f3dc0be1c8a7045fBen Komalo boolean useSecureConnection = (flags & (FLAG_SSL | FLAG_TLS)) != 0; 264313586c8eb4e23ceec068b82f3dc0be1c8a7045fBen Komalo if (!useSecureConnection && !TextUtils.isEmpty(clientCertAlias)) { 265313586c8eb4e23ceec068b82f3dc0be1c8a7045fBen Komalo throw new IllegalArgumentException("Can't use client alias on non-secure connections"); 266313586c8eb4e23ceec068b82f3dc0be1c8a7045fBen Komalo } 267313586c8eb4e23ceec068b82f3dc0be1c8a7045fBen Komalo 26812b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo mAddress = address; 26912b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo mPort = port; 27012b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo if (mPort == PORT_UNKNOWN) { 27112b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo boolean useSSL = ((mFlags & FLAG_SSL) != 0); 272bc47398187c6ffd132435e51d8d61e6ec79a79dbPaul Westbrook // infer port# from protocol + security 273bc47398187c6ffd132435e51d8d61e6ec79a79dbPaul Westbrook // SSL implies a different port - TLS runs in the "regular" port 274bc47398187c6ffd132435e51d8d61e6ec79a79dbPaul Westbrook // NOTE: Although the port should be setup in the various setup screens, this 275bc47398187c6ffd132435e51d8d61e6ec79a79dbPaul Westbrook // block cannot easily be moved because we get process URIs from other sources 276bc47398187c6ffd132435e51d8d61e6ec79a79dbPaul Westbrook // (e.g. for tests, provider templates and account restore) that may or may not 277bc47398187c6ffd132435e51d8d61e6ec79a79dbPaul Westbrook // have a port specified. 278bc47398187c6ffd132435e51d8d61e6ec79a79dbPaul Westbrook if (SCHEME_POP3.equals(mProtocol)) { 279bc47398187c6ffd132435e51d8d61e6ec79a79dbPaul Westbrook mPort = useSSL ? 995 : 110; 280bc47398187c6ffd132435e51d8d61e6ec79a79dbPaul Westbrook } else if (SCHEME_IMAP.equals(mProtocol)) { 281bc47398187c6ffd132435e51d8d61e6ec79a79dbPaul Westbrook mPort = useSSL ? 993 : 143; 282bc47398187c6ffd132435e51d8d61e6ec79a79dbPaul Westbrook } else if (SCHEME_EAS.equals(mProtocol)) { 283bc47398187c6ffd132435e51d8d61e6ec79a79dbPaul Westbrook mPort = useSSL ? 443 : 80; 284bc47398187c6ffd132435e51d8d61e6ec79a79dbPaul Westbrook } else if (SCHEME_SMTP.equals(mProtocol)) { 28512b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo mPort = useSSL ? 465 : 587; 28612b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo } 28712b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo } 288313586c8eb4e23ceec068b82f3dc0be1c8a7045fBen Komalo 289313586c8eb4e23ceec068b82f3dc0be1c8a7045fBen Komalo mClientCertAlias = clientCertAlias; 29012b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo } 29112b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo 292bc47398187c6ffd132435e51d8d61e6ec79a79dbPaul Westbrook /** Returns {@code true} if this is an EAS connection; otherwise, {@code false}. */ 293bc47398187c6ffd132435e51d8d61e6ec79a79dbPaul Westbrook public boolean isEasConnection() { 294bc47398187c6ffd132435e51d8d61e6ec79a79dbPaul Westbrook return SCHEME_EAS.equals(mProtocol); 295bc47398187c6ffd132435e51d8d61e6ec79a79dbPaul Westbrook } 2965675ea88d3cc4ba9934d2a54fee008fd324d711fTodd Kennedy 29722409fcffae4c6e551fb3e6ead4cdc92e33fded1Ben Komalo /** Convenience method to determine if SSL is used. */ 298913e26180d389cdeab2f6b96db4f1e3d9f68f5d7Ben Komalo public boolean shouldUseSsl() { 29922409fcffae4c6e551fb3e6ead4cdc92e33fded1Ben Komalo return (mFlags & FLAG_SSL) != 0; 30022409fcffae4c6e551fb3e6ead4cdc92e33fded1Ben Komalo } 30122409fcffae4c6e551fb3e6ead4cdc92e33fded1Ben Komalo 30222409fcffae4c6e551fb3e6ead4cdc92e33fded1Ben Komalo /** Convenience method to determine if all server certs should be used. */ 303913e26180d389cdeab2f6b96db4f1e3d9f68f5d7Ben Komalo public boolean shouldTrustAllServerCerts() { 30422409fcffae4c6e551fb3e6ead4cdc92e33fded1Ben Komalo return (mFlags & FLAG_TRUST_ALL) != 0; 30522409fcffae4c6e551fb3e6ead4cdc92e33fded1Ben Komalo } 30622409fcffae4c6e551fb3e6ead4cdc92e33fded1Ben Komalo 30712b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo /** 30812b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo * Supports Parcelable 30912b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo */ 31012b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo @Override 31112b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo public int describeContents() { 31212b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo return 0; 31312b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo } 31412b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo 31512b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo /** 31612b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo * Supports Parcelable 31712b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo */ 31812b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo public static final Parcelable.Creator<HostAuth> CREATOR 31912b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo = new Parcelable.Creator<HostAuth>() { 32012b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo @Override 32112b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo public HostAuth createFromParcel(Parcel in) { 32212b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo return new HostAuth(in); 32312b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo } 32412b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo 32512b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo @Override 32612b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo public HostAuth[] newArray(int size) { 32712b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo return new HostAuth[size]; 32812b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo } 32912b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo }; 33012b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo 33112b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo /** 33212b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo * Supports Parcelable 33312b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo */ 33412b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo @Override 33512b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo public void writeToParcel(Parcel dest, int flags) { 33612b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo // mBaseUri is not parceled 33712b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo dest.writeLong(mId); 33812b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo dest.writeString(mProtocol); 33912b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo dest.writeString(mAddress); 34012b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo dest.writeInt(mPort); 34112b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo dest.writeInt(mFlags); 34212b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo dest.writeString(mLogin); 34312b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo dest.writeString(mPassword); 34412b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo dest.writeString(mDomain); 345313586c8eb4e23ceec068b82f3dc0be1c8a7045fBen Komalo dest.writeString(mClientCertAlias); 34612b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo } 34712b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo 34812b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo /** 34912b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo * Supports Parcelable 35012b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo */ 35112b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo public HostAuth(Parcel in) { 35212b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo mBaseUri = CONTENT_URI; 35312b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo mId = in.readLong(); 35412b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo mProtocol = in.readString(); 35512b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo mAddress = in.readString(); 35612b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo mPort = in.readInt(); 35712b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo mFlags = in.readInt(); 35812b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo mLogin = in.readString(); 35912b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo mPassword = in.readString(); 36012b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo mDomain = in.readString(); 361313586c8eb4e23ceec068b82f3dc0be1c8a7045fBen Komalo mClientCertAlias = in.readString(); 36212b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo } 36312b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo 36412b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo @Override 36512b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo public boolean equals(Object o) { 36612b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo if (!(o instanceof HostAuth)) { 36712b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo return false; 36812b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo } 36912b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo HostAuth that = (HostAuth)o; 37012b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo return mPort == that.mPort 37112b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo && mFlags == that.mFlags 37212b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo && Utility.areStringsEqual(mProtocol, that.mProtocol) 37312b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo && Utility.areStringsEqual(mAddress, that.mAddress) 37412b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo && Utility.areStringsEqual(mLogin, that.mLogin) 37512b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo && Utility.areStringsEqual(mPassword, that.mPassword) 376313586c8eb4e23ceec068b82f3dc0be1c8a7045fBen Komalo && Utility.areStringsEqual(mDomain, that.mDomain) 377313586c8eb4e23ceec068b82f3dc0be1c8a7045fBen Komalo && Utility.areStringsEqual(mClientCertAlias, that.mClientCertAlias); 37812b82d9374947c9268217f45befe8a74bd9b60d7Ben Komalo } 37985e4c101b014857fe40f87c3837b82564cfc5b6cMarc Blank 38085e4c101b014857fe40f87c3837b82564cfc5b6cMarc Blank /** 381f65bdbdaf5960951452b148f801c51feca864bfeMarc Blank * The flag, password, and client cert alias are the only items likely to change after a 382f65bdbdaf5960951452b148f801c51feca864bfeMarc Blank * HostAuth is created 383f65bdbdaf5960951452b148f801c51feca864bfeMarc Blank */ 384f65bdbdaf5960951452b148f801c51feca864bfeMarc Blank @Override 385f65bdbdaf5960951452b148f801c51feca864bfeMarc Blank public int hashCode() { 386f65bdbdaf5960951452b148f801c51feca864bfeMarc Blank int hashCode = 29; 387f65bdbdaf5960951452b148f801c51feca864bfeMarc Blank if (mPassword != null) { 388f65bdbdaf5960951452b148f801c51feca864bfeMarc Blank hashCode += mPassword.hashCode(); 389f65bdbdaf5960951452b148f801c51feca864bfeMarc Blank } 390f65bdbdaf5960951452b148f801c51feca864bfeMarc Blank if (mClientCertAlias != null) { 391f65bdbdaf5960951452b148f801c51feca864bfeMarc Blank hashCode += (mClientCertAlias.hashCode() << 8); 392f65bdbdaf5960951452b148f801c51feca864bfeMarc Blank } 393f65bdbdaf5960951452b148f801c51feca864bfeMarc Blank return (hashCode << 8) + mFlags; 394f65bdbdaf5960951452b148f801c51feca864bfeMarc Blank } 395f65bdbdaf5960951452b148f801c51feca864bfeMarc Blank 396f65bdbdaf5960951452b148f801c51feca864bfeMarc Blank /** 39785e4c101b014857fe40f87c3837b82564cfc5b6cMarc Blank * Legacy URI parser. Used in parsing template from provider.xml 39885e4c101b014857fe40f87c3837b82564cfc5b6cMarc Blank * Example string: 39985e4c101b014857fe40f87c3837b82564cfc5b6cMarc Blank * "eas+ssl+trustallcerts://user:password@server/domain:123" 40085e4c101b014857fe40f87c3837b82564cfc5b6cMarc Blank * 40185e4c101b014857fe40f87c3837b82564cfc5b6cMarc Blank * Note that the use of client certificate is specified in the URI, a secure connection type 40285e4c101b014857fe40f87c3837b82564cfc5b6cMarc Blank * must be used. 40385e4c101b014857fe40f87c3837b82564cfc5b6cMarc Blank */ 40485e4c101b014857fe40f87c3837b82564cfc5b6cMarc Blank public static void setHostAuthFromString(HostAuth auth, String uriString) 40585e4c101b014857fe40f87c3837b82564cfc5b6cMarc Blank throws URISyntaxException { 40685e4c101b014857fe40f87c3837b82564cfc5b6cMarc Blank URI uri = new URI(uriString); 40785e4c101b014857fe40f87c3837b82564cfc5b6cMarc Blank String path = uri.getPath(); 40885e4c101b014857fe40f87c3837b82564cfc5b6cMarc Blank String domain = null; 40985e4c101b014857fe40f87c3837b82564cfc5b6cMarc Blank if (!TextUtils.isEmpty(path)) { 41085e4c101b014857fe40f87c3837b82564cfc5b6cMarc Blank // Strip off the leading slash that begins the path. 41185e4c101b014857fe40f87c3837b82564cfc5b6cMarc Blank domain = path.substring(1); 41285e4c101b014857fe40f87c3837b82564cfc5b6cMarc Blank } 41385e4c101b014857fe40f87c3837b82564cfc5b6cMarc Blank auth.mDomain = domain; 41485e4c101b014857fe40f87c3837b82564cfc5b6cMarc Blank auth.setLogin(uri.getUserInfo()); 41585e4c101b014857fe40f87c3837b82564cfc5b6cMarc Blank 41685e4c101b014857fe40f87c3837b82564cfc5b6cMarc Blank String scheme = uri.getScheme(); 41785e4c101b014857fe40f87c3837b82564cfc5b6cMarc Blank auth.setConnection(scheme, uri.getHost(), uri.getPort()); 41885e4c101b014857fe40f87c3837b82564cfc5b6cMarc Blank } 41985e4c101b014857fe40f87c3837b82564cfc5b6cMarc Blank 42085e4c101b014857fe40f87c3837b82564cfc5b6cMarc Blank /** 42185e4c101b014857fe40f87c3837b82564cfc5b6cMarc Blank * Legacy code for setting connection values from a "scheme" (see above) 42285e4c101b014857fe40f87c3837b82564cfc5b6cMarc Blank */ 42385e4c101b014857fe40f87c3837b82564cfc5b6cMarc Blank public void setConnection(String scheme, String host, int port) { 42485e4c101b014857fe40f87c3837b82564cfc5b6cMarc Blank String[] schemeParts = scheme.split("\\+"); 42585e4c101b014857fe40f87c3837b82564cfc5b6cMarc Blank String protocol = schemeParts[0]; 42685e4c101b014857fe40f87c3837b82564cfc5b6cMarc Blank String clientCertAlias = null; 42785e4c101b014857fe40f87c3837b82564cfc5b6cMarc Blank int flags = getSchemeFlags(scheme); 42885e4c101b014857fe40f87c3837b82564cfc5b6cMarc Blank 42985e4c101b014857fe40f87c3837b82564cfc5b6cMarc Blank // Example scheme: "eas+ssl+trustallcerts" or "eas+tls+trustallcerts+client-cert-alias" 43085e4c101b014857fe40f87c3837b82564cfc5b6cMarc Blank if (schemeParts.length > 3) { 43185e4c101b014857fe40f87c3837b82564cfc5b6cMarc Blank clientCertAlias = schemeParts[3]; 43285e4c101b014857fe40f87c3837b82564cfc5b6cMarc Blank } else if (schemeParts.length > 2) { 43385e4c101b014857fe40f87c3837b82564cfc5b6cMarc Blank if (!SCHEME_TRUST_ALL_CERTS.equals(schemeParts[2])) { 43485e4c101b014857fe40f87c3837b82564cfc5b6cMarc Blank mClientCertAlias = schemeParts[2]; 43585e4c101b014857fe40f87c3837b82564cfc5b6cMarc Blank } 43685e4c101b014857fe40f87c3837b82564cfc5b6cMarc Blank } 43785e4c101b014857fe40f87c3837b82564cfc5b6cMarc Blank 43885e4c101b014857fe40f87c3837b82564cfc5b6cMarc Blank setConnection(protocol, host, port, flags, clientCertAlias); 43985e4c101b014857fe40f87c3837b82564cfc5b6cMarc Blank } 44085e4c101b014857fe40f87c3837b82564cfc5b6cMarc Blank 4415675ea88d3cc4ba9934d2a54fee008fd324d711fTodd Kennedy} 442