irule LDAP query for FTP access

Hi, does anyone have an example of an irule used for authenticating users again an LDAP server and checking that they belong to a particular group? If these are true then I grant them FTP access, if not, then I reject it.

APM app tunnels seem like the best solution.