/* $Header: CallerInfo.java 06-jul-2001.14:27:57 rkng Exp $ */

/* Copyright (c) 2000, 2001, Oracle Corporation.  All rights reserved.  */

/*
   DESCRIPTION
    <short description of component this file declares/defines>

   PRIVATE CLASSES
    <list of private classes defined - with one-line descriptions>

   NOTES
    <other useful comments, qualifications, etc.>

   MODIFIED    (MM/DD/YY)
    rkng        07/06/01 - Merged rkng_oc4j_m9.21
    rkng        07/05/01 - remove trace method calls.
    rkng        07/03/01 - Creation   
 */

/**
 *  @version $Header: CallerInfo.java 06-jul-2001.14:27:57 rkng Exp $
 *  @author  rkng
 *  @since   release specific (what release of product did this appear in)
 */

package oracle.security.jazn.samples.http;

import java.io.IOException;
import java.util.Date;
import java.util.Properties;
import javax.naming.*;
import javax.servlet.*;
import javax.servlet.http.*;

/**
 * A simple demo that exercises the Servlet security APIs. 
 * 
 * @author rkng
 */
public class CallerInfo extends HttpServlet {

    public CallerInfo() 
    {
	super();
    }

    public void init(ServletConfig config) 
	throws ServletException 
    {
	super.init(config);
    }
    
    public void doGet(HttpServletRequest request, HttpServletResponse response)
	throws ServletException, IOException 
    {
	ServletOutputStream out = response.getOutputStream();

	response.setContentType("text/html");
	out.println("<HTML><BODY bgcolor=\"#FFFFFF\">");
	out.println("Time stamp: " + new Date().toString());
	out.println("request.getRemoteUser = " + request.getRemoteUser() + "<br>");
	out.println("request.isUserInRole('FOO') = " + request.isUserInRole("FOO") + "<br>");
	out.println("request.isUserInRole('ar_manager') = " + request.isUserInRole("ar_manager") + "<br>");
	out.println("request.isUserInRole('ar_developer') = " + request.isUserInRole("ar_developer") + "<br>");
	out.println("request.getUserPrincipal = " + request.getUserPrincipal() + "<br>"); 
	out.println("</BODY>");
	out.println("</HTML>");
    }

}
