// get the user principal
Set principals = subject.getPrincipals();
Iterator list = principals.iterator();
while (list.hasNext())
{
BasePrincipal principal = (BasePrincipal) list.next();
String path = principal.getFullPath();
if (path.startsWith("/role/"))
{
JSRole _tempRole = (JSRole) this.getObjectBehindPath(roleMap,
principal.getName());
if (_tempRole != null)
{
_newUser.addRole(_tempRole);
}
} else
{
if (path.startsWith("/group/"))
{
JSGroup _tempGroup = (JSGroup) this.getObjectBehindPath(
groupMap, principal.getName());
if (_tempGroup != null)
{
_newUser.addGroup(_tempGroup);
}