private String append(JSPrincipal principal) { return principal.getName(); }
public String getPwDataValue(String key) { return getPwDataValue(key, null); }
public boolean getPwDataValueAsBoolean(String key) { return getPwDataValueAsBoolean(key, false); }
if (userManager.userExists(jsuser.getName())) user = userManager.getUser(jsuser.getName()); boolean doPwData = jsuser.getPwData() != null; if (user == null) // create new one log.debug("add User " + jsuser.getName()); user = userManager.addUser(jsuser.getName(), jsuser.isMapped()); String pwdString = jsuser.getPwDataValue("password"); char [] pwdChars = (pwdString != null ? pwdString.toCharArray() : null); String password = recreatePassword(pwdChars); log.debug("storing password for " + jsuser.getName()); userManager.storePasswordCredential(pwc); pwc.setEnabled(jsuser.getPwDataValueAsBoolean("enabled")); pwc.setUpdateRequired(jsuser.getPwDataValueAsBoolean("requiresUpdate")); java.sql.Date d = jsuser.getPwDataValueAsDate("expirationDate"); if (d != null) pwc.setExpirationDate(d); log.error("setting userinfo for " + jsuser.getName() + " failed because of " + e.getLocalizedMessage()); List<Credential> listTemp = jsuser.getPrivateCredentials(); if ((listTemp != null) && (listTemp.size() > 0))
public void write(Object o, OutputElement xml) throws XMLStreamException { try { JSPrincipal p = (JSPrincipal) o; xml.setAttribute("type", p.getType()); xml.setAttribute("name", p.getName()); xml.setAttribute("mapped", p.isMapped()); xml.setAttribute("enabled", p.isEnabled()); xml.setAttribute("readonly", p.isReadonly()); xml.setAttribute("removable", p.isRemovable()); xml.setAttribute("extendable", p.isExtendable()); if (p.pwData != null) xml.add(p.pwData); if (p.secAttrs != null && p.secAttrs.size() > 0) { xml.add(p.secAttrs); } if (p.rules != null && p.rules.size() > 0) xml.add(p.rules); } catch (Exception e) { e.printStackTrace(); } }
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()); _jsPrincipal.setSecurityAttributes(principal.getSecurityAttributes().getAttributeMap());
String typeName = jsPrincipal.getType(); if (JetspeedPrincipalType.USER.equals(typeName)) String name = jsPrincipal.getName(); principal = principalManager.newPrincipal(name, jsPrincipal.isMapped()); JSSecurityAttributes jsSecAttrs = jsPrincipal.getSecurityAttributes(); if (jsSecAttrs != null)
private void exportUserPrincipalRules(JSSnapshot snapshot, Map<String,Object> settings, Logger log) throws SerializerException { // get Rules for each user for (JSPrincipal _user : snapshot.getPrincipals()) { if (JetspeedPrincipalType.USER.equals(_user.getType())) { Principal principal = _user.getPrincipal(); if (principal != null) { for (PrincipalRule p1 : pm.getRulesForPrincipal(principal)) { JSPrincipalRule pr = new JSPrincipalRule(p1.getLocatorName(), p1.getProfilingRule().getId()); _user.getRules().add(pr); } } } } }
public Date getPwDataValueAsDate(String key) { return getPwDataValueAsDate(key, null); }
public void setCredential(String name, char [] password, Date expirationDate, boolean isEnabled, boolean isExpired, boolean requireUpdate) { setName(name); this.pwData = new JSPWAttributes(); if (password != null) { String passwordString = (password.length > 0 ? new String(password) : ""); this.pwData.getMyMap().put("password", passwordString); if (expirationDate != null) { this.pwData.getMyMap().put("expirationDate",expirationDate.toString()); } this.pwData.getMyMap().put("enabled", Boolean.toString(isEnabled)); this.pwData.getMyMap().put("requiresUpdate", Boolean.toString(requireUpdate)); } }
private String putTokens(List<JSPrincipal> _list) { if ((_list == null) || (_list.size() == 0)) return ""; boolean _start = true; StringBuffer _sb = new StringBuffer(); for (JSPrincipal jsPrincipal : _list) { if (!_start) _sb.append(','); else _start = false; _sb.append(jsPrincipal.getName()); } return _sb.toString(); }
public Date getPwDataValueAsDate(String key, Date defValue) { Date value = null; String sv = getPwDataValue(key, null); if (sv != null) { value = Date.valueOf(sv); } return (value != null ? value : defValue); }
refs.getPrincipalMap(typeName).put(_tempPrincipal.getName(), _tempPrincipal); snapshot.getPrincipals().add(_tempPrincipal);
public boolean getPwDataValueAsBoolean(String key, boolean defValue) { String sv = getPwDataValue(key); return (sv != null ? Boolean.parseBoolean(sv) : defValue); }