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 152140 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 for my change-request
bx-mylyn-patch.txt (text/plain), 31.15 KB, created by
torsten
on 2009-11-13 05:04:44 EST
(
hide
)
Description:
Patch for my change-request
Filename:
MIME Type:
Creator:
torsten
Created:
2009-11-13 05:04:44 EST
Size:
31.15 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 13 Nov 2009 07:36:42 -0000 >@@ -61,6 +61,7 @@ > > public TracRepositorySettingsPage(TaskRepository taskRepository) { > super(TITLE, DESCRIPTION, taskRepository); >+ setNeedsCertAuth(true); > setNeedsAnonymousLogin(true); > setNeedsEncoding(false); > setNeedsTimeZone(false); >#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 13 Nov 2009 07:36:44 -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 13 Nov 2009 07:36:46 -0000 >@@ -172,6 +172,8 @@ > authenticationType = AuthenticationType.REPOSITORY; > } else if (code == HttpStatus.SC_PROXY_AUTHENTICATION_REQUIRED) { > authenticationType = AuthenticationType.PROXY; >+ } else if (code == HttpStatus.SC_EXPECTATION_FAILED) { >+ authenticationType = AuthenticationType.CLIENTCERTIFICATE; > } else { > return false; > } >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 13 Nov 2009 07:36:46 -0000 >@@ -403,7 +403,11 @@ > } > } catch (TracPermissionDeniedException e) { > try { >- location.requestCredentials(AuthenticationType.REPOSITORY, null, monitor); >+ if (location.getCredentials(AuthenticationType.CLIENTCERTIFICATE) != null) { >+ location.requestCredentials(AuthenticationType.CLIENTCERTIFICATE, null, monitor); >+ } else { >+ location.requestCredentials(AuthenticationType.REPOSITORY, null, monitor); >+ } > } catch (UnsupportedRequestException ignored) { > throw e; > } >#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 13 Nov 2009 07:36:47 -0000 >@@ -76,6 +76,30 @@ > } > } > >+ public PollingSslProtocolSocketFactory(String KeyStoreName, String KeyStorePassword, String type) { >+ 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.ERROR, "Could not initialize keystore", e); //$NON-NLS-1$ >+ } >+ >+ 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 initialize 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 13 Nov 2009 07:36:47 -0000 >@@ -27,6 +27,7 @@ > import java.util.concurrent.TimeUnit; > import java.util.concurrent.TimeoutException; > >+import javax.net.ssl.SSLHandshakeException; > import javax.swing.text.html.HTML.Tag; > > import org.apache.commons.httpclient.Credentials; >@@ -174,6 +175,10 @@ > > private static MultiThreadedHttpConnectionManager connectionManager; > >+ /** >+ * see below an extension for PollingSslProtocolSocketFactory to use program-saved SSL-Parameters. >+ */ >+ > private static ProtocolSocketFactory sslSocketFactory = new PollingSslProtocolSocketFactory(); > > private static PollingProtocolSocketFactory socketFactory = new PollingProtocolSocketFactory(); >@@ -279,8 +284,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); >@@ -316,7 +328,18 @@ > > @Override > public Integer execute() throws Exception { >- return client.executeMethod(hostConfiguration, method, state); >+ int code = 0; >+ try { >+ code = client.executeMethod(hostConfiguration, method, state); >+ } catch (SSLHandshakeException ex) { >+ if (hostConfiguration.getProtocol().getSocketFactory() != sslSocketFactory) { >+ /* FIXME: Is there a better return-code ?*/ >+ return HttpStatus.SC_EXPECTATION_FAILED; >+ } else { >+ throw ex; >+ } >+ } >+ return code; > } > }; > >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 13 Nov 2009 07:36:47 -0000 >@@ -26,5 +26,9 @@ > /** Proxy authentication. */ > PROXY, > /** Task repository authentication. */ >- REPOSITORY >+ REPOSITORY, >+ /** >+ * Client authentification using certificates Username is the filename and password the password to access it. >+ */ >+ CLIENTCERTIFICATE > } >\ No newline at end of file >#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 13 Nov 2009 07:36:49 -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 13 Nov 2009 07:36:49 -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 13 Nov 2009 07:36:49 -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 13 Nov 2009 07:36:49 -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 13 Nov 2009 07:36:49 -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 13 Nov 2009 07:36:49 -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 13 Nov 2009 07:36:49 -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 13 Nov 2009 07:36:49 -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 13 Nov 2009 07:36:49 -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
Actions:
View
Attachments on
bug 295050
:
152140
|
152510
|
152701
|
196386
|
196390
|
197039