Java 带有PicketLink的Errai安全性

Java 带有PicketLink的Errai安全性,java,gwt,errai,Java,Gwt,Errai,我为具有勘误表安全性的用户提供了此CustomAuthenticator: public CustomAuthenticator extends BaseAuthenticator { @Override public void authenticate() { String userId = loginCredentials.getUserId(); String password = loginCredentials.getPassword()

我为具有勘误表安全性的用户提供了此CustomAuthenticator:

public CustomAuthenticator extends BaseAuthenticator {
    @Override
    public void authenticate() {
        String userId = loginCredentials.getUserId();
        String password = loginCredentials.getPassword();
        User user = userDAO.fetchUserByName(userId);
        if (!BCrypt.checkpw(password, user.getPasswordHash())) {
            setStatus(AuthenticationStatus.FAILURE);
        } else {
            // Add to IDM
            IdentityQuery<UserImpl> query
                    = partitionManager.createIdentityManager().createIdentityQuery(UserImpl.class);
            query.setParameter(UserImpl.LOGIN_NAME, user.getUsername());
            List<UserImpl> result = query.getResultList();
            org.picketlink.idm.model.basic.Role trial = new org.picketlink.idm.model.basic.Role("TRIAL");
            if (result.isEmpty()){
                UserImpl account = new UserImpl(user);
                partitionManager.createIdentityManager().add(account);
                partitionManager.createIdentityManager().updateCredential(account, new Password(password));
                partitionManager.createIdentityManager().add(trial);
                BasicModel.grantRole(partitionManager.createRelationshipManager(), account, trial);
                IdentityQuery<UserImpl> q
                        = partitionManager.createIdentityManager().createIdentityQuery(UserImpl.class);
                q.setParameter(UserImpl.LOGIN_NAME, user.getUsername());
                UserImpl u = q.getResultList().iterator().next();
                setStatus(AuthenticationStatus.SUCCESS);
                setAccount(u);
            } else {
                setStatus(AuthenticationStatus.SUCCESS);
                setAccount(result.iterator().next());

            }
            userEvent.fire(user);
        }
}
即使我检查要设置的seAccount帐户是否正常,我也不确定角色是否在Picketlink端的列表中持久化;因为呼叫的响应:

Caller<AuthenticationService> authServiceCaller;
Errai Security用户返回了,虽然不是null,但名称是匿名的,角色是NOBODY,我不确定这里发生了什么

更新:

loginusername、password方法返回正确的用户和角色,但getUser不返回。这就是问题所在