]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.project/src/org/simantics/project/management/TrustAllCertificates.java
Support ontology install option trueWhenDeployed also during development
[simantics/platform.git] / bundles / org.simantics.project / src / org / simantics / project / management / TrustAllCertificates.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management
3  * in Industry THTH ry.
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.project.management;
13
14 import java.security.cert.Certificate;
15 import java.util.ArrayList;
16
17 import org.eclipse.equinox.p2.core.UIServices;
18
19 public class TrustAllCertificates extends UIServices {
20         @Override
21         public AuthenticationInfo getUsernamePassword(String location) {
22                 return null;
23         }
24
25         @Override
26         public AuthenticationInfo getUsernamePassword(String location, AuthenticationInfo previousInfo) {
27                 return null;
28         }
29
30         @Override
31         public TrustInfo getTrustInfo(Certificate[][] untrustedChain, String[] unsignedDetail) {
32                 ArrayList<Certificate> trustedCertificates = new ArrayList<Certificate>();
33                 for (Certificate[] chain : untrustedChain) {
34                         for (Certificate c : chain) {
35                                 trustedCertificates.add(c);
36                         }
37                 }
38                 // Trust all certificates!
39                 return new TrustInfo(trustedCertificates.toArray(new Certificate[0]), false, true);
40         }
41 }