001: /**
002: * Licensed to the Apache Software Foundation (ASF) under one
003: * or more contributor license agreements. See the NOTICE file
004: * distributed with this work for additional information
005: * regarding copyright ownership. The ASF licenses this file
006: * to you under the Apache License, Version 2.0 (the
007: * "License"); you may not use this file except in compliance
008: * with the License. You may obtain a copy of the License at
009: *
010: * http://www.apache.org/licenses/LICENSE-2.0
011: *
012: * Unless required by applicable law or agreed to in writing,
013: * software distributed under the License is distributed on an
014: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015: * KIND, either express or implied. See the License for the
016: * specific language governing permissions and limitations
017: * under the License.
018: */package org.apache.cxf.transport.https;
019:
020: import java.io.IOException;
021: import java.security.Principal;
022: import java.security.cert.Certificate;
023:
024: import javax.net.ssl.HttpsURLConnection;
025:
026: import org.apache.cxf.transport.http.HttpURLConnectionInfo;
027:
028: /**
029: * This class holds information about the HttpsURLConnection. This
030: * class should be used when the getURL().getProtocol() is "https".
031: */
032: public class HttpsURLConnectionInfo extends HttpURLConnectionInfo {
033:
034: /**
035: * This field contains the cipherSuite enabled in the
036: * HTTPS URLconnection.
037: */
038: protected final String enabledCipherSuite;
039:
040: /**
041: * This field contains the certificates that were used to
042: * authenticate the connection to the peer.
043: */
044: protected final Certificate[] localCertificates;
045:
046: /**
047: * This field contains the Principal that authenticated to the
048: * peer.
049: */
050: protected final Principal localPrincipal;
051:
052: /**
053: * This field contains the certificates the server presented
054: * to authenticate.
055: */
056: protected final Certificate[] serverCertificates;
057:
058: /**
059: * This field contains the Principal that represents the
060: * authenticated peer.
061: */
062: protected final Principal peerPrincipal;
063:
064: /**
065: * This constructor is used to create the info object
066: * representing the this HttpsURLConnection.
067: */
068: HttpsURLConnectionInfo(HttpsURLConnection connection)
069: throws IOException {
070: super (connection);
071:
072: enabledCipherSuite = connection.getCipherSuite();
073: localCertificates = connection.getLocalCertificates();
074: localPrincipal = connection.getLocalPrincipal();
075: serverCertificates = connection.getServerCertificates();
076: peerPrincipal = connection.getPeerPrincipal();
077: }
078:
079: /**
080: * This method returns the cipher suite employed in this
081: * HttpsURLConnection.
082: */
083: public String getEnabledCipherSuite() {
084: return enabledCipherSuite;
085: }
086:
087: /**
088: * This method returns the certificates that were used to
089: * authenticate to the peer.
090: */
091: public Certificate[] getLocalCertificates() {
092: return localCertificates;
093: }
094:
095: /**
096: * This method returns the Princpal that authenticated to
097: * the peer.
098: */
099: public Principal getLocalPrincipal() {
100: return localPrincipal;
101: }
102:
103: /**
104: * This method returns the certificates presented by the
105: * peer for authentication.
106: */
107: public Certificate[] getServerCertificates() {
108: return serverCertificates;
109: }
110:
111: /**
112: * This method returns the Principal that represents the
113: * authenticated peer.
114: */
115: public Principal getPeerPrincipal() {
116: return peerPrincipal;
117: }
118: }
|