Package org.apache.cxf.transport.http

Examples of org.apache.cxf.transport.http.UntrustedURLConnectionIOException


                            }
                            HttpsURLConnectionInfo info = (HttpsURLConnectionInfo)connectionInfo;

                            if (info.getServerCertificates() == null
                                    || info.getServerCertificates().length == 0) {
                                throw new UntrustedURLConnectionIOException(
                                    "No server certificates were found"
                                );
                            } else {
                                X509Certificate[] certs = (X509Certificate[])info.getServerCertificates();
                                if (!certConstraints.matches(certs[0])) {
                                    throw new UntrustedURLConnectionIOException(
                                        "The server certificate(s) do not match the defined cert constraints"
                                    );
                                }
                            }
                        }
                    };
                    message.put(MessageTrustDecider.class, trust);
                } else {
                    throw new UntrustedURLConnectionIOException(
                        "TLS is not in use"
                    );
                }
            } catch (UntrustedURLConnectionIOException ex) {
                throw new Fault(ex);
            }
        } else {
            try {
                TLSSessionInfo tlsInfo = message.get(TLSSessionInfo.class);
                final Certificate[] certs = tlsInfo.getPeerCertificates();
                if (certs == null || certs.length == 0) {
                    throw new UntrustedURLConnectionIOException(
                        "No client certificates were found"
                    );
                } else {
                    X509Certificate[] x509Certs = (X509Certificate[])certs;
                    if (!certConstraints.matches(x509Certs[0])) {
                        throw new UntrustedURLConnectionIOException(
                            "The client certificate does not match the defined cert constraints"
                        );
                    }
                }
            } catch (UntrustedURLConnectionIOException ex) {
View Full Code Here


                trusted = trusted
                         || ci.getPeerPrincipal()
                                 .toString().contains("OU=" + trustName[i]);
            }
            if (!trusted) {
                throw new UntrustedURLConnectionIOException(
                        "Peer Principal \""
                        + ci.getPeerPrincipal()
                        + "\" does not contain "
                        + getTrustNames());
            }
View Full Code Here

                                    orig.establishTrust(conduitName, connectionInfo, message);
                                }
                                HttpsURLConnectionInfo info = (HttpsURLConnectionInfo)connectionInfo;
                                if (info.getLocalCertificates() == null
                                    || info.getLocalCertificates().length == 0) {
                                    throw new UntrustedURLConnectionIOException(
                                        "RequireClientCertificate is set, "
                                        + "but no local certificates were negotiated.  Is"
                                        + " the server set to ask for client authorization?");
                                }
                            }
View Full Code Here

                trusted = trusted
                         || ci.getPeerPrincipal()
                                 .toString().contains("OU=" + trustName[i]);
            }
            if (!trusted) {
                throw new UntrustedURLConnectionIOException(
                        "Peer Principal \""
                        + ci.getPeerPrincipal()
                        + "\" does not contain "
                        + getTrustNames());
            }
View Full Code Here

                trusted = trusted
                         || ci.getPeerPrincipal()
                                 .toString().contains("OU=" + trustName[i]);
            }
            if (!trusted) {
                throw new UntrustedURLConnectionIOException(
                        "Peer Principal \""
                        + ci.getPeerPrincipal()
                        + "\" does not contain "
                        + getTrustNames());
            }
View Full Code Here

        }
        HttpsURLConnectionInfo info = (HttpsURLConnectionInfo)connectionInfo;

        if (info.getServerCertificates() == null
                || info.getServerCertificates().length == 0) {
            throw new UntrustedURLConnectionIOException(
                "No server certificates were found"
            );
        } else {
            X509Certificate[] certs = (X509Certificate[])info.getServerCertificates();
            if (!certConstraints.matches(certs[0])) {
                throw new UntrustedURLConnectionIOException(
                    "The server certificate(s) do not match the defined cert constraints"
                );
            }
        }
    }
View Full Code Here

                if (connection instanceof HttpsURLConnection) {
                    final MessageTrustDecider orig = message.get(MessageTrustDecider.class);
                    MessageTrustDecider trust = new HttpsMessageTrustDecider(certConstraints, orig);
                    message.put(MessageTrustDecider.class, trust);
                } else {
                    throw new UntrustedURLConnectionIOException(
                        "TLS is not in use"
                    );
                }
            } catch (UntrustedURLConnectionIOException ex) {
                throw new Fault(ex);
            }
        } else {
            try {
                TLSSessionInfo tlsInfo = message.get(TLSSessionInfo.class);
                final Certificate[] certs = tlsInfo.getPeerCertificates();
                if (certs == null || certs.length == 0) {
                    throw new UntrustedURLConnectionIOException(
                        "No client certificates were found"
                    );
                } else {
                    X509Certificate[] x509Certs = (X509Certificate[])certs;
                    if (!certConstraints.matches(x509Certs[0])) {
                        throw new UntrustedURLConnectionIOException(
                            "The client certificate does not match the defined cert constraints"
                        );
                    }
                }
            } catch (UntrustedURLConnectionIOException ex) {
View Full Code Here

                                    orig.establishTrust(conduitName, connectionInfo, message);
                                }
                                HttpsURLConnectionInfo info = (HttpsURLConnectionInfo)connectionInfo;
                                if (info.getLocalCertificates() == null
                                    || info.getLocalCertificates().length == 0) {
                                    throw new UntrustedURLConnectionIOException(
                                        "RequireClientCertificate is set, "
                                        + "but no local certificates were negotiated.  Is"
                                        + " the server set to ask for client authorization?");
                                }
                            }
View Full Code Here

                trusted = trusted
                         || ci.getPeerPrincipal()
                                 .toString().contains("OU=" + trustName[i]);
            }
            if (!trusted) {
                throw new UntrustedURLConnectionIOException(
                        "Peer Principal \""
                        + ci.getPeerPrincipal()
                        + "\" does not contain "
                        + getTrustNames());
            }
View Full Code Here

                                    orig.establishTrust(conduitName, connectionInfo, message);
                                }
                                HttpsURLConnectionInfo info = (HttpsURLConnectionInfo)connectionInfo;
                                if (info.getLocalCertificates() == null
                                    || info.getLocalCertificates().length == 0) {
                                    throw new UntrustedURLConnectionIOException(
                                        "RequireClientCertificate is set, "
                                        + "but no local certificates were negotiated.  Is"
                                        + " the server set to ask for client authorization?");
                                }
                            }
View Full Code Here

TOP

Related Classes of org.apache.cxf.transport.http.UntrustedURLConnectionIOException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.