title: How do I Get memberOf attribute from ldap DirContextOperations
body: <p>I am tring to get a list of groups a user is a member of, currently I can get most attributes as follows</p>
  
  <pre><code>CustomLdapUserDetails.Essence essence = new CustomLdapUserDetails.Essence();
  essence.setDn(dn);
  Object passwordValue = ctx.getObjectAttribute(passwordAttributeName);
  String givennameValue = (String)ctx.getObjectAttribute("givenname");
  String snValue = (String)ctx.getObjectAttribute("sn");
  String titleValue = (String)ctx.getObjectAttribute("title");
  essence.setFirstname(givennameValue);
  essence.setLastname(snValue);
  </code></pre>
  
  <p>but I cannot figure out how to get the memberOf attribute. If I output the whole DirContextOperations as a String I get the following</p>
  
  <pre><code>org.springframework.ldap.core.DirContextAdapter: dn=uid=emp123 {rdn=uid=emp123,
  whenCreated=20110816063203.0Z,
  objectCategory=CN=fompanyPerson,CN=Schema,CN=Configuration,CN={9F17F445-56C4-42D9-
  B7C6-B630FFEA7F07}, badPwdCount=0, otherTelephone=123-456789, businessUnit=IREIRE BU, 
  ntAccount=DMN1\emp123, managerID=emp987, objectGUID=5?
  ?e6A??????/, mail=emp123@somewhere.com, uid=emp123, companyWorkRelationship=EMP, 
  memberOf[0]=CN=ABC IREIRE,OU=AutoGroups,DC=entdir,DC=gtn,DC=com, 
  memberOf[1]=CN=azgEntJazzUsers,OU=AutoGroups,DC=entdir,DC=gtn,DC=com, companySite=DBL, 
  companyCostCenter=91827, companyBusinessGroup=IREIRE BG, ntDomain=DMN1, instanceType=4, 
  corpID=emp123, objectSid=  I???&amp;?C?k?J???????, st=XX, badPasswordTime=0, vdejoindn=P-
  ENTDIRXXX-1:uid=emp123,DC=entdirXXX,DC=gtn,DC=com, companySourceSystem=C-WORKSYSTEM, 
  objectClass[0]=top, objectClass[1]=person, objectClass[2]=organizationalPerson, 
  objectClass[3]=user, objectClass[4]=inetOrgPerson, objectClass[5]=fompanyPerson, 
  company=ABC DEV, name=emp123, sn=Smith, exchangeAlias=emp123, telephoneNumber=1-987-6543, 
  ntDomainRelative=DMN1, uSNChanged=999111, physicalDeliveryOfficeName=DXI, 
  ntAccountRelative=DMN1\emp123, cn=Smith, John, exchangeServer=someServer, 
  documentumUserName=Smith JOHN emp123, title=SOFTWARE ENGINEER/DEVELOPER, 
  otherCertMailbox=emp123@xyz.somewhere.com, msDS-UserAccountDisabled=TRUE, 
  managerName=Bloggs, Joe, givenName=John, uSNCreated=18418957, displayName=Smith, John, 
  pwdLastSet=629579433359695509, fompanyPersonStatus=A, whenChanged=20120266070711.0Z, 
  o=IREIRE BU, distinguishedName=uid=emp123,DC=entdirXXX,DC=gtn,DC=com, eDARevoke=N, 
  division=SEF-GL , manager=uid=emp987,DC=entdirXXX,DC=gtn,DC=com, 
  exchangeDirectory=SMXZG1DB, samAccountName=emp123, sametimeServer=cvxcluster}
  </code></pre>
  
  <p>What I need to get is the CN value of each memberOf into an array of Strings, I have tried:</p>
  
  <pre><code>ctx.getObjectAttribute("memberOf[1]"))
  ctx.getObjectAttribute("memberOf"))
  ctx.getObjectAttribute("memberOf=CN")) 
  </code></pre>
  
  <p>I've seen examples online of setting but I could not find any examples of getting, is it really that much more complex then getting the other Attributes? </p>
  
  <p>Any advice would be greatly appreciated</p>