Author: ajaquith
Date: Tue Apr  7 12:56:09 2009
New Revision: 762754

URL: http://svn.apache.org/viewvc?rev=762754&view=rev
Log:
(1) Refactored various exception-throwing code bits to use the extended 
constructors for WikiException/WikiSecurityException/ProviderException to 
provide for better logging and debugging. (2) Added support in 
WikiCallbackHandler for HttpRequestCallback and WikiEngineCallback. This means 
LoginModules used for JSPWiki integrated (custom) authentication can now access 
the WikiEngine and the HTTP request. Thanks to Lou Peters and many, many others 
for bringing this issue to my attention. Please test this function! This change 
has been forward-ported from 2.8.3. (3)  As a result of the additional callback 
support for LoginModules used with integrated authentication, 
AuthenticationManager gains a new method, 
login(WikiSession,HttpServletRequest,String,String). Please use this instead of 
login(WikiSession,String,String), which is now deprecated. This change has been 
forward-ported from 2.8.3.

Modified:
    incubator/jspwiki/trunk/ChangeLog
    incubator/jspwiki/trunk/src/WebContent/NewBlogEntry.jsp
    incubator/jspwiki/trunk/src/java/org/apache/wiki/PageManager.java
    incubator/jspwiki/trunk/src/java/org/apache/wiki/Release.java
    incubator/jspwiki/trunk/src/java/org/apache/wiki/WikiEngine.java
    incubator/jspwiki/trunk/src/java/org/apache/wiki/action/LoginActionBean.java
    
incubator/jspwiki/trunk/src/java/org/apache/wiki/action/UploadActionBean.java
    
incubator/jspwiki/trunk/src/java/org/apache/wiki/action/WikiContextFactory.java
    
incubator/jspwiki/trunk/src/java/org/apache/wiki/attachment/AttachmentServlet.java
    
incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/AuthenticationManager.java
    
incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/AuthorizationManager.java
    incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/UserManager.java
    
incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/acl/DefaultAclManager.java
    
incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/authorize/GroupManager.java
    
incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/authorize/JDBCGroupDatabase.java
    
incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/authorize/XMLGroupDatabase.java
    
incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/login/WikiCallbackHandler.java
    
incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/user/DefaultUserProfile.java
    
incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/user/JDBCUserDatabase.java
    incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/user/UserProfile.java
    
incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/user/XMLUserDatabase.java
    incubator/jspwiki/trunk/src/java/org/apache/wiki/content/ContentManager.java
    incubator/jspwiki/trunk/src/java/org/apache/wiki/content/PageRenamer.java
    
incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/BugReportHandler.java
    
incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/WeblogEntryPlugin.java
    incubator/jspwiki/trunk/src/java/org/apache/wiki/rss/RSSGenerator.java
    
incubator/jspwiki/trunk/src/java/org/apache/wiki/search/LuceneSearchProvider.java
    incubator/jspwiki/trunk/src/java/org/apache/wiki/util/ClassUtil.java
    
incubator/jspwiki/trunk/src/java/org/apache/wiki/xmlrpc/MetaWeblogHandler.java
    incubator/jspwiki/trunk/tests/java/org/apache/wiki/TestEngine.java
    incubator/jspwiki/trunk/tests/java/org/apache/wiki/WikiSessionTest.java
    
incubator/jspwiki/trunk/tests/java/org/apache/wiki/action/UserPreferencesActionBeanTest.java
    
incubator/jspwiki/trunk/tests/java/org/apache/wiki/action/UserProfileActionBeanTest.java
    
incubator/jspwiki/trunk/tests/java/org/apache/wiki/auth/login/UserDatabaseLoginModuleTest.java

Modified: incubator/jspwiki/trunk/ChangeLog
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/ChangeLog?rev=762754&r1=762753&r2=762754&view=diff
==============================================================================
--- incubator/jspwiki/trunk/ChangeLog (original)
+++ incubator/jspwiki/trunk/ChangeLog Tue Apr  7 12:56:09 2009
@@ -1,3 +1,24 @@
+2009-04-06  Andrew Jaquith <ajaquith AT apache DOT org>
+
+        * 3.0.0-svn-98
+
+        * Refactored various exception-throwing code bits to use the extended
+        constructors for WikiException/WikiSecurityException/ProviderException
+        to provide for better logging and debugging.
+
+        * Added support in WikiCallbackHandler for HttpRequestCallback and
+        WikiEngineCallback. This means LoginModules used for JSPWiki integrated
+        (custom) authentication can now access the WikiEngine and the HTTP 
request.
+        Thanks to Lou Peters and many, many others for bringing this issue to 
my
+        attention. Please test this function! This change has been 
forward-ported from
+        2.8.3. 
+        
+        * As a result of the additional callback support for LoginModules used 
with
+        integrated authentication, AuthenticationManager gains a new method,
+        login(WikiSession,HttpServletRequest,String,String). Please use this 
instead
+        of login(WikiSession,String,String), which is now deprecated. This 
change
+        has been forward-ported from 2.8.3.
+
 2009-04-05  Harry Metske <[email protected]>
 
         * 3.0.0-svn-97

Modified: incubator/jspwiki/trunk/src/WebContent/NewBlogEntry.jsp
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/WebContent/NewBlogEntry.jsp?rev=762754&r1=762753&r2=762754&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/WebContent/NewBlogEntry.jsp (original)
+++ incubator/jspwiki/trunk/src/WebContent/NewBlogEntry.jsp Tue Apr  7 12:56:09 
2009
@@ -1,3 +1,4 @@
+<%@ page import="java.net.URI" %>
 <%@ page import="org.apache.wiki.log.Logger" %>
 <%@ page import="org.apache.wiki.log.LoggerFactory" %>
 <%@ page import="org.apache.wiki.*" %>
@@ -18,11 +19,11 @@
     String pagereq = wikiContext.getPage().getName();
     
     // Redirect if the request was for a 'special page'
-    String specialpage = wiki.getSpecialPageReference( pagereq );
+    URI specialpage = wiki.getSpecialPageReference( pagereq );
     if( specialpage != null )
     {
         // FIXME: Do Something Else
-        response.sendRedirect( specialpage );
+        response.sendRedirect( specialpage.toString() );
         return;
     }
 

Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/PageManager.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/PageManager.java?rev=762754&r1=762753&r2=762754&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/PageManager.java (original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/PageManager.java Tue Apr  
7 12:56:09 2009
@@ -189,7 +189,7 @@
             catch( PageAlreadyExistsException e1 )
             {
                 // This should never happen
-                throw new ProviderException( e1.getMessage() );
+                throw new ProviderException( e1.getMessage(), e1 );
             }
         }
         p.setContent(content);

Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/Release.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/Release.java?rev=762754&r1=762753&r2=762754&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/Release.java (original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/Release.java Tue Apr  7 
12:56:09 2009
@@ -77,7 +77,7 @@
      *  <p>
      *  If the build identifier is empty, it is not added.
      */
-    public static final String     BUILD         = "97";
+    public static final String     BUILD         = "98";
     
     /**
      *  This is the generic version string you should use

Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/WikiEngine.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/WikiEngine.java?rev=762754&r1=762753&r2=762754&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/WikiEngine.java (original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/WikiEngine.java Tue Apr  7 
12:56:09 2009
@@ -435,7 +435,7 @@
                 context.log( msg );
             }
             shutdown();
-            throw new WikiException( msg );
+            throw new WikiException( msg, e );
         }
     }
 
@@ -623,29 +623,29 @@
         {
             // RuntimeExceptions may occur here, even if they shouldn't.
             log.error( "%1$s %2$s", "Failed to start managers.", e );
-            throw new WikiException( "Failed to start managers: 
"+e.getMessage() );
+            throw new WikiException( "Failed to start managers: 
"+e.getMessage(), e );
         }
         catch (ClassNotFoundException e)
         {
             log.error( "%1$s %2$s", "JSPWiki could not start, URLConstructor 
was not found: ", e );
-            throw new WikiException(e.getMessage());
+            throw new WikiException( e.getMessage(), e );
         }
         catch (InstantiationException e)
         {
             log.error( "%1$s %2$s", "JSPWiki could not start, URLConstructor 
could not be instantiated: ", e );
-            throw new WikiException(e.getMessage());
+            throw new WikiException( e.getMessage(), e );
         }
         catch (IllegalAccessException e)
         {
             log.error( "%1$s %2$s", "JSPWiki could not start, URLConstructor 
cannot be accessed: ", e );
-            throw new WikiException(e.getMessage());
+            throw new WikiException( e.getMessage(), e );
         }
         catch( Exception e )
         {
             // Final catch-all for everything
             
             log.error( "%1$s %2$s", "JSPWiki could not start, due to an 
unknown exception when starting.", e );
-            throw new WikiException("Failed to start; please check log files 
for better information.");
+            throw new WikiException( "Failed to start; please check log files 
for better information.", e );
         }
         
         //
@@ -952,7 +952,7 @@
             catch( PageAlreadyExistsException e1 )
             {
                 // This should not happen
-                throw new ProviderException( e1.getMessage() );
+                throw new ProviderException( e1.getMessage(), e1 );
             }
         }
         
@@ -1113,7 +1113,7 @@
     }
 
     /**
-     *  <p>If the page is a special page, then returns a direct URL
+     *  <p>If the page is a special page, then returns a direct URI
      *  to that page.  Otherwise returns <code>null</code>.
      *  This method delegates requests to
      *  {...@link 
org.apache.wiki.content.SpecialPageNameResolver#getSpecialPageURI}.

Modified: 
incubator/jspwiki/trunk/src/java/org/apache/wiki/action/LoginActionBean.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/action/LoginActionBean.java?rev=762754&r1=762753&r2=762754&view=diff
==============================================================================
--- 
incubator/jspwiki/trunk/src/java/org/apache/wiki/action/LoginActionBean.java 
(original)
+++ 
incubator/jspwiki/trunk/src/java/org/apache/wiki/action/LoginActionBean.java 
Tue Apr  7 12:56:09 2009
@@ -134,14 +134,14 @@
     {
         WikiSession wikiSession = getContext().getWikiSession();
         ValidationErrors errors = getContext().getValidationErrors();
-        Locale locale = getContext().getLocale();
+        HttpServletRequest request = getContext().getRequest();
 
         log.debug( "Attempting to authenticate user " + m_username );
 
         // Log the user in!
         try
         {
-            if( !getContext().getEngine().getAuthenticationManager().login( 
wikiSession, locale, m_username, m_password ) )
+            if( !getContext().getEngine().getAuthenticationManager().login( 
wikiSession, request, m_username, m_password ) )
             {
             }
         }

Modified: 
incubator/jspwiki/trunk/src/java/org/apache/wiki/action/UploadActionBean.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/action/UploadActionBean.java?rev=762754&r1=762753&r2=762754&view=diff
==============================================================================
--- 
incubator/jspwiki/trunk/src/java/org/apache/wiki/action/UploadActionBean.java 
(original)
+++ 
incubator/jspwiki/trunk/src/java/org/apache/wiki/action/UploadActionBean.java 
Tue Apr  7 12:56:09 2009
@@ -219,7 +219,7 @@
             // here we have the context available, so we can
             // internationalize it properly :
             throw new ProviderException( context.getBundle( 
InternationalizationManager.CORE_BUNDLE )
-                .getString( pe.getMessage() ) );
+                .getString( pe.getMessage() ), pe );
         }
         
         // Close the stream and delete the filebean, since we're done with it

Modified: 
incubator/jspwiki/trunk/src/java/org/apache/wiki/action/WikiContextFactory.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/action/WikiContextFactory.java?rev=762754&r1=762753&r2=762754&view=diff
==============================================================================
--- 
incubator/jspwiki/trunk/src/java/org/apache/wiki/action/WikiContextFactory.java 
(original)
+++ 
incubator/jspwiki/trunk/src/java/org/apache/wiki/action/WikiContextFactory.java 
Tue Apr  7 12:56:09 2009
@@ -507,7 +507,7 @@
             catch( PageAlreadyExistsException e1 )
             {
                 // This should not happen
-                throw new ProviderException( e1.getMessage() );
+                throw new ProviderException( e1.getMessage(), e1 );
             }
         }
     }

Modified: 
incubator/jspwiki/trunk/src/java/org/apache/wiki/attachment/AttachmentServlet.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/attachment/AttachmentServlet.java?rev=762754&r1=762753&r2=762754&view=diff
==============================================================================
--- 
incubator/jspwiki/trunk/src/java/org/apache/wiki/attachment/AttachmentServlet.java
 (original)
+++ 
incubator/jspwiki/trunk/src/java/org/apache/wiki/attachment/AttachmentServlet.java
 Tue Apr  7 12:56:09 2009
@@ -740,7 +740,7 @@
             catch( PageAlreadyExistsException e1 )
             {
                 // This should not happen
-                throw new ProviderException( e1.getMessage() );
+                throw new ProviderException( e1.getMessage(), e1 );
             }
             created = true;
         }

Modified: 
incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/AuthenticationManager.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/AuthenticationManager.java?rev=762754&r1=762753&r2=762754&view=diff
==============================================================================
--- 
incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/AuthenticationManager.java
 (original)
+++ 
incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/AuthenticationManager.java
 Tue Apr  7 12:56:09 2009
@@ -196,7 +196,7 @@
         catch (ClassNotFoundException e)
         {
             e.printStackTrace();
-            throw new WikiException(e.getMessage());
+            throw new WikiException( e.getMessage(), e );
         }
         
         // Initialize the LoginModule options
@@ -288,7 +288,7 @@
             catch ( WikiSecurityException e )
             {
                 e.printStackTrace();
-                throw new WikiSecurityException( e.getMessage() );
+                throw new WikiSecurityException( e.getMessage(), e );
             }
             
             // Execute the container login module
@@ -370,7 +370,9 @@
     /**
      * Attempts to perform a WikiSession login for the given username/password
      * combination using JSPWiki's custom authentication mode, using the 
system default Locale.
-     * The operation is otherwise identical to {...@link #login(WikiSession, 
Locale, String, String)}.
+     * The operation is otherwise identical to {...@link #login(WikiSession, 
HttpServletRequest, String, String)}.
+     * Also, the user's HTTP request is not made available to LoginModules via 
the
+     * {...@link com.ecyrd.jspwiki.auth.login.HttpRequestCallback}.
      * @param session the current wiki session; may not be <code>null</code>.
      * @param username The user name
      * @param password the password
@@ -382,10 +384,11 @@
      * @throws WikiSecurityException
      *             if the login failed for any other reason. The root-cause 
exception can
      *             be retrieved via {...@link java.lang.Throwable#getCause()}
+     * @deprecated use {...@link #login(WikiSession, HttpServletRequest, 
String, String)} instead
      */
     public final boolean login( WikiSession session, String username, String 
password ) throws WikiSecurityException, LoginException
     {
-        return login( session, Locale.getDefault(), username, password );
+        return login( session, null, username, password );
     }
 
     /**
@@ -399,6 +402,8 @@
      * an options Map populated by properties keys prefixed by {...@link 
#PREFIX_LOGIN_MODULE_OPTIONS}
      * will be passed as a parameter.
      * @param session the current wiki session; may not be <code>null</code>.
+     * @param request the user's HTTP request. This parameter may be 
<code>null</code>, but the configured
+     * LoginModule will not have access to the HTTP request in this case.
      * @param username The user name. This is a login name, not a WikiName. In
      *            most cases they are the same, but in some cases, they might
      *            not be.
@@ -412,7 +417,7 @@
      *             if the login failed for any other reason. The root-cause 
exception can
      *             be retrieved via {...@link java.lang.Throwable#getCause()}
      */
-    public final boolean login( WikiSession session, Locale locale, String 
username, String password ) throws WikiSecurityException, LoginException
+    public final boolean login( WikiSession session, HttpServletRequest 
request, String username, String password ) throws WikiSecurityException, 
LoginException
     {
         if ( session == null )
         {
@@ -428,7 +433,7 @@
         
         CallbackHandler handler = new WikiCallbackHandler(
                 m_engine,
-                locale,
+                request,
                 username,
                 password );
         

Modified: 
incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/AuthorizationManager.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/AuthorizationManager.java?rev=762754&r1=762753&r2=762754&view=diff
==============================================================================
--- 
incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/AuthorizationManager.java 
(original)
+++ 
incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/AuthorizationManager.java 
Tue Apr  7 12:56:09 2009
@@ -461,7 +461,7 @@
         catch ( PolicyException e )
         {
             log.error("Could not initialize local security policy: " + 
e.getMessage() );
-            throw new WikiException( e.getMessage() );
+            throw new WikiException( e.getMessage(), e );
         }
     }
 
@@ -503,17 +503,17 @@
             catch( ClassNotFoundException e )
             {
                 log.error( "Authorizer " + clazz + " cannot be found", e );
-                throw new WikiException( "Authorizer " + clazz + " cannot be 
found" );
+                throw new WikiException( "Authorizer " + clazz + " cannot be 
found", e );
             }
             catch( InstantiationException e )
             {
                 log.error( "Authorizer " + clazz + " cannot be created", e );
-                throw new WikiException( "Authorizer " + clazz + " cannot be 
created" );
+                throw new WikiException( "Authorizer " + clazz + " cannot be 
created", e );
             }
             catch( IllegalAccessException e )
             {
                 log.error( "You are not allowed to access this authorizer 
class", e );
-                throw new WikiException( "You are not allowed to access this 
authorizer class" );
+                throw new WikiException( "You are not allowed to access this 
authorizer class", e );
             }
         }
 

Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/UserManager.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/UserManager.java?rev=762754&r1=762753&r2=762754&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/UserManager.java 
(original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/UserManager.java Tue 
Apr  7 12:56:09 2009
@@ -374,7 +374,7 @@
             }
             catch ( LoginException e )
             {
-                throw new WikiSecurityException( e.getMessage() );
+                throw new WikiSecurityException( e.getMessage(), e );
             }
 
             // Alert all listeners that the profile changed...

Modified: 
incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/acl/DefaultAclManager.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/acl/DefaultAclManager.java?rev=762754&r1=762753&r2=762754&view=diff
==============================================================================
--- 
incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/acl/DefaultAclManager.java
 (original)
+++ 
incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/acl/DefaultAclManager.java
 Tue Apr  7 12:56:09 2009
@@ -136,11 +136,11 @@
         catch( NoSuchElementException nsee )
         {
             log.warn( "Invalid access rule: " + ruleLine + " - defaults will 
be used." );
-            throw new WikiSecurityException( "Invalid access rule: " + 
ruleLine );
+            throw new WikiSecurityException( "Invalid access rule: " + 
ruleLine, nsee );
         }
         catch( IllegalArgumentException iae )
         {
-            throw new WikiSecurityException( "Invalid permission type: " + 
ruleLine );
+            throw new WikiSecurityException( "Invalid permission type: " + 
ruleLine, iae );
         }
 
         return acl;
@@ -181,7 +181,7 @@
             }
             catch( ProviderException e )
             {
-                throw new WikiSecurityException("Unable to get parent page to 
check for permissions.");
+                throw new WikiSecurityException( "Unable to get parent page to 
check for permissions.", e );
             }
         }
         return acl;
@@ -215,7 +215,7 @@
             }
             catch ( ProviderException e )
             {
-                throw new WikiSecurityException( "Could not set Acl. Reason: 
ProviderExcpetion " + e.getMessage() );
+                throw new WikiSecurityException( "Could not set Acl. Reason: 
ProviderExcpetion " + e.getMessage(), e );
             }
         }
     }

Modified: 
incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/authorize/GroupManager.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/authorize/GroupManager.java?rev=762754&r1=762753&r2=762754&view=diff
==============================================================================
--- 
incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/authorize/GroupManager.java
 (original)
+++ 
incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/authorize/GroupManager.java
 Tue Apr  7 12:56:09 2009
@@ -235,7 +235,7 @@
 
         if( dbInstantiationError != null )
         {
-            throw new WikiSecurityException( dbInstantiationError + " Cause: " 
+ (cause != null ? cause.getMessage() : "") );
+            throw new WikiSecurityException( dbInstantiationError + " Cause: " 
+ (cause != null ? cause.getMessage() : ""), cause );
         }
 
         return m_groupDatabase;
@@ -273,7 +273,7 @@
         }
         catch ( WikiException e )
         {
-            throw new WikiSecurityException( e.getMessage() );
+            throw new WikiSecurityException( e.getMessage(), e );
         }
 
         // Load all groups from the database into the cache
@@ -616,10 +616,10 @@
                 {
                     m_groups.put( oldGroup.getPrincipal(), oldGroup );
                 }
-                throw new WikiSecurityException( e.getMessage() + " (rolled 
back to previous version)." );
+                throw new WikiSecurityException( e.getMessage() + " (rolled 
back to previous version).", e );
             }
             // Re-throw security exception
-            throw new WikiSecurityException( e.getMessage() );
+            throw new WikiSecurityException( e.getMessage(), e );
         }
     }
 

Modified: 
incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/authorize/JDBCGroupDatabase.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/authorize/JDBCGroupDatabase.java?rev=762754&r1=762753&r2=762754&view=diff
==============================================================================
--- 
incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/authorize/JDBCGroupDatabase.java
 (original)
+++ 
incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/authorize/JDBCGroupDatabase.java
 Tue Apr  7 12:56:09 2009
@@ -296,7 +296,7 @@
         }
         catch( SQLException e )
         {
-            throw new WikiSecurityException( "Could not delete group " + 
groupName + ": " + e.getMessage() );
+            throw new WikiSecurityException( "Could not delete group " + 
groupName + ": " + e.getMessage(), e );
         }
         finally
         {
@@ -354,7 +354,7 @@
         }
         catch( SQLException e )
         {
-            throw new WikiSecurityException( e.getMessage() );
+            throw new WikiSecurityException( e.getMessage(), e );
         }
         finally
         {
@@ -463,7 +463,7 @@
         }
         catch( SQLException e )
         {
-            throw new WikiSecurityException( e.getMessage() );
+            throw new WikiSecurityException( e.getMessage(), e );
         }
         finally
         {

Modified: 
incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/authorize/XMLGroupDatabase.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/authorize/XMLGroupDatabase.java?rev=762754&r1=762753&r2=762754&view=diff
==============================================================================
--- 
incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/authorize/XMLGroupDatabase.java
 (original)
+++ 
incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/authorize/XMLGroupDatabase.java
 Tue Apr  7 12:56:09 2009
@@ -450,7 +450,7 @@
         }
         catch( IOException e )
         {
-            throw new WikiSecurityException( e.getLocalizedMessage() );
+            throw new WikiSecurityException( e.getLocalizedMessage(), e );
         }
 
         // Copy new file over old version

Modified: 
incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/login/WikiCallbackHandler.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/login/WikiCallbackHandler.java?rev=762754&r1=762753&r2=762754&view=diff
==============================================================================
--- 
incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/login/WikiCallbackHandler.java
 (original)
+++ 
incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/login/WikiCallbackHandler.java
 Tue Apr  7 12:56:09 2009
@@ -24,6 +24,7 @@
 import java.util.Locale;
 
 import javax.security.auth.callback.*;
+import javax.servlet.http.HttpServletRequest;
 
 import org.apache.wiki.WikiEngine;
 import org.apache.wiki.WikiSession;
@@ -34,7 +35,7 @@
 /**
  * Handles logins made from inside the wiki application, rather than via the 
web
  * container. This handler is instantiated in
- * {...@link org.apache.wiki.auth.AuthenticationManager#login(WikiSession, 
String, String)}.
+ * {...@link org.apache.wiki.auth.AuthenticationManager#login(WikiSession, 
javax.servlet.http.HttpServletRequest, String, String)}.
  * If container-managed authentication is used, the
  * {...@link WebContainerCallbackHandler} is used instead. This callback 
handler is
  * designed to be used with {...@link UserDatabaseLoginModule}.
@@ -45,26 +46,27 @@
 {
     private static final Logger log = 
LoggerFactory.getLogger(WikiCallbackHandler.class);
 
+    private final HttpServletRequest m_request;
+    
     private final WikiEngine m_engine;
 
     private final String       m_password;
 
     private final String       m_username;
-    
-    private final Locale      m_locale;
 
     /**
      *  Create a new callback handler.
      *  
      *  @param engine the WikiEngine for this wiki
-     *  @param locale the Locale to use, for localizing messages
+     *  @param request the user's HTTP request. If passed as <code>null</code>,
+     *  later requests for {...@link HttpRequestCallback} will return an 
UnsupportedCallbackException
      *  @param username the username
      *  @param password the password
      */
-    public WikiCallbackHandler( WikiEngine engine, Locale locale, String 
username, String password )
+    public WikiCallbackHandler( WikiEngine engine, HttpServletRequest request, 
String username, String password )
     {
         m_engine = engine;
-        m_locale = locale;
+        m_request = request;
         m_username = username;
         m_password = password;
     }
@@ -79,10 +81,18 @@
         for( int i = 0; i < callbacks.length; i++ )
         {
             Callback callback = callbacks[i];
-            if ( callback instanceof WikiEngineCallback )
+            if ( callback instanceof HttpRequestCallback )
+            {
+                ( (HttpRequestCallback) callback ).setRequest( m_request );
+            }
+            else if( callback instanceof WikiEngineCallback )
             {
                 ( (WikiEngineCallback) callback ).setEngine( m_engine );
             }
+            else if ( callback instanceof UserDatabaseCallback )
+            {
+                ( (UserDatabaseCallback) callback ).setUserDatabase( 
m_engine.getUserManager().getUserDatabase() );
+            }
             else if ( callback instanceof NameCallback )
             {
                 ( (NameCallback) callback ).setName( m_username );
@@ -93,7 +103,7 @@
             }
             else if ( callback instanceof LocaleCallback )
             {
-                ( (LocaleCallback) callback ).setLocale( m_locale );
+                ( (LocaleCallback) callback ).setLocale( m_request != null ? 
m_request.getLocale() : Locale.getDefault() );
             }
             else if( callbacks[i] instanceof TextOutputCallback )
             {

Modified: 
incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/user/DefaultUserProfile.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/user/DefaultUserProfile.java?rev=762754&r1=762753&r2=762754&view=diff
==============================================================================
--- 
incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/user/DefaultUserProfile.java
 (original)
+++ 
incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/user/DefaultUserProfile.java
 Tue Apr  7 12:56:09 2009
@@ -232,7 +232,7 @@
     /**
      * Sets the name by which the user logs in. The login name is used as the
      * username for custom authentication (see
-     * {...@link org.apache.wiki.auth.AuthenticationManager#login(WikiSession, 
String, String)}).
+     * {...@link 
org.apache.wiki.auth.AuthenticationManager#login(org.apache.wiki.WikiSession, 
javax.servlet.http.HttpServletRequest, String, String)}).
      * The login name is typically a short name ("jannej"). In contrast, the
      * wiki name is typically of type FirstnameLastName ("JanneJalkanen").
      * @param name the login name

Modified: 
incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/user/JDBCUserDatabase.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/user/JDBCUserDatabase.java?rev=762754&r1=762753&r2=762754&view=diff
==============================================================================
--- 
incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/user/JDBCUserDatabase.java
 (original)
+++ 
incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/user/JDBCUserDatabase.java
 Tue Apr  7 12:56:09 2009
@@ -342,7 +342,7 @@
         }
         catch( SQLException e )
         {
-            throw new WikiSecurityException( e.getMessage() );
+            throw new WikiSecurityException( e.getMessage(), e );
         }
         finally
         {
@@ -429,7 +429,7 @@
         }
         catch( SQLException e )
         {
-            throw new WikiSecurityException( e.getMessage() );
+            throw new WikiSecurityException( e.getMessage(), e );
         }
         finally
         {
@@ -647,7 +647,7 @@
         }
         catch( SQLException e )
         {
-            throw new WikiSecurityException( e.getMessage() );
+            throw new WikiSecurityException( e.getMessage(), e );
         }
         finally
         {
@@ -729,7 +729,7 @@
                 }
                 catch ( IOException e )
                 {
-                    throw new WikiSecurityException( "Could not save user 
profile attribute. Reason: " + e.getMessage() );
+                    throw new WikiSecurityException( "Could not save user 
profile attribute. Reason: " + e.getMessage(), e );
                 }
                 ps.setTimestamp( 9, ts );
                 ps.execute();
@@ -774,7 +774,7 @@
                 }
                 catch ( IOException e )
                 {
-                    throw new WikiSecurityException( "Could not save user 
profile attribute. Reason: " + e.getMessage() );
+                    throw new WikiSecurityException( "Could not save user 
profile attribute. Reason: " + e.getMessage(), e );
                 }
                 ps.setDate( 9, lockExpiry );
                 ps.setString( 10, profile.getLoginName() );
@@ -792,7 +792,7 @@
         }
         catch( SQLException e )
         {
-            throw new WikiSecurityException( e.getMessage() );
+            throw new WikiSecurityException( e.getMessage(), e );
         }
         finally
         {

Modified: 
incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/user/UserProfile.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/user/UserProfile.java?rev=762754&r1=762753&r2=762754&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/user/UserProfile.java 
(original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/user/UserProfile.java 
Tue Apr  7 12:56:09 2009
@@ -164,7 +164,7 @@
     /**
      * Sets the name by which the user logs in. The login name is used as the
      * username for custom authentication (see
-     * {...@link org.apache.wiki.auth.AuthenticationManager#login(WikiSession, 
String, String)},
+     * {...@link 
org.apache.wiki.auth.AuthenticationManager#login(org.apache.wiki.WikiSession, 
javax.servlet.http.HttpServletRequest, String, String)},
      * {...@link org.apache.wiki.auth.login.UserDatabaseLoginModule}). The 
login
      * name is typically a short name ("jannej"). In contrast, the wiki name is
      * typically of type FirstnameLastName ("JanneJalkanen").

Modified: 
incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/user/XMLUserDatabase.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/user/XMLUserDatabase.java?rev=762754&r1=762753&r2=762754&view=diff
==============================================================================
--- 
incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/user/XMLUserDatabase.java 
(original)
+++ 
incubator/jspwiki/trunk/src/java/org/apache/wiki/auth/user/XMLUserDatabase.java 
Tue Apr  7 12:56:09 2009
@@ -398,7 +398,7 @@
         }
         catch ( IOException e )
         {
-            throw new WikiSecurityException( e.getLocalizedMessage() );
+            throw new WikiSecurityException( e.getLocalizedMessage(), e );
         }
 
         // Copy new file over old version
@@ -579,7 +579,7 @@
             }
             catch ( IOException e )
             {
-                throw new WikiSecurityException( "Could not save user profile 
attribute. Reason: " + e.getMessage() );
+                throw new WikiSecurityException( "Could not save user profile 
attribute. Reason: " + e.getMessage(), e );
             }
         }
 

Modified: 
incubator/jspwiki/trunk/src/java/org/apache/wiki/content/ContentManager.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/content/ContentManager.java?rev=762754&r1=762753&r2=762754&view=diff
==============================================================================
--- 
incubator/jspwiki/trunk/src/java/org/apache/wiki/content/ContentManager.java 
(original)
+++ 
incubator/jspwiki/trunk/src/java/org/apache/wiki/content/ContentManager.java 
Tue Apr  7 12:56:09 2009
@@ -1021,7 +1021,7 @@
             }
             catch( PageNotFoundException e )
             {
-                throw new WikiException( e.getMessage() );
+                throw new WikiException( e.getMessage(), e );
             }
             
             // Retrieve the page ACL, author, attributes, modified-date, name 
and new text from the workflow
@@ -1056,7 +1056,7 @@
             catch( PageNotFoundException e )
             {
                 e.printStackTrace();
-                throw new WikiException( e.getMessage() );
+                throw new WikiException( e.getMessage(), e );
             }
             return Outcome.STEP_COMPLETE;
         }

Modified: 
incubator/jspwiki/trunk/src/java/org/apache/wiki/content/PageRenamer.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/content/PageRenamer.java?rev=762754&r1=762753&r2=762754&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/content/PageRenamer.java 
(original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/content/PageRenamer.java 
Tue Apr  7 12:56:09 2009
@@ -104,7 +104,7 @@
         }
         catch( PageNotFoundException e )
         {
-            throw new WikiException("No such page "+renameFrom);
+            throw new WikiException("No such page "+renameFrom, e );
         }
         
         WikiPage toPage;

Modified: 
incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/BugReportHandler.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/BugReportHandler.java?rev=762754&r1=762753&r2=762754&view=diff
==============================================================================
--- 
incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/BugReportHandler.java 
(original)
+++ 
incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/BugReportHandler.java 
Tue Apr  7 12:56:09 2009
@@ -177,7 +177,7 @@
             }
             catch( PageAlreadyExistsException e )
             {
-                throw new ProviderException( e.getMessage() );
+                throw new ProviderException( e.getMessage(), e );
             }
             WikiContext newContext = (WikiContext)context.clone();
             newContext.setPage( newPage );

Modified: 
incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/WeblogEntryPlugin.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/WeblogEntryPlugin.java?rev=762754&r1=762753&r2=762754&view=diff
==============================================================================
--- 
incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/WeblogEntryPlugin.java 
(original)
+++ 
incubator/jspwiki/trunk/src/java/org/apache/wiki/plugin/WeblogEntryPlugin.java 
Tue Apr  7 12:56:09 2009
@@ -168,7 +168,7 @@
             }
             catch( PageAlreadyExistsException e )
             {
-                throw new ProviderException( e.getMessage() );
+                throw new ProviderException( e.getMessage(), e );
             }
                                           
             PageLock lock = mgr.getCurrentLock( page );

Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/rss/RSSGenerator.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/rss/RSSGenerator.java?rev=762754&r1=762753&r2=762754&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/rss/RSSGenerator.java 
(original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/rss/RSSGenerator.java Tue 
Apr  7 12:56:09 2009
@@ -325,7 +325,7 @@
             catch( PageNotFoundException e1 )
             {
                 // This should not happen
-                throw new WikiException( e1.getMessage() );
+                throw new WikiException( e1.getMessage(), e1 );
             }
         }
         Feed feed = new RSS10Feed( context );

Modified: 
incubator/jspwiki/trunk/src/java/org/apache/wiki/search/LuceneSearchProvider.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/search/LuceneSearchProvider.java?rev=762754&r1=762753&r2=762754&view=diff
==============================================================================
--- 
incubator/jspwiki/trunk/src/java/org/apache/wiki/search/LuceneSearchProvider.java
 (original)
+++ 
incubator/jspwiki/trunk/src/java/org/apache/wiki/search/LuceneSearchProvider.java
 Tue Apr  7 12:56:09 2009
@@ -636,7 +636,7 @@
                     catch( PageAlreadyExistsException e1 )
                     {
                         // This should not happen
-                        throw new ProviderException( e1.getMessage() );
+                        throw new ProviderException( e1.getMessage(), e1 );
                     }
                 }
             }

Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/util/ClassUtil.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/util/ClassUtil.java?rev=762754&r1=762753&r2=762754&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/util/ClassUtil.java 
(original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/util/ClassUtil.java Tue 
Apr  7 12:56:09 2009
@@ -293,24 +293,24 @@
         {
             log.info( "%1$s %2$s", "Cannot instantiate requested class " + 
requestedClass, e );
             
-            throw new WikiException("Failed to instantiate class 
"+requestedClass);
+            throw new WikiException( "Failed to instantiate class 
"+requestedClass, e );
         }
         catch (IllegalAccessException e)
         {
             log.info( "%1$s %2$s", "Cannot access requested class " + 
requestedClass, e );
             
-            throw new WikiException("Failed to instantiate class 
"+requestedClass);
+            throw new WikiException( "Failed to instantiate class 
"+requestedClass, e );
         }
         catch (IllegalArgumentException e)
         {
             log.info( "%1$s %2$s", "Illegal arguments when constructing new 
object", e );
             
-            throw new WikiException("Failed to instantiate class 
"+requestedClass);
+            throw new WikiException( "Failed to instantiate class 
"+requestedClass, e );
         }
         catch (InvocationTargetException e)
         {
             log.info( "%1$s %2$s", "Failed to invoke class " + requestedClass, 
e.getCause() );
-            throw new WikiException("Failed to invoke class "+requestedClass + 
", reason: " + e.getCause());
+            throw new WikiException( "Failed to invoke class "+requestedClass 
+ ", reason: " + e.getCause(), e );
         }
     }
 
@@ -342,7 +342,7 @@
         {
             log.info( "Cannot find requested class", e );
             
-            throw new WikiException("Failed to instantiate class 
"+requestedClass);
+            throw new WikiException( "Failed to instantiate class 
"+requestedClass, e );
         }
     }
 }

Modified: 
incubator/jspwiki/trunk/src/java/org/apache/wiki/xmlrpc/MetaWeblogHandler.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/xmlrpc/MetaWeblogHandler.java?rev=762754&r1=762753&r2=762754&view=diff
==============================================================================
--- 
incubator/jspwiki/trunk/src/java/org/apache/wiki/xmlrpc/MetaWeblogHandler.java 
(original)
+++ 
incubator/jspwiki/trunk/src/java/org/apache/wiki/xmlrpc/MetaWeblogHandler.java 
Tue Apr  7 12:56:09 2009
@@ -97,7 +97,7 @@
             AuthenticationManager amm = 
m_context.getEngine().getAuthenticationManager();
             AuthorizationManager mgr = 
m_context.getEngine().getAuthorizationManager();
         
-            if( amm.login( m_context.getWikiSession(), username, password ) )
+            if( amm.login( m_context.getWikiSession(), 
m_context.getHttpRequest(), username, password ) )
             {
                 if( !mgr.checkPermission( m_context.getWikiSession(), 
PermissionFactory.getPagePermission( page, permission ) ))
                 {

Modified: incubator/jspwiki/trunk/tests/java/org/apache/wiki/TestEngine.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/java/org/apache/wiki/TestEngine.java?rev=762754&r1=762753&r2=762754&view=diff
==============================================================================
--- incubator/jspwiki/trunk/tests/java/org/apache/wiki/TestEngine.java 
(original)
+++ incubator/jspwiki/trunk/tests/java/org/apache/wiki/TestEngine.java Tue Apr  
7 12:56:09 2009
@@ -91,7 +91,7 @@
             // Set up long-running admin session
             HttpServletRequest request = newHttpRequest();
             m_adminWikiSession = WikiSession.getWikiSession( this, request );
-            this.getAuthenticationManager().login( m_adminWikiSession,
+            this.getAuthenticationManager().login( m_adminWikiSession, request,
                                                    Users.ADMIN,
                                                    Users.ADMIN_PASS );
         }
@@ -127,7 +127,7 @@
             // Set up a test Janne session
             HttpServletRequest request = newHttpRequest();
             m_janneWikiSession = WikiSession.getWikiSession( this, request );
-            this.getAuthenticationManager().login( m_janneWikiSession,
+            this.getAuthenticationManager().login( m_janneWikiSession, request,
                     Users.JANNE,
                     Users.JANNE_PASS );
         }
@@ -346,7 +346,7 @@
         WikiSession wikiSession = SessionMonitor.getInstance( this ).find( 
request.getSession() );
         try
         {
-            this.getAuthenticationManager().login( wikiSession,
+            this.getAuthenticationManager().login( wikiSession, request,
                     Users.ADMIN,
                     Users.ADMIN_PASS );
         }
@@ -371,7 +371,7 @@
             catch( PageAlreadyExistsException e1 )
             {
                 // This should not happen
-                throw new WikiException( e1.getMessage() );
+                throw new WikiException( e1.getMessage(), e1 );
             }
         }
         WikiContext context = this.getWikiContextFactory().newViewContext( 
request, null, page );
@@ -386,7 +386,7 @@
         WikiSession wikiSession = SessionMonitor.getInstance( this ).find( 
request.getSession() );
         try
         {
-            this.getAuthenticationManager().login( wikiSession,
+            this.getAuthenticationManager().login( wikiSession, request,
                     Users.JANNE,
                     Users.JANNE_PASS );
         }
@@ -404,7 +404,7 @@
         catch( PageAlreadyExistsException e1 )
         {
             // This should not happen
-            throw new WikiException( e1.getMessage() );
+            throw new WikiException( e1.getMessage(), e1 );
         }
         WikiContext context = this.getWikiContextFactory().newViewContext( 
request, null, page );
         saveText( context, content );
@@ -492,7 +492,7 @@
         }
         MockRoundtrip trip = new MockRoundtrip( servletContext, beanClass );
         WikiSession session = WikiSession.getWikiSession( this, 
trip.getRequest() );
-        this.getAuthenticationManager().login( session, user, password );
+        this.getAuthenticationManager().login( session, trip.getRequest(), 
user, password );
         return trip;
     }
     

Modified: 
incubator/jspwiki/trunk/tests/java/org/apache/wiki/WikiSessionTest.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/java/org/apache/wiki/WikiSessionTest.java?rev=762754&r1=762753&r2=762754&view=diff
==============================================================================
--- incubator/jspwiki/trunk/tests/java/org/apache/wiki/WikiSessionTest.java 
(original)
+++ incubator/jspwiki/trunk/tests/java/org/apache/wiki/WikiSessionTest.java Tue 
Apr  7 12:56:09 2009
@@ -306,7 +306,7 @@
         
         // Log in the user with credentials
         WikiSession session = WikiSession.getWikiSession( engine, request );
-        engine.getAuthenticationManager().login( session, id, password );
+        engine.getAuthenticationManager().login( session, request, id, 
password );
         
         // Make sure the user is actually authenticated
         if ( !session.isAuthenticated() )

Modified: 
incubator/jspwiki/trunk/tests/java/org/apache/wiki/action/UserPreferencesActionBeanTest.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/java/org/apache/wiki/action/UserPreferencesActionBeanTest.java?rev=762754&r1=762753&r2=762754&view=diff
==============================================================================
--- 
incubator/jspwiki/trunk/tests/java/org/apache/wiki/action/UserPreferencesActionBeanTest.java
 (original)
+++ 
incubator/jspwiki/trunk/tests/java/org/apache/wiki/action/UserPreferencesActionBeanTest.java
 Tue Apr  7 12:56:09 2009
@@ -93,7 +93,7 @@
         trip = m_engine.guestTrip( "/UserPreferences.action" );
         MockHttpServletRequest request = trip.getRequest();
         WikiSession wikiSession = WikiSession.getWikiSession( m_engine, 
request );
-        boolean login = m_engine.getAuthenticationManager().login( 
wikiSession, Users.JANNE, Users.JANNE_PASS );
+        boolean login = m_engine.getAuthenticationManager().login( 
wikiSession, request, Users.JANNE, Users.JANNE_PASS );
         assertTrue( "Could not log in.", login );
 
         // Set 'assertion' param; verify redirect to front page

Modified: 
incubator/jspwiki/trunk/tests/java/org/apache/wiki/action/UserProfileActionBeanTest.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/java/org/apache/wiki/action/UserProfileActionBeanTest.java?rev=762754&r1=762753&r2=762754&view=diff
==============================================================================
--- 
incubator/jspwiki/trunk/tests/java/org/apache/wiki/action/UserProfileActionBeanTest.java
 (original)
+++ 
incubator/jspwiki/trunk/tests/java/org/apache/wiki/action/UserProfileActionBeanTest.java
 Tue Apr  7 12:56:09 2009
@@ -354,7 +354,7 @@
         trip = m_engine.guestTrip( "/UserProfile.action" );
         MockHttpServletRequest request = trip.getRequest();
         WikiSession wikiSession = WikiSession.getWikiSession( m_engine, 
request );
-        boolean login = m_engine.getAuthenticationManager().login( 
wikiSession, "user" + suffix, "mypassword" );
+        boolean login = m_engine.getAuthenticationManager().login( 
wikiSession, request, "user" + suffix, "mypassword" );
         assertTrue( "Could not log in.", login );
 
         // Make sure the saved profile is loaded when we access prefs page
@@ -368,7 +368,7 @@
         trip = m_engine.guestTrip( "/UserProfile.action" );
         request = trip.getRequest();
         wikiSession = WikiSession.getWikiSession( m_engine, request );
-        login = m_engine.getAuthenticationManager().login( wikiSession, "user" 
+ suffix, "mypassword" );
+        login = m_engine.getAuthenticationManager().login( wikiSession, 
request, "user" + suffix, "mypassword" );
         assertTrue( "Could not lot in.", login );
 
         // Pass new values for the mutable fields (except the password).

Modified: 
incubator/jspwiki/trunk/tests/java/org/apache/wiki/auth/login/UserDatabaseLoginModuleTest.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/java/org/apache/wiki/auth/login/UserDatabaseLoginModuleTest.java?rev=762754&r1=762753&r2=762754&view=diff
==============================================================================
--- 
incubator/jspwiki/trunk/tests/java/org/apache/wiki/auth/login/UserDatabaseLoginModuleTest.java
 (original)
+++ 
incubator/jspwiki/trunk/tests/java/org/apache/wiki/auth/login/UserDatabaseLoginModuleTest.java
 Tue Apr  7 12:56:09 2009
@@ -59,7 +59,7 @@
         try
         {
             // Log in with a user that isn't in the database
-            CallbackHandler handler = new WikiCallbackHandler( m_engine, 
Locale.getDefault(), "user", "password" );
+            CallbackHandler handler = new WikiCallbackHandler( m_engine, null, 
"user", "password" );
             LoginModule module = new UserDatabaseLoginModule();
             module.initialize(subject, handler, 
                               new HashMap<String, Object>(), 
@@ -74,7 +74,7 @@
             
             // Login with a user that IS in the database
             subject = new Subject();
-            handler = new WikiCallbackHandler( m_engine, Locale.getDefault(), 
"janne", "m...@5sw0rd" );
+            handler = new WikiCallbackHandler( m_engine, null, "janne", 
"m...@5sw0rd" );
             module = new UserDatabaseLoginModule();
             module.initialize(subject, handler, 
                               new HashMap<String, Object>(), 
@@ -98,7 +98,7 @@
     {
         try
         {
-            CallbackHandler handler = new WikiCallbackHandler( m_engine, 
Locale.getDefault(), "user", "password" );
+            CallbackHandler handler = new WikiCallbackHandler( m_engine, null, 
"user", "password" );
             LoginModule module = new UserDatabaseLoginModule();
             module.initialize(subject, handler, 
                               new HashMap<String, Object>(), 


Reply via email to