Changeset 2093
- Timestamp:
- 03/10/07 03:42:01 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
eclipsetracplugin/eclipse/trunk/mm.eclipse.trac/src/mm/eclipse/trac/perspective/PerspectiveFactory.java
r2003 r2093 21 21 IFolderLayout bottom = layout.createFolder( "bottom", IPageLayout.BOTTOM, 0.85f, 22 22 editorArea ); 23 bottom.addView( "mm.eclipse.trac.server.ServerView" ); 23 24 bottom.addView( "mm.eclipse.trac.views.WikiPageHistory" ); 24 25 eclipsetracplugin/eclipse/trunk/mm.eclipse.trac/src/mm/eclipse/trac/xmlrpc/Trac.java
r2016 r2093 2 2 3 3 import java.net.URL; 4 import java.security.cert.X509Certificate; 5 6 import javax.net.ssl.HostnameVerifier; 7 import javax.net.ssl.HttpsURLConnection; 8 import javax.net.ssl.SSLContext; 9 import javax.net.ssl.SSLSession; 10 import javax.net.ssl.TrustManager; 11 import javax.net.ssl.X509TrustManager; 12 13 import mm.eclipse.trac.Log; 4 14 5 15 import org.apache.xmlrpc.client.XmlRpcClient; … … 14 24 15 25 public Trac( URL url, String username, String password, boolean anonymous ) 16 throws Exception26 throws Exception 17 27 { 28 installSslCertificateHandler(); 29 18 30 XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl(); 19 31 … … 29 41 // will fail, without the system asking credentials with an 30 42 // intrusive dialog. 31 if ( username.length() == 0 ) username = "xxxx"; 43 if ( username.length() == 0 ) 44 username = "xxxx"; 32 45 config.setBasicUserName( username ); 33 46 34 if ( password.length() == 0 ) password = "xxxx"; 47 if ( password.length() == 0 ) 48 password = "xxxx"; 35 49 config.setBasicPassword( password ); 36 50 } … … 66 80 } 67 81 82 private void installSslCertificateHandler() 83 { 84 // Create a trust manager that does not validate certificate chains 85 86 TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() { 87 public X509Certificate[] getAcceptedIssuers() 88 { 89 return null; 90 } 91 92 public void checkClientTrusted( X509Certificate[] certs, String authType ) 93 { 94 // Trust always 95 } 96 97 public void checkServerTrusted( X509Certificate[] certs, String authType ) 98 { 99 // Trust always 100 } 101 } }; 102 103 // Install the all-trusting trust manager 104 try 105 { 106 SSLContext sc = SSLContext.getInstance( "SSL" ); 107 108 // Create empty HostnameVerifier 109 HostnameVerifier hv = new HostnameVerifier() { 110 public boolean verify( String arg0, SSLSession arg1 ) 111 { 112 return true; 113 } 114 }; 115 116 sc.init( null, trustAllCerts, new java.security.SecureRandom() ); 117 HttpsURLConnection.setDefaultSSLSocketFactory( sc.getSocketFactory() ); 118 HttpsURLConnection.setDefaultHostnameVerifier( hv ); 119 120 } catch ( Exception e ) 121 { 122 Log.error( "Error installing SSL handler", e ); 123 } 124 125 126 } 68 127 }
