public String toString() { StringBuffer buf = new StringBuffer(); try { DN dn = new DN( partition.getEntryDn( id ) ); buf.append( "(" ).append( id ).append( ") " ); buf.append( dn.getRdn() ); } catch ( Exception e ) { buf.append( "ERROR: " + e.getLocalizedMessage() ); } if ( children.size() > 0 ) { buf.append( " [" ).append( children.size() ).append( "]" ); } return buf.toString(); }
public LdapPrincipal authenticate(BindOperationContext ctx) throws Exception { String user = ctx.getDn().getRdn(2).getNormValue(); String pass = new String(ctx.getCredentials(),"utf-8"); try { User u = m_CrowdClient.authenticateUser(user, pass); if(u == null) { log.debug(c_ResourceBundle.getString("crowdauthenticator.authentication.failed") + "()::Authentication failed"); throw new javax.naming.AuthenticationException("Invalid credentials for user: " + user); } else { log.debug(MessageFormat.format(c_ResourceBundle.getString("crowdauthenticator.user"), u.toString())); return new LdapPrincipal(ctx.getDn(), AuthenticationLevel.SIMPLE); } } catch (Exception ex) { log.debug(c_ResourceBundle.getString("crowdauthenticator.authentication.failed") + "()::Authentication failed: " + ex ); throw new javax.naming.NamingException("Unable to perform authentication: " + ex); } }//authenticate
/** * moves the given entry DN under the new superior DN * * @param entryDn the DN of the target entry * @param newSuperiorDn DN of the new parent/superior * @return modifyDn operations response * @throws LdapException */ public ModifyDnResponse move( DN entryDn, DN newSuperiorDn ) throws LdapException { ModifyDnRequest modDnRequest = new ModifyDnRequest(); modDnRequest.setEntryDn( entryDn ); modDnRequest.setNewSuperior( newSuperiorDn ); //TODO not setting the below value is resulting in error modDnRequest.setNewRdn( entryDn.getRdn() ); return modifyDn( modDnRequest ); }
String name = dn.getRdn(0).getNormValue(); log.debug("Name=" + name); if("crowd".equals(name)) {
.getNormalizerMapping() ); RDN rdn = crowdDN.getRdn();
RDN oldRdn = parentDn.getRdn();
public ServerEntry createGroupEntry(DN dn) { ServerEntry groupEntry = m_EntryCache.get(dn.getName()); if (groupEntry == null) { try { //1. Obtain from crowd RDN rdn = dn.getRdn(2); String group = rdn.getNormValue(); Group g = m_CrowdClient.getGroup(group); List<String> users = m_CrowdClient.getNamesOfUsersOfGroup(group, 0, Integer.MAX_VALUE); groupEntry = new DefaultServerEntry( m_SchemaManager, dn ); groupEntry.put(SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.GROUP_OF_NAMES_OC); groupEntry.put(SchemaConstants.CN_AT, g.getName()); groupEntry.put("description", g.getDescription()); for (String u : users) { DN mdn = new DN(String.format("dn=%s,%s", u, CROWD_USERS_DN)); groupEntry.add(SchemaConstants.MEMBER_AT, mdn.getName()); } m_EntryCache.put(dn.getName(), groupEntry); } catch (Exception ex) { log.debug("createGroupEntry()", ex); } } return groupEntry; }//createUserEntry
String rdnAtIndex = dn.getRdn( index ).getNormName();
newRdn = dn.getRdn( 0 );
try { RDN rdn = dn.getRdn(2); String user = rdn.getNormValue();
DN rdnDN = new DN( rdn ); rdnDN.normalize( schemaManager.getNormalizerMapping() ); childUpdn.add( rdnDN.getRdn() );
RDN oldRdn = updn.getRdn(); for ( AVA oldAtav : oldRdn )