You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2003/09/02 20:22:37 UTC
cvs commit: cocoon-lenya/src/java/org/apache/lenya/cms/cocoon/acting DelegatingAuthorizerAction.java UserAuthenticatorAction.java
andreas 2003/09/02 11:22:37
Modified: src/java/org/apache/lenya/cms/ac2 Identity.java
UserAuthenticator.java
src/java/org/apache/lenya/cms/cocoon/acting
DelegatingAuthorizerAction.java
UserAuthenticatorAction.java
Log:
removing previous user from session when new user logs in
Revision Changes Path
1.12 +10 -1 cocoon-lenya/src/java/org/apache/lenya/cms/ac2/Identity.java
Index: Identity.java
===================================================================
RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/cms/ac2/Identity.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- Identity.java 15 Aug 2003 13:09:26 -0000 1.11
+++ Identity.java 2 Sep 2003 18:22:37 -0000 1.12
@@ -209,5 +209,14 @@
Identity identity = (Identity) session.getAttribute(Identity.class.getName());
return identity;
}
+
+ /**
+ * Removes a certain identifiable from the idenity.
+ * @param identifiable An identifiable.
+ */
+ public void removeIdentifiable(Identifiable identifiable) {
+ assert identifiables.contains(identifiable);
+ identifiables.remove(identifiable);
+ }
}
1.6 +9 -1 cocoon-lenya/src/java/org/apache/lenya/cms/ac2/UserAuthenticator.java
Index: UserAuthenticator.java
===================================================================
RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/cms/ac2/UserAuthenticator.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- UserAuthenticator.java 15 Aug 2003 09:49:47 -0000 1.5
+++ UserAuthenticator.java 2 Sep 2003 18:22:37 -0000 1.6
@@ -113,7 +113,15 @@
boolean authenticated = false;
if (user != null && user.authenticate(password)) {
getLogger().info("User [" + user + "] authenticated.");
+
if (!identity.contains(user)) {
+ User oldUser = identity.getUser();
+ if (oldUser != null) {
+ if (getLogger().isDebugEnabled()) {
+ getLogger().debug("Removing user [" + oldUser + "] from identity.");
+ }
+ identity.removeIdentifiable(oldUser);
+ }
identity.addIdentifiable(user);
}
authenticated = true;
1.16 +1 -4 cocoon-lenya/src/java/org/apache/lenya/cms/cocoon/acting/DelegatingAuthorizerAction.java
Index: DelegatingAuthorizerAction.java
===================================================================
RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/cms/cocoon/acting/DelegatingAuthorizerAction.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- DelegatingAuthorizerAction.java 15 Aug 2003 09:42:36 -0000 1.15
+++ DelegatingAuthorizerAction.java 2 Sep 2003 18:22:37 -0000 1.16
@@ -75,8 +75,6 @@
*/
public class DelegatingAuthorizerAction extends AccessControlAction {
- private Map objectModel;
-
/**
* @see org.apache.cocoon.acting.Action#act(org.apache.cocoon.environment.Redirector, org.apache.cocoon.environment.SourceResolver, java.util.Map, java.lang.String, org.apache.avalon.framework.parameters.Parameters)
*/
@@ -87,7 +85,6 @@
String src,
Parameters parameters)
throws Exception {
- this.objectModel = objectModel;
return super.act(redirector, resolver, objectModel, src, parameters);
}
1.10 +1 -11 cocoon-lenya/src/java/org/apache/lenya/cms/cocoon/acting/UserAuthenticatorAction.java
Index: UserAuthenticatorAction.java
===================================================================
RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/cms/cocoon/acting/UserAuthenticatorAction.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- UserAuthenticatorAction.java 23 Jul 2003 13:21:31 -0000 1.9
+++ UserAuthenticatorAction.java 2 Sep 2003 18:22:37 -0000 1.10
@@ -66,18 +66,13 @@
import org.apache.lenya.cms.ac.AccessControlException;
import org.apache.lenya.cms.ac.Identity;
-import org.apache.lenya.cms.ac.ItemManager;
import org.apache.lenya.cms.ac.User;
import org.apache.lenya.cms.ac2.AccessController;
import org.apache.lenya.cms.ac2.AccessControllerResolver;
import org.apache.lenya.cms.ac2.DefaultAccessController;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.publication.PublicationFactory;
import org.w3c.dom.Document;
-import java.io.File;
-
import java.util.Map;
@@ -103,9 +98,6 @@
*/
public boolean authenticate(String username, String password, Request request, Map map)
throws Exception {
- Publication publication = PublicationFactory.getPublication(objectModel);
- File configurationDirectory = new File(publication.getDirectory(), ItemManager.PATH);
-
User user = getUser(username);
if (getLogger().isDebugEnabled()) {
@@ -144,7 +136,6 @@
}
protected static final String ACCESS_CONTROLLER_ELEMENT = "access-controller";
- private String accessControllerId = null;
private Map objectModel;
@@ -161,7 +152,6 @@
User user;
AccessControllerResolver resolver = null;
AccessController accessController = null;
- boolean authorized;
try {
resolver = (AccessControllerResolver) manager.lookup(AccessControllerResolver.ROLE);
Request request = ObjectModelHelper.getRequest(objectModel);
---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-cvs-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-cvs-help@cocoon.apache.org