Include tracking information about a client session in an LDAP operation. See Draft RFC.
Using the Session Tracking Control
When binding and the user is not yet known
Connectionconn=DefaultConnectionFactory.getConnection("ldap://directory.ldaptive.org");try{conn.open();BindOperationbind=newBindOperation(conn);BindRequestrequest=newBindRequest("uid=dfisher,ou=people,dc=ldaptive,dc=org",newCredential("password"));request.setControls(newSessionTrackingControl("151.101.32.133",// client IP address"hostname.domain.com",// client host name, empty string if unknownSessionTrackingControl.USERNAME_ACCT_OID,// must assign an OID even if using an empty identifier""));// empty tracking identifierbind.execute(request);}finally{conn.close();}
When searching and the user is known
Connectionconn=DefaultConnectionFactory.getConnection("ldap://directory.ldaptive.org");try{conn.open();SearchOperationsearch=newSearchOperation(conn);SearchRequestrequest=newSearchRequest("dc=ldaptive,dc=org",newSearchFilter("(givenName=daniel)"));request.setControls(newSessionTrackingControl("151.101.32.133",// client IP address"hostname.domain.com",// client host name, empty string if unknownSessionTrackingControl.USERNAME_ACCT_OID,"dn:uid=dfisher,ou=people,dc=ldaptive,dc=org"));SearchResultresult=search.execute(request).getResult();for(LdapEntryentry:result.getEntries()){// do something useful with the entries}}finally{conn.close();}
Provider Support
JNDI
JLDAP
Apache LDAP
UnboundID
OpenDJ
✓
✓
✗
✓
✓
✓
Functionality exists in the provider API and has been confirmed
✗
Functionality does not exist in the provider API
✶
Functionality exists in the provider API, but did not work in our test environment
?
Functionality exists in the provider API, but has not been integrated into the ldaptive provider