axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdani...@apache.org
Subject cvs commit: xml-axis/java/src/org/apache/axis/transport/http AxisServlet.java
Date Mon, 01 Oct 2001 16:38:26 GMT
gdaniels    01/10/01 09:38:26

  Modified:    java/src/org/apache/axis Constants.java
               java/src/org/apache/axis/security/simple
                        SimpleSecurityProvider.java
               java/src/org/apache/axis/transport/http AxisServlet.java
  Log:
  Ensure that the users.lst file will always be read from the WEB-INF directory
  
  Revision  Changes    Path
  1.31      +2 -0      xml-axis/java/src/org/apache/axis/Constants.java
  
  Index: Constants.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/Constants.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- Constants.java	2001/08/09 15:05:38	1.30
  +++ Constants.java	2001/10/01 16:38:26	1.31
  @@ -180,6 +180,8 @@
   
       // MessageContext param for the engine's path
       public static final String MC_REALPATH = "realpath";
  +    // MessageContext param for the location of config files
  +    public static final String MC_CONFIGPATH = "configPath";
       // MessageContext param for the IP of the calling client
       public static final String MC_REMOTE_ADDR = "remoteaddr";
   
  
  
  
  1.5       +23 -4     xml-axis/java/src/org/apache/axis/security/simple/SimpleSecurityProvider.java
  
  Index: SimpleSecurityProvider.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/security/simple/SimpleSecurityProvider.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SimpleSecurityProvider.java	2001/09/16 19:58:46	1.4
  +++ SimpleSecurityProvider.java	2001/10/01 16:38:26	1.5
  @@ -58,6 +58,7 @@
   import org.apache.axis.security.SecurityProvider;
   import org.apache.axis.security.AuthenticatedUser;
   import org.apache.axis.MessageContext;
  +import org.apache.axis.Constants;
   import org.apache.log4j.Category;
   import org.apache.log4j.Priority;
   
  @@ -76,12 +77,23 @@
       static Category category =
               Category.getInstance(SimpleSecurityProvider.class.getName());
   
  -    static HashMap users = null;
  -    static HashMap perms = null;
  +    HashMap users = null;
  +    HashMap perms = null;
   
  +    boolean initialized = false;
  +
       // load the users list
  -    static {
  -        File userFile = new File("users.lst");
  +    private synchronized void initialize(MessageContext msgContext)
  +    {
  +        if (initialized) return;
  +
  +        String configPath = msgContext.getStrProp(Constants.MC_CONFIGPATH);
  +        if (configPath == null) {
  +            configPath = "";
  +        } else {
  +            configPath += File.separator;
  +        }
  +        File userFile = new File(configPath + "users.lst");
           if (userFile.exists()) {
               users = new HashMap();
   
  @@ -108,8 +120,10 @@
   
               } catch( Exception e ) {
                   category.error( e );
  +                return;
               }
           }
  +        initialized = true;
       }
   
       /** Authenticate a user from a username/password pair.
  @@ -119,6 +133,11 @@
        * @return an AuthenticatedUser or null
        */
       public AuthenticatedUser authenticate(MessageContext msgContext) {
  +
  +        if (!initialized) {
  +            initialize(msgContext);
  +        }
  +
           String username = msgContext.getStrProp(MessageContext.USERID);
           String password = msgContext.getStrProp(MessageContext.PASSWORD);
   
  
  
  
  1.48      +5 -0      xml-axis/java/src/org/apache/axis/transport/http/AxisServlet.java
  
  Index: AxisServlet.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/transport/http/AxisServlet.java,v
  retrieving revision 1.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- AxisServlet.java	2001/09/16 19:58:46	1.47
  +++ AxisServlet.java	2001/10/01 16:38:26	1.48
  @@ -126,8 +126,10 @@
           HandlerRegistry hr = engine.getHandlerRegistry();
   
           String realpath = context.getRealPath(req.getServletPath());
  +        String configPath = context.getRealPath("/WEB-INF");
           if (realpath != null) {
               msgContext.setProperty(Constants.MC_REALPATH, realpath);
  +            msgContext.setProperty(Constants.MC_CONFIGPATH, configPath);
   
               /* Set the Transport */
               /*********************/
  @@ -222,6 +224,7 @@
                       res.setContentType("text/html");
                       res.getWriter().println("<h1>" + req.getRequestURI() +
                               "</h1>");
  +                    res.getWriter().println(configPath);
                       res.getWriter().println(
                               "<p>Hi there, this is an Axis service!</p>");
                       res.getWriter().println(
  @@ -332,6 +335,8 @@
               String realpath = context.getRealPath(req.getServletPath());
               if (realpath != null)
                   msgContext.setProperty(Constants.MC_REALPATH, realpath);
  +            String configPath = context.getRealPath("/WEB-INF");
  +            msgContext.setProperty(Constants.MC_CONFIGPATH, configPath);
   
               /* Invoke the Axis engine... */
               /*****************************/
  
  
  

Mime
View raw message