[jboss-cvs] jboss-seam/examples/dvdstore/src/com/jboss/dvd/seam ...
Norman Richards
norman.richards at jboss.com
Thu Aug 2 14:58:05 EDT 2007
User: nrichards
Date: 07/08/02 14:58:04
Modified: examples/dvdstore/src/com/jboss/dvd/seam
AuthenticatorAction.java
Log:
Update security config, fix sessionContext bug
Revision Changes Path
1.4 +30 -35 jboss-seam/examples/dvdstore/src/com/jboss/dvd/seam/AuthenticatorAction.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: AuthenticatorAction.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/dvdstore/src/com/jboss/dvd/seam/AuthenticatorAction.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- AuthenticatorAction.java 19 Jun 2007 20:54:23 -0000 1.3
+++ AuthenticatorAction.java 2 Aug 2007 18:58:04 -0000 1.4
@@ -6,6 +6,7 @@
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Out;
import org.jboss.seam.bpm.Actor;
import org.jboss.seam.contexts.Context;
import org.jboss.seam.security.Identity;
@@ -19,30 +20,24 @@
@In
private EntityManager entityManager;
- @In Context sessionContext;
-
@In Actor actor;
-
@In Identity identity;
+ @Out(required=false) User currentUser;
+
public boolean authenticate()
{
-
- User found;
try {
- found = (User)
+ currentUser = (User)
entityManager.createQuery("select u from User u where u.userName = #{identity.username} and u.password = #{identity.password}")
.getSingleResult();
} catch (PersistenceException e) {
return false;
}
- sessionContext.set(USER_VAR, found);
-
actor.setId(identity.getUsername());
- if (found instanceof Admin)
- {
+ if (currentUser instanceof Admin) {
actor.getGroupActorIds().add("shippers");
actor.getGroupActorIds().add("reviewers");
identity.addRole("admin");
More information about the jboss-cvs-commits
mailing list