jspwiki-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dvit...@apache.org
Subject svn commit: r1688328 - in /jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/auth: SecurityVerifier.java UserManager.java authorize/GroupManager.java
Date Mon, 29 Jun 2015 23:11:23 GMT
Author: dvittor
Date: Mon Jun 29 23:11:23 2015
New Revision: 1688328

URL: http://svn.apache.org/r1688328
Log:
User and Group Databases are now loaded like other Providers, using ClassUtil.getWikiProvider()

Modified:
    jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/auth/SecurityVerifier.java
    jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/auth/UserManager.java
    jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/auth/authorize/GroupManager.java

Modified: jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/auth/SecurityVerifier.java
URL: http://svn.apache.org/viewvc/jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/auth/SecurityVerifier.java?rev=1688328&r1=1688327&r2=1688328&view=diff
==============================================================================
--- jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/auth/SecurityVerifier.java
(original)
+++ jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/auth/SecurityVerifier.java
Mon Jun 29 23:11:23 2015
@@ -504,7 +504,7 @@ public final class SecurityVerifier
         {
             db = m_engine.getGroupManager().getGroupDatabase();
         }
-        catch ( WikiSecurityException e )
+        catch ( WikiException e )
         {
             m_session.addMessage( ERROR_GROUPS, "Could not retrieve GroupManager: " + e.getMessage()
);
         }

Modified: jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/auth/UserManager.java
URL: http://svn.apache.org/viewvc/jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/auth/UserManager.java?rev=1688328&r1=1688327&r2=1688328&view=diff
==============================================================================
--- jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/auth/UserManager.java
(original)
+++ jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/auth/UserManager.java
Mon Jun 29 23:11:23 2015
@@ -154,19 +154,26 @@ public class UserManager extends WikiInt
 
         try
         {
-            dbClassName = TextUtil.getRequiredProperty( m_engine.getWikiProperties(),
-                                                          PROP_DATABASE );
+            dbClassName = TextUtil.getRequiredProperty( m_engine.getWikiProperties(), PROP_DATABASE
);
 
             log.info("Attempting to load user database class "+dbClassName);
-            Class<?> dbClass = ClassUtil.findClass( USERDATABASE_PACKAGE, dbClassName
);
-            m_database = (UserDatabase) dbClass.newInstance();
-            m_database.initialize( m_engine, m_engine.getWikiProperties() );
+            
+            m_database = ClassUtil.getWikiProvider(UserDatabase.class, m_engine, m_engine.getWikiProperties(),
USERDATABASE_PACKAGE, dbClassName, new DummyUserDatabase(), true);
+            
+//            Class<?> dbClass = ClassUtil.findClass( USERDATABASE_PACKAGE, dbClassName
);
+//            m_database = (UserDatabase) dbClass.newInstance();
+//            m_database.initialize( m_engine, m_engine.getWikiProperties() );
             log.info("UserDatabase initialized.");
         }
         catch( NoRequiredPropertyException e )
         {
             log.error( "You have not set the '"+PROP_DATABASE+"'. You need to do this if
you want to enable user management by JSPWiki." );
         }
+        catch( WikiException e )
+        {
+            log.error( "Exception initializing user database: " + e.getMessage() );
+        }
+/*
         catch( ClassNotFoundException e )
         {
             log.error( "UserDatabase class " + dbClassName + " cannot be found", e );
@@ -183,6 +190,7 @@ public class UserManager extends WikiInt
         {
             log.error( "Exception initializing user database: " + e.getMessage() );
         }
+*/
         finally
         {
             if( m_database == null )

Modified: jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/auth/authorize/GroupManager.java
URL: http://svn.apache.org/viewvc/jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/auth/authorize/GroupManager.java?rev=1688328&r1=1688327&r2=1688328&view=diff
==============================================================================
--- jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/auth/authorize/GroupManager.java
(original)
+++ jspwiki/branches/JSPWIKI_2_10_PICO_BRANCH/jspwiki-war/src/main/java/org/apache/wiki/auth/authorize/GroupManager.java
Mon Jun 29 23:11:23 2015
@@ -123,12 +123,12 @@ public class GroupManager extends WikiIn
      * it could not be initialized. In that case, this method throws
      * a {@link org.apache.wiki.api.exceptions.WikiException}. The GroupDatabase
      * is lazily initialized.
-     * @throws org.apache.wiki.auth.WikiSecurityException if the GroupDatabase could
+     * @throws org.apache.wiki.auth.WikiException if the GroupDatabase could
      * not be initialized
      * @return the current GroupDatabase
      * @since 2.3
      */
-    public GroupDatabase getGroupDatabase() throws WikiSecurityException
+    public GroupDatabase getGroupDatabase() throws WikiException
     {
         if ( m_groupDatabase != null )
         {
@@ -147,11 +147,14 @@ public class GroupManager extends WikiIn
                 dbClassName = XMLGroupDatabase.class.getName();
             }
             log.info( "Attempting to load group database class " + dbClassName );
-            Class<?> dbClass = ClassUtil.findClass( "org.apache.wiki.auth.authorize",
dbClassName );
-            m_groupDatabase = (GroupDatabase) dbClass.newInstance();
-            m_groupDatabase.initialize( m_engine, m_engine.getWikiProperties() );
+            m_groupDatabase = ClassUtil.getWikiProvider(GroupDatabase.class, m_engine, m_engine.getWikiProperties(),
"org.apache.wiki.auth.authorize", dbClassName, null, true);
+            
+//            Class<?> dbClass = ClassUtil.findClass( "org.apache.wiki.auth.authorize",
dbClassName );
+//            m_groupDatabase = (GroupDatabase) dbClass.newInstance();
+//            m_groupDatabase.initialize( m_engine, m_engine.getWikiProperties() );
             log.info( "Group database initialized." );
         }
+/*
         catch( ClassNotFoundException e )
         {
             log.error( "GroupDatabase class " + dbClassName + " cannot be found.", e );
@@ -170,13 +173,13 @@ public class GroupManager extends WikiIn
             dbInstantiationError = "Access GroupDatabase class " + dbClassName + " denied";
             cause = e;
         }
+*/
         catch( NoRequiredPropertyException e )
         {
             log.error( "Missing property: " + e.getMessage() + "." );
             dbInstantiationError = "Missing property: " + e.getMessage();
             cause = e;
         }
-
         if( dbInstantiationError != null )
         {
             throw new WikiSecurityException( dbInstantiationError + " Cause: " + (cause !=
null ? cause.getMessage() : ""), cause );



Mime
View raw message