objectClassAttr.clear();
public void denormalizeEntryOpAttrs( Attributes entry ) throws NamingException { if ( isDenormalizeOpAttrsEnabled ) { AttributeType type = registry.lookup( "creatorsName" ); Attribute attr = AttributeUtils.getAttribute( entry, type ); if ( attr != null ) { LdapDN creatorsName = new LdapDN( ( String ) attr.get() ); attr.clear(); attr.add( 0, denormalizeTypes( creatorsName ).getUpName() ); } type = null; type = registry.lookup( "modifiersName" ); attr = null; attr = AttributeUtils.getAttribute( entry, type ); if ( attr != null ) { LdapDN modifiersName = new LdapDN( ( String ) attr.get() ); attr.clear(); attr.add( 0, denormalizeTypes( modifiersName ).getUpName() ); } } }
@Override public String addCredential(Credential credential) throws InvalidCredentialException { if (credential==null) { throw new InvalidCredentialException("null credential!"); } if (credential.getUserId()==null) { throw new InvalidCredentialException("null userId!"); } if (!(credential instanceof LoginPasswordCredential)) { throw new InvalidCredentialException("invalid credential instance: " + credential.getClass().getName() + ", only " + LoginPasswordCredential.class.getName() + " is supported!"); } try { Name userDN = builUserDn(credential.getUserId()); DirContextOperations ctxOps = ldapTemplate.lookupContext(userDN); Attributes allAttrs = ctxOps.getAttributes(); Attribute passAttr = allAttrs.get(JoomlaLDAPConstants.PASSWD_ATTR_NAME); passAttr.clear(); passAttr.add(passwordHasher.hash(((LoginPasswordCredential) credential).getPassword())); ldapTemplate.modifyAttributes(userDN, new ModificationItem[] { new ModificationItem(DirContext.REPLACE_ATTRIBUTE, passAttr)}); return null; } catch (NameNotFoundException e) { throw new InvalidCredentialException("user " + credential.getUserId() + " not found!"); } }
} else { attr2modify.clear(); if (item.getAttribute().size() > 1) { for (int j = 0; j < item.getAttribute().size(); j++) {