[jboss-user] [JBoss Seam] - Re: Strange Seam Actor component problem
campi
do-not-reply at jboss.com
Wed May 2 05:15:38 EDT 2007
Hi,
I also have a problem with the Seam Actor Java Bean.
I'm currently using a seam project generated with seam-gen and I'm trying to use JBPM with it. I have take the dvdstore authenticator to test authentification :
| Stateless
| @Name("authenticator")
| public class AuthenticatorAction implements Authenticator
| {
| private static final String USER_VAR = "currentUser";
|
| @PersistenceContext
| private EntityManager entityManager;
|
| @In
| Context sessionContext;
|
| @In(create=true)
| Actor actor;
|
| @In
| Identity identity;
|
| public boolean authenticate()
| {
|
| User found;
| try {
| found = (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 = new Actor();
|
| actor.setId(identity.getUsername());
|
| if (found instanceof Prescriptor)
| {
| actor.getGroupActorIds().add("prescriptor");
|
| }
| else if(found instanceof Agent){
|
| actor.getGroupActorIds().add("agent");
| }
| else if(found instanceof Organization){
|
| actor.getGroupActorIds().add("organization");
| }
| else if(found instanceof Admin){
| identity.addRole("admin");
| }
|
| return true;
| }
| }
|
In my components.xml :
| <security:identity authenticate-method="#{authenticator.authenticate}"/>
|
In the login.xhtml :
| <h:form id="login">
|
| <rich:panel>
| <f:facet name="header">Login</f:facet>
|
| <p>Please login using any username and password</p>
|
| <div class="dialog">
| <h:panelGrid columns="2" rowClasses="prop" columnClasses="name,value">
| <h:outputLabel for="username">Username</h:outputLabel>
| <h:inputText id="username"
| value="#{identity.username}"/>
| <h:outputLabel for="password">Password</h:outputLabel>
| <h:inputSecret id="password"
| value="#{identity.password}"/>
| <h:outputLabel for="rememberMe">Remember me</h:outputLabel>
| <h:selectBooleanCheckbox id="rememberMe"
| value="#{identity.rememberMe}"/>
| </h:panelGrid>
| </div>
|
| </rich:panel>
|
| <div class="actionButtons">
| <h:commandButton value="Login" action="#{identity.login}"/>
| </div>
|
| </h:form>
|
The only difference between dvdstore project and mine is on the initialization of the components, I have this with the dvdstore case (not present in my project) :
| 11:04:06,545 INFO [Component] Component: org.jboss.seam.core.actor, scope: SESSION, type: JAVA_BEAN, class: org.jboss.seam.core.Actor
|
In the debug page(dvdstore) we can see the org.jboss.seam.security.identity components in the Session Context and the org.jboss.seam.core.actor.component in the Application context.
In the debug page(my project) we can see the org.jboss.seam.security.identity components in the Session Context but not the org.jboss.seam.core.actor.component in the Application context.
I think that my problem come from this difference but I don't really konw how to resolve it. Any Suggestion ?
Thanks
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4042337#4042337
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4042337
More information about the jboss-user
mailing list