return true;
}
public boolean commit() throws LoginException
{
subject.getPrincipals().add(new SimplePrincipal(username));
Group roleGroup = null;
for ( Group g : subject.getPrincipals(Group.class) )
{
if ( ROLES_GROUP.equalsIgnoreCase( g.getName() ) )
{
roleGroup = g;
break;
}
}
if (roleGroup == null) roleGroup = new SimpleGroup(ROLES_GROUP);
for (String role : roles)
{
roleGroup.addMember(new SimplePrincipal(role));
}
subject.getPrincipals().add(roleGroup);
return true;