pnever      2005/01/14 06:49:44

  Modified:    proposals/tamino/src/store/org/apache/slide/store/tamino/store
                        Tag: TWS421_BRANCH XChildStore.java
  Log:
  Added parameter autoCreateSecurity to be able to switch-off the auto-
  creation of users and acl's in Tamino
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.1.4.4   +59 -56    
jakarta-slide/proposals/tamino/src/store/org/apache/slide/store/tamino/store/XChildStore.java
  
  Index: XChildStore.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/proposals/tamino/src/store/org/apache/slide/store/tamino/store/XChildStore.java,v
  retrieving revision 1.1.4.3
  retrieving revision 1.1.4.4
  diff -u -r1.1.4.3 -r1.1.4.4
  --- XChildStore.java  14 Jan 2005 08:10:31 -0000      1.1.4.3
  +++ XChildStore.java  14 Jan 2005 14:49:44 -0000      1.1.4.4
  @@ -299,14 +299,14 @@
           String taminoBase = getParameter("taminoBase");
           
           if ( (dbSession instanceof XDbSession) ) {
  -//            Catalina catalina;
  +            //            Catalina catalina;
               String context = System.getProperty("webapp.context", 
"taminowebdavserver");
               
  -//            try {
  -//                catalina = Catalina.create();
  -//            } catch (Abort e) {
  -//                throw new ServiceInitializationFailedException(this, e);
  -//            }
  +            //            try {
  +            //                catalina = Catalina.create();
  +            //            } catch (Abort e) {
  +            //                throw new 
ServiceInitializationFailedException(this, e);
  +            //            }
               try {
                   String host = Domain.getParameter(HOST_SELECTION_NAME, 
InetAddress.getLocalHost().getHostAddress());
                   String port = Domain.getParameter(PORT_SELECTION_NAME, 
"4000");
  @@ -367,6 +367,7 @@
           String passwd = getParameter(TAMINO_PASSWD);
           String domain = null;
           String secureTamino = getParameter("forceSecureTamino");
  +        String autoCreateSecurity = getParameter("autoCreateSecurity", 
"true");
           domain = getParameter(TAMINO_DOMAIN);
           String taminoBase = getParameter("taminoBase");
           String database = getParameter("database");
  @@ -396,7 +397,7 @@
               throw new ServiceInitializationFailedException(this, e);
           }
           // do 3.1 security only for DB >= 3.1 < 4.1 add a check if 
un-authentificated user in ON
  -
  +        
           boolean enabled;
           try {
               enabled = 
XAuthenticator.getNonAuthenticatedUserIsEnabled(taminoBase, database, 
config.getAdminDomain(), config.getAdminUser(), config.getAdminPwd());
  @@ -404,57 +405,58 @@
           catch (Exception e) {
               throw new ServiceInitializationFailedException(this, e);
           }
  -//        if ((taminoVersion >= (float)3.1) && (taminoVersion < (float)4.1) 
&& enabled) {            
  -        if (false) {         
  -             try {
  -                new XSecurity(config, getParameter(TAMINO_BASE),
  -                              getParameter(TAMINO_DATABASE),
  -                              getParameter(TAMINO_COLLECTION));
  -            }
  -            catch (Exception e) {
  -                throw new ServiceInitializationFailedException(this, e);
  -            }
  -            
  -            // do 4.1 security only for DB >= 4.1
  - //       } else if (taminoVersion >= (float)4.1) {
  -        } else if (false) {          
  -            try {
  -                // check if a forceSecureTamino has been set. additional 
checks have to be done
  -                if ("true".equalsIgnoreCase (secureTamino)) {
  -                    if (((XAuthenticator.isTaminoEnabled(taminoBase, 
database, config.getAdminDomain(), config.getAdminUser(), 
config.getAdminPwd())) &&
  -                             
((XAuthenticator.getAuthenticationType(taminoBase, database, 
config.getAdminDomain(), config.getAdminUser(), 
config.getAdminPwd())).equalsIgnoreCase("basic"))) ||
  -                            ((!(XAuthenticator.isTaminoEnabled(taminoBase, 
database, config.getAdminDomain(), config.getAdminUser(), 
config.getAdminPwd()))) &&
  -                                 
(!((XAuthenticator.getAuthenticationType(taminoBase, database, 
config.getAdminDomain(), config.getAdminUser(), 
config.getAdminPwd())).equalsIgnoreCase("basic"))))){
  -                        throw new 
ServiceInitializationFailedException(this,"untrusted environment");
  -                    }
  +        
  +        if (!"false".equalsIgnoreCase(autoCreateSecurity)) {
  +            if ((taminoVersion >= (float)3.1) && (taminoVersion < 
(float)4.1) && enabled) {
  +                try {
  +                    new XSecurity(config, getParameter(TAMINO_BASE),
  +                                  getParameter(TAMINO_DATABASE),
  +                                  getParameter(TAMINO_COLLECTION));
  +                }
  +                catch (Exception e) {
  +                    throw new ServiceInitializationFailedException(this, e);
                   }
                   
  -                // if enviroment is not a not-secure initialize 4.1 security.
  -                // A non-secure environment is available if Tamino 
authentication
  -                // parameter is on web server and the HTTP authentication 
type is basic
  -                String test = 
XAuthenticator.getAuthenticationType(taminoBase, database, 
config.getAdminDomain(), config.getAdminUser(), config.getAdminPwd());
  -             if (!((XAuthenticator.isWebseverEnabled(taminoBase, database, 
config.getAdminDomain(), config.getAdminUser(), config.getAdminPwd()))
  -                          && 
(!((XAuthenticator.getAuthenticationType(taminoBase, database, 
config.getAdminDomain(), config.getAdminUser(), 
config.getAdminPwd())).equalsIgnoreCase("basic"))))) {
  -                     
  +                // do 4.1 security only for DB >= 4.1
  +            } else if (taminoVersion >= (float)4.1) {
  +                try {
  +                    // check if a forceSecureTamino has been set. additional 
checks have to be done
  +                    if ("true".equalsIgnoreCase (secureTamino)) {
  +                        if (((XAuthenticator.isTaminoEnabled(taminoBase, 
database, config.getAdminDomain(), config.getAdminUser(), 
config.getAdminPwd())) &&
  +                                 
((XAuthenticator.getAuthenticationType(taminoBase, database, 
config.getAdminDomain(), config.getAdminUser(), 
config.getAdminPwd())).equalsIgnoreCase("basic"))) ||
  +                                
((!(XAuthenticator.isTaminoEnabled(taminoBase, database, 
config.getAdminDomain(), config.getAdminUser(), config.getAdminPwd()))) &&
  +                                     
(!((XAuthenticator.getAuthenticationType(taminoBase, database, 
config.getAdminDomain(), config.getAdminUser(), 
config.getAdminPwd())).equalsIgnoreCase("basic"))))){
  +                            throw new 
ServiceInitializationFailedException(this,"untrusted environment");
  +                        }
  +                    }
                       
  -                    if ((user != null) && (passwd != null)) {
  -                        new XSecurityMultiUser(config, 
getParameter(TAMINO_BASE),
  -                                               getParameter(TAMINO_DATABASE),
  -                                               
getParameter(TAMINO_COLLECTION),
  -                                               domain,
  -                                               user,
  -                                               passwd );
  -                    } else {
  -                        new XSecurityMultiUser(config, 
getParameter(TAMINO_BASE),
  -                                               getParameter(TAMINO_DATABASE),
  -                                               
getParameter(TAMINO_COLLECTION));
  +                    // if enviroment is not a not-secure initialize 4.1 
security.
  +                    // A non-secure environment is available if Tamino 
authentication
  +                    // parameter is on web server and the HTTP 
authentication type is basic
  +                    String test = 
XAuthenticator.getAuthenticationType(taminoBase, database, 
config.getAdminDomain(), config.getAdminUser(), config.getAdminPwd());
  +                    if (!((XAuthenticator.isWebseverEnabled(taminoBase, 
database, config.getAdminDomain(), config.getAdminUser(), config.getAdminPwd()))
  +                              && 
(!((XAuthenticator.getAuthenticationType(taminoBase, database, 
config.getAdminDomain(), config.getAdminUser(), 
config.getAdminPwd())).equalsIgnoreCase("basic"))))) {
  +                        
  +                        
  +                        if ((user != null) && (passwd != null)) {
  +                            new XSecurityMultiUser(config, 
getParameter(TAMINO_BASE),
  +                                                   
getParameter(TAMINO_DATABASE),
  +                                                   
getParameter(TAMINO_COLLECTION),
  +                                                   domain,
  +                                                   user,
  +                                                   passwd );
  +                        } else {
  +                            new XSecurityMultiUser(config, 
getParameter(TAMINO_BASE),
  +                                                   
getParameter(TAMINO_DATABASE),
  +                                                   
getParameter(TAMINO_COLLECTION));
  +                        }
                       }
                   }
  +                catch (Exception e){
  +                    throw new ServiceInitializationFailedException(this, e);
  +                }
  +                
               }
  -            catch (Exception e){
  -                throw new ServiceInitializationFailedException(this, e);
  -            }
  -            
           }
       }
       
  @@ -655,6 +657,7 @@
           return getMonName();
       }
   }
  +
   
   
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to