You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by fl...@apache.org on 2010/11/03 11:45:44 UTC
svn commit: r1030400 - in /lenya/trunk/org.apache.lenya.core.acusecases:
pom.xml src/main/java/org/apache/lenya/cms/ac/usecases/Login.java
src/main/resources/META-INF/cocoon/spring/lenya-core-acusecases-components.xml
Author: florent
Date: Wed Nov 3 10:45:44 2010
New Revision: 1030400
URL: http://svn.apache.org/viewvc?rev=1030400&view=rev
Log:
-solve login related bugs
Modified:
lenya/trunk/org.apache.lenya.core.acusecases/pom.xml
lenya/trunk/org.apache.lenya.core.acusecases/src/main/java/org/apache/lenya/cms/ac/usecases/Login.java
lenya/trunk/org.apache.lenya.core.acusecases/src/main/resources/META-INF/cocoon/spring/lenya-core-acusecases-components.xml
Modified: lenya/trunk/org.apache.lenya.core.acusecases/pom.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.acusecases/pom.xml?rev=1030400&r1=1030399&r2=1030400&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.acusecases/pom.xml (original)
+++ lenya/trunk/org.apache.lenya.core.acusecases/pom.xml Wed Nov 3 10:45:44 2010
@@ -34,8 +34,12 @@
</dependency>
<!-- for template generation -->
<dependency>
- <groupId>org.apache.cocoon</groupId>
- <artifactId>cocoon-template-impl</artifactId>
+ <groupId>org.apache.cocoon</groupId>
+ <artifactId>cocoon-template-impl</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.lenya</groupId>
+ <artifactId>lenya-core-utils</artifactId>
</dependency>
<!-- Tests -->
<dependency>
@@ -63,5 +67,13 @@
<type>test-jar</type>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.lenya</groupId>
+ <artifactId>lenya-core-utils</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <!-- not the test-jar one in order to access mock objects -->
+
</dependencies>
</project>
Modified: lenya/trunk/org.apache.lenya.core.acusecases/src/main/java/org/apache/lenya/cms/ac/usecases/Login.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.acusecases/src/main/java/org/apache/lenya/cms/ac/usecases/Login.java?rev=1030400&r1=1030399&r2=1030400&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.acusecases/src/main/java/org/apache/lenya/cms/ac/usecases/Login.java (original)
+++ lenya/trunk/org.apache.lenya.core.acusecases/src/main/java/org/apache/lenya/cms/ac/usecases/Login.java Wed Nov 3 10:45:44 2010
@@ -19,17 +19,16 @@ package org.apache.lenya.cms.ac.usecases
import javax.servlet.http.HttpServletRequest;
-import org.apache.cocoon.processing.ProcessInfoProvider;
-import org.apache.cocoon.spring.configurator.WebAppContextUtils;
import org.apache.lenya.ac.Identity;
import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.publication.URLInformation;
+import org.apache.lenya.cms.publication.Session;
+import org.apache.lenya.utils.ServletHelper;
+import org.apache.lenya.utils.URLInformation;
import org.apache.lenya.cms.usecase.UsecaseException;
/**
* Usecase to login a user.
*
- * @version $Id: Login.java 407305 2006-05-17 16:21:49Z andreas $
*/
public class Login extends AccessControlUsecase {
@@ -39,16 +38,16 @@ public class Login extends AccessControl
protected static final String REFERRER_QUERY_STRING = "referrerQueryString";
protected static final String PUBLICATION = "publication";
protected static final String CURRENT_USER = "currentUser";
-
+
+ //private Repository repository;
/**
* @see org.apache.lenya.cms.usecase.AbstractUsecase#initParameters()
*/
protected void initParameters() {
super.initParameters();
-
+
try {
- URLInformation info = new URLInformation();
- String pubId = info.getPublicationId();
+ String pubId = new URLInformation().getPublicationId();
if (getSession().existsPublication(pubId)) {
Publication publication = getSession().getPublication(pubId);
setParameter(PUBLICATION, publication);
@@ -88,13 +87,17 @@ public class Login extends AccessControl
validate();
if (!hasErrors()) {
- ProcessInfoProvider process = (ProcessInfoProvider) WebAppContextUtils.getCurrentWebApplicationContext()
- .getBean(ProcessInfoProvider.ROLE);
- HttpServletRequest request = process.getRequest();
+ HttpServletRequest request = ServletHelper.getRequest();
request.getSession(true);
+
if (getAccessController().authenticate(request)) {
- request.getSession(false).removeAttribute(HISTORY_SESSION_ATTRIBUTE);
- setDefaultTargetURL(request.getPathInfo());
+ //we have an authenticated user, so we create a modifiable repository session
+ Identity identity = (Identity) request.getSession().getAttribute(Identity.class.getName());
+ Session s = this.repository.startSession(identity, true);
+ this.setSession(s);
+ //TODO : see if this remove attribute is still valid
+ request.getSession(false).removeAttribute(HISTORY_SESSION_ATTRIBUTE);
+ setDefaultTargetURL(request.getPathInfo());
} else {
addErrorMessage("Authentication failed");
}
Modified: lenya/trunk/org.apache.lenya.core.acusecases/src/main/resources/META-INF/cocoon/spring/lenya-core-acusecases-components.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.core.acusecases/src/main/resources/META-INF/cocoon/spring/lenya-core-acusecases-components.xml?rev=1030400&r1=1030399&r2=1030400&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.core.acusecases/src/main/resources/META-INF/cocoon/spring/lenya-core-acusecases-components.xml (original)
+++ lenya/trunk/org.apache.lenya.core.acusecases/src/main/resources/META-INF/cocoon/spring/lenya-core-acusecases-components.xml Wed Nov 3 10:45:44 2010
@@ -26,13 +26,12 @@
<property name="repository" ref="org.apache.lenya.cms.publication.Repository"/>
<property name="accessControllerResolver" ref="org.apache.lenya.ac.AccessControllerResolver"/>
<property name="view">
- <bean class="org.apache.lenya.cms.usecase.UsecaseView">
+ <bean class="org.apache.lenya.cms.usecase.UsecaseViewImpl">
<property name="guiManager" ref="org.apache.lenya.cms.usecase.gui.GUIManager"/>
- <property name="uri" value="fallback://lenya/modules/acusecases/jx/login.jx"/>
+ <property name="viewUri" value="fallback://lenya/modules/acusecases/jx/login.jx"/>
<property name="createContinuation" value="true"/>
</bean>
</property>
</bean>
-
</beans>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org