How to get a domain name for a user registered on Mac through Active Directory

In my Cocoa application, how can I get the current user domain when logging in through Active Directory?

I need to define two things:

  • If the current user is registered in the Active Directory domain (you only need to process Active Directory).
  • If 1, user domain.

I found links to Directory Services and the Open Directory Programming Guide, but the latter is only 10.6 (I must support 10.5+), and I could not find examples for the first, which gave me an idea of ​​what I needed to do.

+6
cocoa active-directory macos
source share
2 answers

dsconfigad -show

It will tell you if you are associated with a directory and information about that directory, if one is associated. Then you will learn how to script dscl.

+3
source share

I think you can use the same idea as here:

Mac OSX: determining if a user account is an Active Directory user and a local user using objective-c

you just need to search for Network or Authentication node (this is a type of kODNodeTypeAuthentication) and query for kODAttributeTypeRecordName with the request value set for the current username. Then look at the search result, there you will find many interesting things :)

+1
source share

All Articles