KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > appserv > ProxyHandler


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 package com.sun.appserv;
25
26 import java.security.cert.X509Certificate JavaDoc;
27 import java.security.cert.CertificateException JavaDoc;
28 import javax.servlet.http.HttpServletRequest JavaDoc;
29
30 /**
31  * Abstract class allowing a backend appserver instance to retrieve information
32  * about the original client request that was intercepted by an SSL
33  * terminating proxy server (e.g., load balancer).
34  * <p>
35  * An implementation of this abstract class inspects a given request for
36  * the custom request headers through which the proxy server communicates the
37  * information about the original client request to the appserver instance,
38  * and makes this information available to the appserver.
39  * <p>
40  * This allows the appserver to work with any number of 3rd party SSL
41  * offloader implementations configured on the front-end web server, for
42  * which a corresponding ProxyHandler implementation has been configured
43  * on the backend appserver.
44  */

45 public abstract class ProxyHandler {
46
47     /**
48      * Gets the SSL client certificate chain with which the client
49      * had authenticated itself to the SSL offloader, and which the
50      * SSL offloader has added as a custom request header on the
51      * given request.
52      *
53      * @param request The request from which to retrieve the SSL client
54      * certificate chain
55      *
56      * @return Array of java.security.cert.X509Certificate instances
57      * representing the SSL client certificate chain, or null if this
58      * information is not available from the given request
59      *
60      * @throws CertificateException if the certificate chain retrieved
61      * from the request header cannot be parsed
62      */

63     public X509Certificate JavaDoc[] getSSLClientCertificateChain(
64                         HttpServletRequest JavaDoc request)
65             throws CertificateException JavaDoc {
66         return null;
67     }
68
69     /**
70      * Returns the SSL keysize with which the original client request that
71      * was intercepted by the SSL offloader has been protected, and which
72      * the SSL offloader has added as a custom request header on the
73      * given request.
74      *
75      * @param request The request from which to retrieve the SSL key
76      * size
77      *
78      * @return SSL keysize, or -1 if this information is not available from
79      * the given request
80      */

81     public int getSSLKeysize(HttpServletRequest JavaDoc request) {
82         return -1;
83     }
84
85     /**
86      * Gets the Internet Protocol (IP) address of the original client request
87      * that was intercepted by the proxy server.
88      *
89      * @param request The request from which to retrieve the IP address of the
90      * original client request
91      *
92      * @return IP address of the original client request, or null if this
93      * information is not available from the given request
94      */

95     public String JavaDoc getRemoteAddress(HttpServletRequest JavaDoc request) {
96         return null;
97     }
98
99 }
100
Popular Tags