On Nov 3, 2005, at 9:51 AM, Ben Alex wrote:

Hi everyone

CVS now contains pretty much all the tasks scheduled for 0.9.0. The roadmap is at:

http://opensource2.atlassian.com/projects/spring/browse/SEC? report=com.atlassian.jira.plugin.system.project:roadmap-panel

I'd be grateful if people using CVS could checkout and provide feedback on the changes / stability of the code over the next couple of days so that we can release.

Cheers




I've been attempting to upgrade AppFuse to use 0.9.0 (from 0.8.3) for the last hour or so and I've had pretty good luck so far. However, there's one issue that I can't seem to solve. With 0.8.3, I used the following to automatically login a user after they registered:

       // log user in automatically
Authentication auth = new UsernamePasswordAuthenticationToken (user.getUsername(), user.getConfirmPassword());
       auth.sentAuthenticated(true);
       try {
ProviderManager authenticationManager = (ProviderManager) getBean("authenticationManager");
           SecurityContext ctx = SecurityContextHolder.getContext();
ctx.setAuthentication (authenticationManager.doAuthentication(auth));
       } catch (NoSuchBeanDefinitionException n) {
           // ignore, should only happen when testing
       }

(of course, class names have been changed for 0.9.0).

With 0.9.0, this doesn't work. First of all, I needed to change the constructor of UsernamePasswordAuthenticationToken to:

Authentication auth = new UsernamePasswordAuthenticationToken (user.getUsername(), user.getConfirmPassword(), new GrantedAuthority[] {new GrantedAuthorityImpl (Constants.USER_ROLE)});

But this doesn't seem to solve anything. I also tried reseetting the SecurityContext on the SecurityContextHolder, but that doesn't seem to help either.

ctx.setAuthentication (authenticationManager.doAuthentication(auth));
           SecurityContextHolder.setContext(ctx);

Here's a diff of changes I've made in my applicationContext- security.xml file:

Index: applicationContext-security.xml
===================================================================
RCS file: /cvs/appfuse/web/WEB-INF/applicationContext-security.xml,v
retrieving revision 1.14
diff -u -r1.14 applicationContext-security.xml
--- applicationContext-security.xml 19 Sep 2005 22:03:36 -0000 1.14
+++ applicationContext-security.xml    8 Nov 2005 06:46:50 -0000
@@ -47,8 +47,8 @@
        </property>
    </bean>
- <!-- Automatically receives AuthenticationEvent messages from DaoAuthenticationProvider --> - <bean id="loggerListener" class="net.sf.acegisecurity.providers.dao.event.LoggerListener"/>
+    <!-- Log failed authentication attempts to commons-logging -->
+ <bean id="loggerListener" class="net.sf.acegisecurity.event.authentication.LoggerListener"/> <bean id="daoAuthenticationProvider" class="net.sf.acegisecurity.providers.dao.DaoAuthenticationProvider"> <property name="authenticationDao" ref="jdbcAuthenticationDao"/>
@@ -100,9 +100,7 @@
    </bean>
<!-- ===================== HTTP REQUEST SECURITY ==================== --> - <bean id="httpSessionContextIntegrationFilter" class="net.sf.acegisecurity.context.HttpSessionContextIntegrationFilter" > - <property name="context" value="net.sf.acegisecurity.context.security.SecureContextImpl"/>
-    </bean>
+ <bean id="httpSessionContextIntegrationFilter" class="net.sf.acegisecurity.context.HttpSessionContextIntegrationFilter" /> <bean id="authenticationProcessingFilter" class="net.sf.acegisecurity.ui.webapp.AuthenticationProcessingFilter"> <property name="authenticationManager" ref="authenticationManager"/>
@@ -122,7 +120,7 @@
<property name="authenticationEntryPoint" ref="authenticationProcessingFilterEntryPoint"/>
    </bean>
- <bean id="remoteUserFilter" class="net.sf.acegisecurity.wrapper.ContextHolderAwareRequestFilter"/> + <bean id="remoteUserFilter" class="net.sf.acegisecurity.wrapper.SecurityContextHolderAwareRequestFil ter"/> <bean id="authenticationProcessingFilterEntryPoint" class="net.sf.acegisecurity.ui.webapp.AuthenticationProcessingFilterEntr yPoint">
        <property name="loginFormUrl" value="/login.jsp"/>

Thanks,

Matt








-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Home: http://acegisecurity.sourceforge.net
Acegisecurity-developer mailing list
Acegisecurity-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/acegisecurity-developer

Reply via email to