newPrincipal.addPrivateCredential(credential);
}
private JSPrincipal createJSPrincipal(JetspeedPrincipal principal) throws SecurityException
{
JSPrincipal _jsPrincipal = new JSPrincipal();
_jsPrincipal.setPrincipal(principal);
_jsPrincipal.setType(principal.getType().getName());
_jsPrincipal.setName(principal.getName());
_jsPrincipal.setMapped(principal.isMapped());
_jsPrincipal.setEnabled(principal.isEnabled());
_jsPrincipal.setReadonly(principal.isReadOnly());
_jsPrincipal.setRemovable(principal.isRemovable());
_jsPrincipal.setExtendable(principal.isExtendable());
if (JetspeedPrincipalType.USER.equals(principal.getType().getName()))
{
Credential credential = userManager.getPasswordCredential((User) principal);
Subject subject = userManager.getSubject((User) principal);
if (credential != null)
{
addJSPrincipalCredentials(true, _jsPrincipal, credential);
}
for (Object o : subject.getPublicCredentials())
{
credential = (Credential)o;
addJSPrincipalCredentials(true, _jsPrincipal, credential);
}
for (Object o : subject.getPrivateCredentials())
{
credential = (Credential)o;
addJSPrincipalCredentials(false, _jsPrincipal, credential);
}
}
_jsPrincipal.setSecurityAttributes(principal.getSecurityAttributes().getAttributeMap());
return _jsPrincipal;
}