Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 152701 Details for
Bug 295050
[api] request enhanced support of client-certificates
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Patch -- 2nd iteration.
bx-mylyn-patch2.txt (text/plain), 37.62 KB, created by
torsten
on 2009-11-20 08:41:35 EST
(
hide
)
Description:
Patch -- 2nd iteration.
Filename:
MIME Type:
Creator:
torsten
Created:
2009-11-20 08:41:35 EST
Size:
37.62 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylyn.trac.ui >Index: src/org/eclipse/mylyn/internal/trac/ui/wizard/TracRepositorySettingsPage.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracRepositorySettingsPage.java,v >retrieving revision 1.45 >diff -u -r1.45 TracRepositorySettingsPage.java >--- src/org/eclipse/mylyn/internal/trac/ui/wizard/TracRepositorySettingsPage.java 24 Sep 2009 04:53:41 -0000 1.45 >+++ src/org/eclipse/mylyn/internal/trac/ui/wizard/TracRepositorySettingsPage.java 20 Nov 2009 11:50:38 -0000 >@@ -23,6 +23,7 @@ > import org.eclipse.mylyn.commons.net.AbstractWebLocation; > import org.eclipse.mylyn.commons.net.AuthenticationCredentials; > import org.eclipse.mylyn.commons.net.AuthenticationType; >+import org.eclipse.mylyn.commons.net.FailedSSLCertifidateException; > import org.eclipse.mylyn.internal.trac.core.TracClientFactory; > import org.eclipse.mylyn.internal.trac.core.TracCorePlugin; > import org.eclipse.mylyn.internal.trac.core.client.ITracClient; >@@ -61,6 +62,7 @@ > > public TracRepositorySettingsPage(TaskRepository taskRepository) { > super(TITLE, DESCRIPTION, taskRepository); >+ setNeedsCertAuth(true); > setNeedsAnonymousLogin(true); > setNeedsEncoding(false); > setNeedsTimeZone(false); >@@ -199,6 +201,9 @@ > } > throw new CoreException(RepositoryStatus.createStatus(repositoryUrl, IStatus.ERROR, > TracUiPlugin.ID_PLUGIN, INVALID_LOGIN)); >+ } catch (FailedSSLCertifidateException e) { >+ throw new CoreException(RepositoryStatus.createStatus(repositoryUrl, IStatus.ERROR, >+ TracUiPlugin.ID_PLUGIN, "Invalid certificate information")); //$NON-NLS-1$ > } catch (TracPermissionDeniedException e) { > throw new CoreException(RepositoryStatus.createStatus(repositoryUrl, IStatus.ERROR, > TracUiPlugin.ID_PLUGIN, "Insufficient permissions for selected access type.")); //$NON-NLS-1$ >#P org.eclipse.mylyn.tasks.core >Index: src/org/eclipse/mylyn/tasks/core/TaskRepository.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskRepository.java,v >retrieving revision 1.86 >diff -u -r1.86 TaskRepository.java >--- src/org/eclipse/mylyn/tasks/core/TaskRepository.java 22 Sep 2009 20:48:54 -0000 1.86 >+++ src/org/eclipse/mylyn/tasks/core/TaskRepository.java 20 Nov 2009 11:50:40 -0000 >@@ -96,6 +96,8 @@ > > private static final String AUTH_HTTP = "org.eclipse.mylyn.tasklist.repositories.httpauth"; //$NON-NLS-1$ > >+ private static final String AUTH_CERT = "org.eclipse.mylyn.tasklist.repositories.certauth"; //$NON-NLS-1$ >+ > /** > * @deprecated use {@link #setCredentials(AuthenticationType, AuthenticationCredentials, boolean)} to access > * credentials >@@ -167,6 +169,8 @@ > switch (type) { > case HTTP: > return AUTH_HTTP; >+ case CLIENTCERTIFICATE: >+ return AUTH_CERT; > case PROXY: > return AUTH_PROXY; > case REPOSITORY: >#P org.eclipse.mylyn.trac.core >Index: src/org/eclipse/mylyn/internal/trac/core/client/TracWebClient.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/client/TracWebClient.java,v >retrieving revision 1.19 >diff -u -r1.19 TracWebClient.java >--- src/org/eclipse/mylyn/internal/trac/core/client/TracWebClient.java 24 Sep 2009 08:29:45 -0000 1.19 >+++ src/org/eclipse/mylyn/internal/trac/core/client/TracWebClient.java 20 Nov 2009 11:50:42 -0000 >@@ -85,7 +85,7 @@ > } > > public GetMethod execute(IProgressMonitor monitor) throws TracLoginException, IOException, TracHttpException { >- hostConfiguration = WebUtil.createHostConfiguration(httpClient, location, monitor); >+ hostConfiguration = TracUtil.tracCreateHostConfiguration(httpClient, location, monitor); > > for (int attempt = 0; attempt < 2; attempt++) { > // force authentication >@@ -182,7 +182,7 @@ > throw new TracLoginException(); > } > >- hostConfiguration = WebUtil.createHostConfiguration(httpClient, location, monitor); >+ hostConfiguration = TracUtil.tracCreateHostConfiguration(httpClient, location, monitor); > return true; > } > >Index: src/org/eclipse/mylyn/internal/trac/core/client/TracXmlRpcClient.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/client/TracXmlRpcClient.java,v >retrieving revision 1.23 >diff -u -r1.23 TracXmlRpcClient.java >--- src/org/eclipse/mylyn/internal/trac/core/client/TracXmlRpcClient.java 20 Sep 2009 06:57:58 -0000 1.23 >+++ src/org/eclipse/mylyn/internal/trac/core/client/TracXmlRpcClient.java 20 Nov 2009 11:50:42 -0000 >@@ -120,7 +120,7 @@ > > // try form-based authentication via AccountManagerPlugin as a > // fall-back >- HostConfiguration hostConfiguration = WebUtil.createHostConfiguration(httpClient, location, monitor); >+ HostConfiguration hostConfiguration = TracUtil.tracCreateHostConfiguration(httpClient, location, monitor); > try { > authenticateAccountManager(httpClient, hostConfiguration, credentials, monitor); > } catch (TracLoginException loginException) { >@@ -321,7 +321,9 @@ > if (DEBUG_AUTH) { > System.err.println(location.getUrl() + ": Probing authentication"); //$NON-NLS-1$ > } >- HostConfiguration hostConfiguration = WebUtil.createHostConfiguration(httpClient, location, monitor); >+ >+ HostConfiguration hostConfiguration = TracUtil.tracCreateHostConfiguration(httpClient, location, monitor); >+ > HeadMethod method = new HeadMethod(getXmlRpcUrl(credentials).toString()); > try { > // execute without any credentials set >Index: src/org/eclipse/mylyn/internal/trac/core/util/TracHttpClientTransportFactory.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/util/TracHttpClientTransportFactory.java,v >retrieving revision 1.28 >diff -u -r1.28 TracHttpClientTransportFactory.java >--- src/org/eclipse/mylyn/internal/trac/core/util/TracHttpClientTransportFactory.java 13 Oct 2009 00:57:53 -0000 1.28 >+++ src/org/eclipse/mylyn/internal/trac/core/util/TracHttpClientTransportFactory.java 20 Nov 2009 11:50:42 -0000 >@@ -41,6 +41,7 @@ > import org.eclipse.core.runtime.IProgressMonitor; > import org.eclipse.mylyn.commons.net.AbstractWebLocation; > import org.eclipse.mylyn.commons.net.WebUtil; >+import org.eclipse.mylyn.internal.trac.core.client.TracLoginException; > import org.xml.sax.SAXException; > > /** >@@ -125,7 +126,11 @@ > } > > String url = config.getServerURL().toString(); >- hostConfiguration = WebUtil.createHostConfiguration(httpClient, location, monitor); >+ try { >+ hostConfiguration = TracUtil.tracCreateHostConfiguration(httpClient, location, monitor); >+ } catch (TracLoginException e) { >+ throw new XmlRpcClientException(e.getMessage(), e); >+ } > method = new PostMethod(WebUtil.getRequestPath(url)); > > super.initHttpHeaders(request); >Index: src/org/eclipse/mylyn/internal/trac/core/util/TracUtil.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/util/TracUtil.java,v >retrieving revision 1.11 >diff -u -r1.11 TracUtil.java >--- src/org/eclipse/mylyn/internal/trac/core/util/TracUtil.java 11 Aug 2009 23:32:56 -0000 1.11 >+++ src/org/eclipse/mylyn/internal/trac/core/util/TracUtil.java 20 Nov 2009 11:50:42 -0000 >@@ -17,9 +17,19 @@ > import java.util.Date; > import java.util.Map; > >+import org.apache.commons.httpclient.HostConfiguration; >+import org.apache.commons.httpclient.HttpClient; >+import org.eclipse.core.runtime.IProgressMonitor; > import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.OperationCanceledException; >+import org.eclipse.mylyn.commons.net.AbstractWebLocation; >+import org.eclipse.mylyn.commons.net.AuthenticationType; >+import org.eclipse.mylyn.commons.net.FailedSSLCertifidateException; >+import org.eclipse.mylyn.commons.net.UnsupportedRequestException; >+import org.eclipse.mylyn.commons.net.WebUtil; > import org.eclipse.mylyn.internal.trac.core.TracCorePlugin; > import org.eclipse.mylyn.internal.trac.core.client.ITracClient; >+import org.eclipse.mylyn.internal.trac.core.client.TracLoginException; > import org.eclipse.mylyn.internal.trac.core.model.TracSearch; > import org.eclipse.mylyn.tasks.core.IRepositoryQuery; > import org.eclipse.mylyn.tasks.core.RepositoryStatus; >@@ -129,4 +139,30 @@ > } > } > >+ public static HostConfiguration tracCreateHostConfiguration(HttpClient httpClient, AbstractWebLocation location, >+ IProgressMonitor monitor) throws TracLoginException { >+ HostConfiguration hostConfiguration = null; >+ while (hostConfiguration == null) { >+ try { >+ hostConfiguration = WebUtil.createHostConfiguration(httpClient, location, monitor); >+ } catch (FailedSSLCertifidateException e1) { >+ // nothing to do -- we need to ask the user for the certificate details >+ } catch (Exception ex) { >+ throw new TracLoginException(); // something else failed -- do not open certificate-dialog again, but fail >+ } >+ >+ // open dialog for cert details >+ if (hostConfiguration == null) { >+ try { >+ location.requestCredentials(AuthenticationType.CLIENTCERTIFICATE, null, monitor); >+ } catch (UnsupportedRequestException ex) { >+ //throw new TracLoginException(); >+ // ensures that we try once only if running as a background task >+ throw new OperationCanceledException(); >+ } >+ } >+ } >+ return hostConfiguration; >+ } >+ > } >#P org.eclipse.mylyn.commons.net >Index: src/org/eclipse/mylyn/internal/commons/net/PollingSslProtocolSocketFactory.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.commons.net/src/org/eclipse/mylyn/internal/commons/net/PollingSslProtocolSocketFactory.java,v >retrieving revision 1.4 >diff -u -r1.4 PollingSslProtocolSocketFactory.java >--- src/org/eclipse/mylyn/internal/commons/net/PollingSslProtocolSocketFactory.java 24 Sep 2009 04:53:42 -0000 1.4 >+++ src/org/eclipse/mylyn/internal/commons/net/PollingSslProtocolSocketFactory.java 20 Nov 2009 11:50:44 -0000 >@@ -29,6 +29,7 @@ > import org.apache.commons.httpclient.params.HttpConnectionParams; > import org.apache.commons.httpclient.protocol.SecureProtocolSocketFactory; > import org.eclipse.core.runtime.IStatus; >+import org.eclipse.mylyn.commons.net.FailedSSLCertifidateException; > > /** > * Provides support for managing SSL connections. >@@ -76,6 +77,32 @@ > } > } > >+ public PollingSslProtocolSocketFactory(String KeyStoreName, String KeyStorePassword, String type) >+ throws FailedSSLCertifidateException { >+ KeyManager[] keymanagers = null; >+ try { >+ KeyStore keyStore = KeyStore.getInstance(type); >+ char[] password = KeyStorePassword.toCharArray(); >+ keyStore.load(new FileInputStream(KeyStoreName), password); >+ KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); >+ keyManagerFactory.init(keyStore, password); >+ keymanagers = keyManagerFactory.getKeyManagers(); >+ } catch (Exception e) { >+ CommonsNetPlugin.log(IStatus.WARNING, "Cannot initialize keystore.", null); //$NON-NLS-1$ >+ throw new FailedSSLCertifidateException(); >+ } >+ >+ hasKeyManager = keymanagers != null; >+ >+ try { >+ SSLContext sslContext = SSLContext.getInstance("SSL"); //$NON-NLS-1$ >+ sslContext.init(keymanagers, new TrustManager[] { new TrustAllTrustManager() }, null); >+ this.socketFactory = sslContext.getSocketFactory(); >+ } catch (Exception e) { >+ CommonsNetPlugin.log(IStatus.ERROR, "Could not access certificate for SSL context", e); //$NON-NLS-1$ >+ } >+ } >+ > public Socket createSocket(Socket socket, String host, int port, boolean autoClose) throws IOException, > UnknownHostException { > return getSocketFactory().createSocket(socket, host, port, autoClose); >Index: src/org/eclipse/mylyn/commons/net/WebUtil.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.commons.net/src/org/eclipse/mylyn/commons/net/WebUtil.java,v >retrieving revision 1.28 >diff -u -r1.28 WebUtil.java >--- src/org/eclipse/mylyn/commons/net/WebUtil.java 13 Oct 2009 02:20:40 -0000 1.28 >+++ src/org/eclipse/mylyn/commons/net/WebUtil.java 20 Nov 2009 11:50:44 -0000 >@@ -279,8 +279,15 @@ > } > > if (WebUtil.isRepositoryHttps(url)) { >- Protocol protocol = new Protocol("https", sslSocketFactory, HTTPS_PORT); //$NON-NLS-1$ >- hostConfiguration.setHost(host, port, protocol); >+ AuthenticationCredentials certCredentials = location.getCredentials(AuthenticationType.CLIENTCERTIFICATE); >+ if (certCredentials == null) { >+ Protocol protocol = new Protocol("https", sslSocketFactory, HTTPS_PORT); //$NON-NLS-1$ >+ hostConfiguration.setHost(host, port, protocol); >+ } else { >+ Protocol protocol = new Protocol("https", (ProtocolSocketFactory) new PollingSslProtocolSocketFactory( //$NON-NLS-1$ >+ certCredentials.getUserName(), certCredentials.getPassword(), "pkcs12"), HTTPS_PORT); //$NON-NLS-1$ >+ hostConfiguration.setHost(host, port, protocol); >+ } > } else { > Protocol protocol = new Protocol("http", socketFactory, HTTP_PORT); //$NON-NLS-1$ > hostConfiguration.setHost(host, port, protocol); >Index: src/org/eclipse/mylyn/commons/net/AuthenticationType.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.commons.net/src/org/eclipse/mylyn/commons/net/AuthenticationType.java,v >retrieving revision 1.2 >diff -u -r1.2 AuthenticationType.java >--- src/org/eclipse/mylyn/commons/net/AuthenticationType.java 12 Sep 2008 04:16:46 -0000 1.2 >+++ src/org/eclipse/mylyn/commons/net/AuthenticationType.java 20 Nov 2009 11:50:43 -0000 >@@ -26,5 +26,9 @@ > /** Proxy authentication. */ > PROXY, > /** Task repository authentication. */ >- REPOSITORY >-} >\ No newline at end of file >+ REPOSITORY, >+ /** >+ * Client authentification using certificates Username is the filename and password the password to access it. >+ */ >+ CLIENTCERTIFICATE >+} >Index: src/org/eclipse/mylyn/commons/net/FailedSSLCertifidateException.java >=================================================================== >RCS file: src/org/eclipse/mylyn/commons/net/FailedSSLCertifidateException.java >diff -N src/org/eclipse/mylyn/commons/net/FailedSSLCertifidateException.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/commons/net/FailedSSLCertifidateException.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,39 @@ >+/******************************************************************************* >+ * Copyright (c) 2009 BREDEX GmbH. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * BREDEX GmbH - initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.mylyn.commons.net; >+ >+/** >+ * Indicates that the access to a certificate-file failed. >+ * >+ * @author Torsten Kalix >+ * @since 3.3 >+ */ >+public class FailedSSLCertifidateException extends RuntimeException { >+ >+ private static final long serialVersionUID = 1L; >+ >+ public FailedSSLCertifidateException() { >+ } >+ >+ public FailedSSLCertifidateException(String message) { >+ super(message); >+ } >+ >+ public FailedSSLCertifidateException(String message, Throwable cause) { >+ super(message, cause); >+ } >+ >+ public FailedSSLCertifidateException(Throwable cause) { >+ super(cause); >+ } >+ >+} >#P org.eclipse.mylyn.tasks.ui >Index: src/org/eclipse/mylyn/internal/tasks/ui/messages.properties >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/messages.properties,v >retrieving revision 1.16 >diff -u -r1.16 messages.properties >--- src/org/eclipse/mylyn/internal/tasks/ui/messages.properties 12 Oct 2009 23:14:09 -0000 1.16 >+++ src/org/eclipse/mylyn/internal/tasks/ui/messages.properties 20 Nov 2009 11:50:45 -0000 >@@ -51,6 +51,7 @@ > TaskListNotificationManager_Open_Notification_Job=Open Notification Job > > TaskRepositoryLocationUi_Enter_HTTP_password=Enter HTTP password >+TaskRepositoryLocationUi_Enter_CLIENTCERTIFICATE_password=Enter Certificate password > TaskRepositoryLocationUi_Enter_proxy_password=Enter proxy password > TaskRepositoryLocationUi_Enter_repository_password=Enter repository password > >Index: src/org/eclipse/mylyn/internal/tasks/ui/TaskRepositoryLocationUi.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskRepositoryLocationUi.java,v >retrieving revision 1.23 >diff -u -r1.23 TaskRepositoryLocationUi.java >--- src/org/eclipse/mylyn/internal/tasks/ui/TaskRepositoryLocationUi.java 13 Oct 2009 03:10:02 -0000 1.23 >+++ src/org/eclipse/mylyn/internal/tasks/ui/TaskRepositoryLocationUi.java 20 Nov 2009 11:50:45 -0000 >@@ -124,7 +124,7 @@ > > private void initializeDialog(TaskRepositoryCredentialsDialog dialog) { > dialog.setTaskRepository(taskRepository); >- >+ dialog.setFileDialog(AuthenticationType.CLIENTCERTIFICATE.equals(authType)); > AuthenticationCredentials credentials = taskRepository.getCredentials(authType); > if (credentials != null) { > dialog.setUsername(credentials.getUserName()); >@@ -142,6 +142,8 @@ > private String getDefaultMessage() { > if (AuthenticationType.REPOSITORY.equals(authType)) { > return Messages.TaskRepositoryLocationUi_Enter_repository_password; >+ } else if (AuthenticationType.CLIENTCERTIFICATE.equals(authType)) { >+ return Messages.TaskRepositoryLocationUi_Enter_CLIENTCERTIFICATE_password; > } else if (AuthenticationType.HTTP.equals(authType)) { > return Messages.TaskRepositoryLocationUi_Enter_HTTP_password; > } else if (AuthenticationType.PROXY.equals(authType)) { >Index: src/org/eclipse/mylyn/internal/tasks/ui/Messages.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/Messages.java,v >retrieving revision 1.11 >diff -u -r1.11 Messages.java >--- src/org/eclipse/mylyn/internal/tasks/ui/Messages.java 12 Oct 2009 23:14:09 -0000 1.11 >+++ src/org/eclipse/mylyn/internal/tasks/ui/Messages.java 20 Nov 2009 11:50:45 -0000 >@@ -79,6 +79,8 @@ > > public static String TaskListNotificationManager_Open_Notification_Job; > >+ public static String TaskRepositoryLocationUi_Enter_CLIENTCERTIFICATE_password; >+ > public static String TaskRepositoryLocationUi_Enter_HTTP_password; > > public static String TaskRepositoryLocationUi_Enter_proxy_password; >Index: src/org/eclipse/mylyn/internal/tasks/ui/dialogs/Messages.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/dialogs/Messages.java,v >retrieving revision 1.5 >diff -u -r1.5 Messages.java >--- src/org/eclipse/mylyn/internal/tasks/ui/dialogs/Messages.java 24 Jul 2009 12:05:45 -0000 1.5 >+++ src/org/eclipse/mylyn/internal/tasks/ui/dialogs/Messages.java 20 Nov 2009 11:50:45 -0000 >@@ -43,8 +43,12 @@ > > public static String TaskListSortDialog_Title; > >+ public static String TaskRepositoryCredentialsDialog_ChooseCertificateFile; >+ > public static String TaskRepositoryCredentialsDialog_Enter_Credentials; > >+ public static String TaskRepositoryCredentialsDialog_Enter_repository_certificate; >+ > public static String TaskRepositoryCredentialsDialog_Enter_repository_credentials; > > public static String TaskRepositoryCredentialsDialog_HTML_Open_Repository_Properties; >@@ -61,6 +65,8 @@ > > public static String TaskRepositoryCredentialsDialog_User_ID; > >+ public static String TaskRepositoryCredentialsDialog_Filename; >+ > public static String UiLegendControl_Active_task; > > public static String UiLegendControl_Adjust_Colors_and_Fonts_; >Index: src/org/eclipse/mylyn/internal/tasks/ui/dialogs/messages.properties >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/dialogs/messages.properties,v >retrieving revision 1.5 >diff -u -r1.5 messages.properties >--- src/org/eclipse/mylyn/internal/tasks/ui/dialogs/messages.properties 24 Jul 2009 12:05:45 -0000 1.5 >+++ src/org/eclipse/mylyn/internal/tasks/ui/dialogs/messages.properties 20 Nov 2009 11:50:46 -0000 >@@ -18,15 +18,18 @@ > TaskListSortDialog_Grouped_by=Group by: > TaskListSortDialog_Title=Task List Sorting > >-TaskRepositoryCredentialsDialog_Enter_Credentials=Enter Credentials >+TaskRepositoryCredentialsDialog_ChooseCertificateFile=Browse >+TaskRepositoryCredentialsDialog_Enter_Credentials=Enter Credentials > TaskRepositoryCredentialsDialog_Enter_repository_credentials=Enter repository credentials >+TaskRepositoryCredentialsDialog_Enter_repository_certificate=Enter certificate details > TaskRepositoryCredentialsDialog_HTML_Open_Repository_Properties=<a href="properties">Open Repository Properties</a> to disable background synchronization by disconnecting the repository. > TaskRepositoryCredentialsDialog_Password=&Password: > TaskRepositoryCredentialsDialog_Repository_Authentication=Repository Authentication > TaskRepositoryCredentialsDialog_Save_Password=&Save Password > TaskRepositoryCredentialsDialog_Saved_passwords_are_stored_that_is_difficult=Saved passwords are stored on your computer in a file that is difficult, but not impossible, for an intruder to read. > TaskRepositoryCredentialsDialog_Task_Repository=Task Repository\: >-TaskRepositoryCredentialsDialog_User_ID=&User ID: >+TaskRepositoryCredentialsDialog_User_ID=&User ID: >+TaskRepositoryCredentialsDialog_Filename=&Filename: > > UiLegendControl_Active_task=Active task > UiLegendControl_Adjust_Colors_and_Fonts_=Adjust Colors and Fonts... >Index: src/org/eclipse/mylyn/internal/tasks/ui/dialogs/TaskRepositoryCredentialsDialog.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/dialogs/TaskRepositoryCredentialsDialog.java,v >retrieving revision 1.10 >diff -u -r1.10 TaskRepositoryCredentialsDialog.java >--- src/org/eclipse/mylyn/internal/tasks/ui/dialogs/TaskRepositoryCredentialsDialog.java 7 Dec 2008 05:33:13 -0000 1.10 >+++ src/org/eclipse/mylyn/internal/tasks/ui/dialogs/TaskRepositoryCredentialsDialog.java 20 Nov 2009 11:50:46 -0000 >@@ -34,6 +34,7 @@ > import org.eclipse.swt.widgets.Button; > import org.eclipse.swt.widgets.Composite; > import org.eclipse.swt.widgets.Control; >+import org.eclipse.swt.widgets.FileDialog; > import org.eclipse.swt.widgets.Label; > import org.eclipse.swt.widgets.Link; > import org.eclipse.swt.widgets.Shell; >@@ -72,6 +73,10 @@ > > private String username = ""; //$NON-NLS-1$ > >+ private Button certBrowseButton; >+ >+ private boolean isFileDialog; >+ > private TaskRepositoryCredentialsDialog(Shell parentShell) { > super(parentShell); > } >@@ -110,7 +115,7 @@ > > private void createCenterArea(Composite parent) { > Composite composite = new Composite(parent, SWT.NONE); >- composite.setLayout(new GridLayout(2, false)); >+ composite.setLayout(new GridLayout(3, false)); > composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); > > if (taskRepository != null) { >@@ -119,7 +124,7 @@ > layout.marginHeight = 0; > layout.marginWidth = 0; > labelComposite.setLayout(layout); >- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).span(2, 1).applyTo( >+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).span(3, 1).applyTo( > labelComposite); > > Label label = new Label(labelComposite, SWT.NONE); >@@ -132,7 +137,11 @@ > label.setText(taskRepository.getRepositoryLabel()); > } > >- new Label(composite, SWT.NONE).setText(Messages.TaskRepositoryCredentialsDialog_User_ID); >+ if (isFileDialog) { >+ new Label(composite, SWT.NONE).setText(Messages.TaskRepositoryCredentialsDialog_Filename); >+ } else { >+ new Label(composite, SWT.NONE).setText(Messages.TaskRepositoryCredentialsDialog_User_ID); >+ } > > final Text usernameField = new Text(composite, SWT.BORDER); > usernameField.addModifyListener(new ModifyListener() { >@@ -150,6 +159,25 @@ > .grab(true, false) > .applyTo(usernameField); > >+ if (isFileDialog) { >+ certBrowseButton = new Button(composite, SWT.PUSH); >+ certBrowseButton.setText(Messages.TaskRepositoryCredentialsDialog_ChooseCertificateFile); >+ certBrowseButton.addSelectionListener(new SelectionAdapter() { >+ @Override >+ public void widgetSelected(SelectionEvent e) { >+ FileDialog fileDialog = new FileDialog(getShell(), SWT.OPEN); >+ fileDialog.setFilterPath(System.getProperty("user.home", ".")); //$NON-NLS-1$ //$NON-NLS-2$ >+ String returnFile = fileDialog.open(); >+ if (returnFile != null) { >+ username = returnFile; >+ usernameField.setText(returnFile); >+ } >+ } >+ }); >+ } else { >+ new Label(composite, SWT.NONE).setText(""); //$NON-NLS-1$ >+ } >+ > new Label(composite, SWT.NONE).setText(Messages.TaskRepositoryCredentialsDialog_Password); > > final Text passwordField = new Text(composite, SWT.BORDER | SWT.PASSWORD); >@@ -295,4 +323,13 @@ > this.username = username; > } > >+ /** >+ * switch from asking for username / password to asking for certificate-file / password >+ * >+ * @param isFileDialog >+ */ >+ public void setFileDialog(boolean isFileDialog) { >+ this.isFileDialog = isFileDialog; >+ } >+ > } >Index: src/org/eclipse/mylyn/internal/tasks/ui/wizards/messages.properties >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/messages.properties,v >retrieving revision 1.17 >diff -u -r1.17 messages.properties >--- src/org/eclipse/mylyn/internal/tasks/ui/wizards/messages.properties 18 Sep 2009 06:10:02 -0000 1.17 >+++ src/org/eclipse/mylyn/internal/tasks/ui/wizards/messages.properties 20 Nov 2009 11:50:46 -0000 >@@ -112,7 +112,12 @@ > AbstractRepositorySettingsPage_Label_=Label\:\ > AbstractRepositorySettingsPage_Other=Other\: > AbstractRepositorySettingsPage_Password_=Password\:\ >-AbstractRepositorySettingsPage_Problems_encountered_determining_available_charsets=Problems encountered determining available charsets >+AbstractRepositorySettingsPage_Problems_encountered_determining_available_charsets=Problems encountered determining available charsets >+AbstractRepositorySettingsPage_certificate_settings=Certificate >+AbstractRepositorySettingsPage_Enable_certificate_authentification=Enable Certificate Authentification >+AbstractRepositorySettingsPage_ChooseCertificateFile_=Browse >+AbstractRepositorySettingsPage_CertificateFile_=Certificate File\:\ >+AbstractRepositorySettingsPage_CertificatePassword_=Certificate Password\:\ > AbstractRepositorySettingsPage_Proxy_host_address_=Proxy host address\:\ > AbstractRepositorySettingsPage_Proxy_host_port_=Proxy host port\:\ > AbstractRepositorySettingsPage_Proxy_Server_Configuration=Proxy Server Configuration >Index: src/org/eclipse/mylyn/internal/tasks/ui/wizards/Messages.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/wizards/Messages.java,v >retrieving revision 1.15 >diff -u -r1.15 Messages.java >--- src/org/eclipse/mylyn/internal/tasks/ui/wizards/Messages.java 19 Aug 2009 03:43:18 -0000 1.15 >+++ src/org/eclipse/mylyn/internal/tasks/ui/wizards/Messages.java 20 Nov 2009 11:50:46 -0000 >@@ -203,6 +203,16 @@ > > public static String AbstractRepositorySettingsPage_Password_; > >+ public static String AbstractRepositorySettingsPage_certificate_settings; >+ >+ public static String AbstractRepositorySettingsPage_Enable_certificate_authentification; >+ >+ public static String AbstractRepositorySettingsPage_CertificateFile_; >+ >+ public static String AbstractRepositorySettingsPage_ChooseCertificateFile_; >+ >+ public static String AbstractRepositorySettingsPage_CertificatePassword_; >+ > public static String AbstractRepositorySettingsPage_Problems_encountered_determining_available_charsets; > > public static String AbstractRepositorySettingsPage_Proxy_host_address_; >Index: src/org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositorySettingsPage.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositorySettingsPage.java,v >retrieving revision 1.76 >diff -u -r1.76 AbstractRepositorySettingsPage.java >--- src/org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositorySettingsPage.java 2 Nov 2009 19:44:33 -0000 1.76 >+++ src/org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositorySettingsPage.java 20 Nov 2009 11:50:46 -0000 >@@ -56,6 +56,7 @@ > import org.eclipse.swt.widgets.Button; > import org.eclipse.swt.widgets.Combo; > import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.FileDialog; > import org.eclipse.swt.widgets.Label; > import org.eclipse.swt.widgets.Text; > import org.eclipse.ui.IWorkbench; >@@ -116,6 +117,12 @@ > > protected StringFieldEditor httpAuthPasswordEditor; > >+ protected StringFieldEditor certAuthFileNameEditor; >+ >+ protected Button certBrowseButton; >+ >+ protected StringFieldEditor certAuthPasswordEditor; >+ > protected StringFieldEditor proxyHostnameEditor; > > protected StringFieldEditor proxyPortEditor; >@@ -143,12 +150,18 @@ > > private String oldHttpAuthPassword; > >+ private String oldCertAuthFileName; >+ >+ private String oldCertAuthPassword; >+ > private boolean needsAnonymousLogin; > > private boolean needsTimeZone; > > private boolean needsEncoding; > >+ private boolean needsCertAuth; >+ > private boolean needsHttpAuth; > > private boolean needsValidation; >@@ -159,6 +172,8 @@ > > private Composite advancedComp; > >+ private Composite certAuthComp; >+ > private Composite httpAuthComp; > > private Composite proxyAuthComp; >@@ -169,6 +184,8 @@ > > private Button otherEncoding; > >+ private Button certAuthButton; >+ > private Button httpAuthButton; > > private boolean needsProxy; >@@ -198,6 +215,8 @@ > > private Button saveHttpPasswordButton; > >+ private Button saveCertPasswordButton; >+ > private Button saveProxyPasswordButton; > > private Button disconnectedButton; >@@ -447,6 +466,10 @@ > createAdvancedSection(); > } > >+ if (needsCertAuth()) { >+ createCertAuthSection(); >+ } >+ > if (needsHttpAuth()) { > createHttpAuthSection(); > } >@@ -612,6 +635,98 @@ > } > } > >+ private void createCertAuthSection() { >+ ExpandableComposite section = createSection(compositeContainer, >+ Messages.AbstractRepositorySettingsPage_certificate_settings); >+ >+ certAuthComp = toolkit.createComposite(section, SWT.NONE); >+ certAuthComp.setBackground(compositeContainer.getBackground()); >+ section.setClient(certAuthComp); >+ >+ certAuthButton = new Button(certAuthComp, SWT.CHECK); >+ GridDataFactory.fillDefaults().indent(0, 5).align(SWT.LEFT, SWT.TOP).span(3, SWT.DEFAULT).applyTo( >+ certAuthButton); >+ >+ certAuthButton.setText(Messages.AbstractRepositorySettingsPage_Enable_certificate_authentification); >+ >+ certAuthButton.addSelectionListener(new SelectionListener() { >+ public void widgetSelected(SelectionEvent e) { >+ setCertAuth(certAuthButton.getSelection()); >+ } >+ >+ public void widgetDefaultSelected(SelectionEvent e) { >+ // ignore >+ } >+ }); >+ >+ certAuthFileNameEditor = new StringFieldEditor( >+ "", Messages.AbstractRepositorySettingsPage_CertificateFile_, StringFieldEditor.UNLIMITED, certAuthComp) { //$NON-NLS-1$ >+ >+ @Override >+ protected boolean doCheckState() { >+ return true; >+ } >+ >+ @Override >+ protected void valueChanged() { >+ super.valueChanged(); >+ if (getWizard() != null) { >+ getWizard().getContainer().updateButtons(); >+ } >+ } >+ >+ @Override >+ public int getNumberOfControls() { >+ return 2; >+ } >+ }; >+ >+ certBrowseButton = new Button(certAuthComp, SWT.PUSH); >+ certBrowseButton.setText(Messages.AbstractRepositorySettingsPage_ChooseCertificateFile_); >+ certBrowseButton.addSelectionListener(new SelectionAdapter() { >+ @Override >+ public void widgetSelected(SelectionEvent e) { >+ FileDialog fileDialog = new FileDialog(getShell(), SWT.OPEN); >+ fileDialog.setFilterPath(System.getProperty("user.home", ".")); //$NON-NLS-1$ //$NON-NLS-2$ >+ String returnFile = fileDialog.open(); >+ if (returnFile != null) { >+ certAuthFileNameEditor.setStringValue(returnFile); >+ } >+ } >+ }); >+ >+ certAuthPasswordEditor = new RepositoryStringFieldEditor( >+ "", Messages.AbstractRepositorySettingsPage_CertificatePassword_, StringFieldEditor.UNLIMITED, //$NON-NLS-1$ >+ certAuthComp) { >+ @Override >+ public int getNumberOfControls() { >+ return 2; >+ } >+ }; >+ ((RepositoryStringFieldEditor) certAuthPasswordEditor).getTextControl().setEchoChar('*'); >+ >+ saveCertPasswordButton = new Button(certAuthComp, SWT.CHECK); >+ saveCertPasswordButton.setText(Messages.AbstractRepositorySettingsPage_Save_Password); >+ >+ certAuthFileNameEditor.setEnabled(certAuthButton.getSelection(), certAuthComp); >+ certBrowseButton.setEnabled(certAuthButton.getSelection()); >+ certAuthPasswordEditor.setEnabled(certAuthButton.getSelection(), certAuthComp); >+ saveCertPasswordButton.setEnabled(certAuthButton.getSelection()); >+ >+ if (repository != null) { >+ saveCertPasswordButton.setSelection(repository.getSavePassword(AuthenticationType.CLIENTCERTIFICATE)); >+ } else { >+ saveCertPasswordButton.setSelection(false); >+ } >+ setCertAuth(oldCertAuthPassword != null || oldCertAuthFileName != null); >+ section.setExpanded(certAuthButton.getSelection()); >+ >+ GridLayout gridLayout2 = new GridLayout(); >+ gridLayout2.numColumns = 3; >+ gridLayout2.marginWidth = 0; >+ certAuthComp.setLayout(gridLayout2); >+ } >+ > private void createHttpAuthSection() { > ExpandableComposite section = createSection(compositeContainer, > Messages.AbstractRepositorySettingsPage_Http_Authentication); >@@ -701,6 +816,15 @@ > oldPassword = ""; //$NON-NLS-1$ > } > >+ AuthenticationCredentials oldCertCredentials = repository.getCredentials(AuthenticationType.CLIENTCERTIFICATE); >+ if (oldCertCredentials != null) { >+ oldCertAuthFileName = oldCertCredentials.getUserName(); >+ oldCertAuthPassword = oldCertCredentials.getPassword(); >+ } else { >+ oldCertAuthPassword = null; >+ oldCertAuthFileName = null; >+ } >+ > AuthenticationCredentials oldHttpCredentials = repository.getCredentials(AuthenticationType.HTTP); > if (oldHttpCredentials != null) { > oldHttpAuthUserId = oldHttpCredentials.getUserName(); >@@ -733,6 +857,8 @@ > oldPassword = ""; //$NON-NLS-1$ > oldHttpAuthPassword = null; > oldHttpAuthUserId = null; >+ oldCertAuthFileName = null; >+ oldCertAuthPassword = null; > } > } > >@@ -989,6 +1115,29 @@ > } > > /** >+ * @since 2.0 >+ */ >+ public void setCertAuth(boolean selected) { >+ if (!needsCertAuth) { >+ return; >+ } >+ certAuthButton.setSelection(selected); >+ if (!selected) { >+ oldCertAuthFileName = certAuthFileNameEditor.getStringValue(); >+ oldCertAuthPassword = certAuthPasswordEditor.getStringValue(); >+ certAuthFileNameEditor.setStringValue(null); >+ certAuthPasswordEditor.setStringValue(null); >+ } else { >+ certAuthFileNameEditor.setStringValue(oldCertAuthFileName); >+ certAuthPasswordEditor.setStringValue(oldCertAuthPassword); >+ } >+ certAuthFileNameEditor.setEnabled(selected, certAuthComp); >+ certBrowseButton.setEnabled(selected); >+ certAuthPasswordEditor.setEnabled(selected, certAuthComp); >+ saveCertPasswordButton.setEnabled(selected); >+ } >+ >+ /** > * @since 2.2 > */ > public boolean getHttpAuth() { >@@ -996,6 +1145,13 @@ > } > > /** >+ * @since 2.2 >+ */ >+ public boolean getCertAuth() { >+ return certAuthButton.getSelection(); >+ } >+ >+ /** > * @since 2.0 > */ > public void setUseDefaultProxy(boolean selected) { >@@ -1160,6 +1316,28 @@ > /** > * @since 2.0 > */ >+ public String getCertAuthFileName() { >+ if (needsCertAuth()) { >+ return certAuthFileNameEditor.getStringValue(); >+ } else { >+ return ""; //$NON-NLS-1$ >+ } >+ } >+ >+ /** >+ * @since 2.0 >+ */ >+ public String getCertAuthPassword() { >+ if (needsCertAuth()) { >+ return certAuthPasswordEditor.getStringValue(); >+ } else { >+ return ""; //$NON-NLS-1$ >+ } >+ } >+ >+ /** >+ * @since 2.0 >+ */ > public String getProxyHostname() { > if (needsProxy()) { > return proxyHostnameEditor.getStringValue(); >@@ -1381,6 +1559,16 @@ > } > repository.setRepositoryLabel(getRepositoryLabel()); > >+ if (needsCertAuth()) { >+ if (getCertAuth()) { >+ AuthenticationCredentials webCredentials = new AuthenticationCredentials(getCertAuthFileName(), >+ getCertAuthPassword()); >+ repository.setCredentials(AuthenticationType.CLIENTCERTIFICATE, webCredentials, getSaveCertPassword()); >+ } else { >+ repository.setCredentials(AuthenticationType.CLIENTCERTIFICATE, null, getSaveCertPassword()); >+ } >+ } >+ > if (needsHttpAuth()) { > if (getHttpAuth()) { > AuthenticationCredentials webCredentials = new AuthenticationCredentials(getHttpAuthUserId(), >@@ -1468,6 +1656,20 @@ > } > > /** >+ * >+ */ >+ public boolean needsCertAuth() { >+ return this.needsCertAuth; >+ } >+ >+ /** >+ * >+ */ >+ public void setNeedsCertAuth(boolean needsCertificate) { >+ this.needsCertAuth = needsCertificate; >+ } >+ >+ /** > * @since 2.0 > */ > public boolean needsHttpAuth() { >@@ -1561,6 +1763,17 @@ > /** > * @since 2.2 > */ >+ public Boolean getSaveCertPassword() { >+ if (needsCertAuth()) { >+ return saveCertPasswordButton.getSelection(); >+ } else { >+ return false; >+ } >+ } >+ >+ /** >+ * @since 2.2 >+ */ > public Boolean getSaveHttpPassword() { > if (needsHttpAuth()) { > return saveHttpPasswordButton.getSelection();
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
steffen.pingel
:
iplog+
Actions:
View
Attachments on
bug 295050
:
152140
|
152510
| 152701 |
196386
|
196390
|
197039