8

Is there a way to find the username (User Principal Name or samaccountname) of the user who is using my app and is logged into an AD domain? Can we also find which domain is the user connected to programmatically?

dsconfigad -show command line does display the domain but not the username.

I cannot rely on NSUsername() or NSFullUserName() functions as user can manually change those.

Any help will be appreciable.

ZestyZest
  • 911
  • 13
  • 27
  • this bash example might give you a hint http://stackoverflow.com/questions/22277761/how-to-get-active-directory-domain-name-on-mac-via-terminal. Looks like the magic lies in using `dscl` – mgamba Aug 20 '16 at 03:18
  • here's a C# cookbook that might be helpful if the APIs are similar: http://www.codeproject.com/Articles/18102/Howto-Almost-Everything-In-Active-Directory-via-C#27 – mgamba Aug 20 '16 at 03:25

0 Answers0