Hi,
could someone please try to explain me why the following code does not work. It is very similar to some code on the seamspace example but in my case identity.login() is returning not logged in
@Name("register") @Scope(ScopeType.CONVERSATION) public class Register { @In IdentityManager identityManager; @In private Identity identity; @Logger private static Log log; @Begin public String register() { new RunAsOperation() { @Override public void execute() { identityManager.createUser("testuser@test.com", "password"); } }.addRole("admin").run(); identity.getCredentials().setUsername("testuser@test.com"); identity.getCredentials().setPassword("password"); String res = identity.login(); return res; } }
I guess I am missing something and I would be very grateful if someone could help me out
Thanks
Chris
The independent user profile must be logged in to make your approach work.
Try the same code without String res = identity.login();
line.
Herberson