You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by gd...@apache.org on 2001/09/11 19:00:57 UTC

cvs commit: xml-axis/java/src/org/apache/axis/handlers SimpleAuthorizationHandler.java SimpleAuthenticationHandler.java

gdaniels    01/09/11 10:00:57

  Modified:    java/src/org/apache/axis/handlers
                        SimpleAuthorizationHandler.java
                        SimpleAuthenticationHandler.java
  Log:
  Pass securityProvider in the MessageContext, and alter interface
  to pass MessageContext to authentication routine.
  
  Revision  Changes    Path
  1.19      +4 -1      xml-axis/java/src/org/apache/axis/handlers/SimpleAuthorizationHandler.java
  
  Index: SimpleAuthorizationHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/handlers/SimpleAuthorizationHandler.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- SimpleAuthorizationHandler.java	2001/09/10 19:55:53	1.18
  +++ SimpleAuthorizationHandler.java	2001/09/11 17:00:57	1.19
  @@ -124,7 +124,10 @@
               return;
           }
   
  -        SecurityProvider provider = SimpleAuthenticationHandler.provider;
  +        SecurityProvider provider = (SecurityProvider)msgContext.getProperty("securityProvider");
  +        if (provider == null)
  +            throw new AxisFault("No security provider in MessageContext!");
  +
           StringTokenizer st = new StringTokenizer(allowedRoles, ",");
           while (st.hasMoreTokens()) {
               String thisRole = st.nextToken();
  
  
  
  1.18      +8 -6      xml-axis/java/src/org/apache/axis/handlers/SimpleAuthenticationHandler.java
  
  Index: SimpleAuthenticationHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/handlers/SimpleAuthenticationHandler.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- SimpleAuthenticationHandler.java	2001/09/10 19:55:53	1.17
  +++ SimpleAuthenticationHandler.java	2001/09/11 17:00:57	1.18
  @@ -60,6 +60,7 @@
   import org.apache.axis.* ;
   import org.apache.axis.security.simple.SimpleSecurityProvider;
   import org.apache.axis.security.AuthenticatedUser;
  +import org.apache.axis.security.SecurityProvider;
   import org.apache.axis.utils.* ;
   import org.apache.axis.message.* ;
   import org.apache.log4j.Category;
  @@ -79,17 +80,18 @@
       static Category category =
               Category.getInstance(SimpleAuthenticationHandler.class.getName());
   
  -    /** !!! Needs to be replaced with a configurable way of getting a
  -     * security provider...
  -     */
  -    static SimpleSecurityProvider provider = new SimpleSecurityProvider();
  -
       /**
        * Authenticate the user and password from the msgContext
        */
       public void invoke(MessageContext msgContext) throws AxisFault {
           category.debug("Enter: SimpleAuthenticationHandler::invoke" );
   
  +        SecurityProvider provider = (SecurityProvider)msgContext.getProperty("securityProvider");
  +        if (provider == null) {
  +            provider = new SimpleSecurityProvider();
  +            msgContext.setProperty("securityProvider", provider);
  +        }
  +
           if (provider != null) {
               String  userID = (String) msgContext.getProperty( MessageContext.USERID );
               category.debug( "User: " + userID );
  @@ -103,7 +105,7 @@
               String passwd = (String) msgContext.getProperty( MessageContext.PASSWORD );
               category.debug( "Pass: " + passwd );
   
  -            AuthenticatedUser authUser = provider.authenticate(userID, passwd);
  +            AuthenticatedUser authUser = provider.authenticate(msgContext);
   
               // if a password is defined, then it must match
               if ( authUser == null)