Author: norman.richards(a)jboss.com
Date: 2009-03-31 20:37:47 -0400 (Tue, 31 Mar 2009)
New Revision: 10261
Modified:
trunk/examples/booking/src/org/jboss/seam/example/booking/AuthenticatorAction.java
Log:
JBSEAM-4015
Modified:
trunk/examples/booking/src/org/jboss/seam/example/booking/AuthenticatorAction.java
===================================================================
---
trunk/examples/booking/src/org/jboss/seam/example/booking/AuthenticatorAction.java 2009-04-01
00:17:50 UTC (rev 10260)
+++
trunk/examples/booking/src/org/jboss/seam/example/booking/AuthenticatorAction.java 2009-04-01
00:37:47 UTC (rev 10261)
@@ -8,33 +8,33 @@
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
+import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Out;
@Stateless
@Name("authenticator")
-public class AuthenticatorAction implements Authenticator
+public class AuthenticatorAction
+ implements Authenticator
{
- @PersistenceContext
- private EntityManager em;
+ @PersistenceContext
+ private EntityManager em;
+
+ @In(required=false)
+ @Out(required=false, scope = SESSION)
+ private User user;
- @Out(required=false, scope = SESSION)
- private User user;
-
- public boolean authenticate()
- {
- List results = em.createQuery("select u from User u where
u.username=#{identity.username} and u.password=#{identity.password}")
- .getResultList();
+ public boolean authenticate()
+ {
+ List results = em.createQuery("select u from User u where
u.username=#{identity.username} and u.password=#{identity.password}")
+ .getResultList();
- if ( results.size()==0 )
- {
- return false;
- }
- else
- {
- user = (User) results.get(0);
- return true;
- }
- }
-
+ if (results.size()==0) {
+ return false;
+ } else {
+ user = (User) results.get(0);
+ return true;
+ }
+ }
+
}
Show replies by date