Index: AuthenticationManager.java =================================================================== --- AuthenticationManager.java (revision 749317) +++ AuthenticationManager.java (working copy) @@ -290,16 +290,27 @@ e.printStackTrace(); throw new WikiSecurityException( e.getMessage() ); } - - // Execute the container login module + // Execute the user's specified login module try { - principals = authenticationMgr.doJAASLogin( WebContainerLoginModule.class, handler, options ); + principals = authenticationMgr.doJAASLogin( m_loginModuleClass, handler, m_loginModuleOptions ); } catch ( LoginException e ) { - // Container credentials not supplied in request. Ok, try the auth cookie! + // Container credentials not supplied in request. Ok, try the WebContainer auth! } + // Execute the container login module + if ( ( principals == null || principals.size() == 0 ) ) + { + try + { + principals = authenticationMgr.doJAASLogin( WebContainerLoginModule.class, handler, options ); + } + catch ( LoginException e ) + { + // Container credentials not supplied in request. Ok, try the auth cookie! + } + } // Execute the cookie authentication module (if allowed) if ( ( principals == null || principals.size() == 0 ) && authenticationMgr.allowsCookieAuthentication() )