[EMAIL PROTECTED] wrote:
> 
> Is it possible to get the SSL session id
> for further handling in my servlet?
> 
> In the ssl_engine_log I can see the
> request with [info] Connection: Client IP: xx.xx.xx.xx...
> Is it possible to send this session information
> to my servlet for further handling?
> 
> I have the mod_jserv installed and would like
> to get some session information to my
> java servlet that I can handle my client authorization.
> 
> Tricky questions for me, but perhaps easy for
> someone else :)

You can get all the SSL environment variables. Try this code:

    public void doGet(HttpServletRequest req, HttpServletResponse res)
        throws ServletException, IOException {

        res.setContentType("text/html");
        PrintWriter out = res.getWriter();

        String prefix = "org.apache.jserv.";
        Object attrsObj =
                req.getAttribute("org.apache.jserv.attribute_names");
        if ( attrsObj != null && attrsObj instanceof Enumeration ) {
            Enumeration attrs = (Enumeration) attrsObj;
            out.println("<h1>Attributes</h1>");
            out.println("available via
HttpServletRequest.getAttribute()");
            out.println("<br>");
            while ( attrs.hasMoreElements()) {
                String attr = attrs.nextElement().toString();
                if ( req.getAttribute(prefix + attr) != null ) {
                    out.println( prefix + attr + " = " +
                    req.getAttribute(prefix + attr).toString());
                } else {
                    out.println( prefix + attr + " = NULL " );
                }
                out.println("<br>");
            }
        }

        out.close();
    }

Success...
______________________________________________________________________
Apache Interface to OpenSSL (mod_ssl)                   www.modssl.org
User Support Mailing List                      [EMAIL PROTECTED]
Automated List Manager                            [EMAIL PROTECTED]

Reply via email to