Firstly you will need to setup Active Directory so that you can run and test your code.
If (like me) you don't have a machine with Windows Server no worries, this is how you can set up Active Directory even on Mac OSX.
The first thing you want to do is set up a user a in AD. Make sure that when you set up the user he doesn't have to change his password on the first login or you will get an LDAP error from your Java code.
Clearly you can change your code to prompt a password change but just something to be aware of.
Also create a couple of groups for your user and add them to their profile.
In the code below there is just one method, authenticate. It that takes as parameters a user, password and domain and returns a list of groups of which the user is a member. If the user does not exist or there is a problem with the password an exception is thrown.
The code is fairly self explanatory and you can use it as a template to experiment with adding different attributes to the search.
Showing posts with label Active Directory. Show all posts
Showing posts with label Active Directory. Show all posts
Tuesday, 23 June 2015
Friday, 12 June 2015
Tutorial : Setting up Active Directory on a Mac OSX
Recently I has to write some Java code to integrate with ActiveDirectory.
My first problem was setting up an environment on my machine (a MBP) where I could test my code.
Turns out this is not too tricky if you follow the right steps.
1) Install VirtualBox (Here's a blog I wrote on this subject)
2) Download and install Windows Server 2012 (This link for 180 day free eval period) into VirtualBox.
3) Before you start Windows Server 2012 run this command on your Mac (This took me a while to figure out):
VBoxManage setextradata 2012Server VBoxInternal/CPUM/CMPXCHG16B 1
4) Once Windows 2012 is installed you need to setup ActiveDirectory. Carefully follow the directions in this excellent tutorial.
And there you have it Active Directory running on your Mac.
In the next article I'll post the Java code you need to connect to Active Directory.
My first problem was setting up an environment on my machine (a MBP) where I could test my code.
Turns out this is not too tricky if you follow the right steps.
1) Install VirtualBox (Here's a blog I wrote on this subject)
2) Download and install Windows Server 2012 (This link for 180 day free eval period) into VirtualBox.
3) Before you start Windows Server 2012 run this command on your Mac (This took me a while to figure out):
VBoxManage setextradata 2012Server VBoxInternal/CPUM/CMPXCHG16B 1
4) Once Windows 2012 is installed you need to setup ActiveDirectory. Carefully follow the directions in this excellent tutorial.
And there you have it Active Directory running on your Mac.
In the next article I'll post the Java code you need to connect to Active Directory.
Subscribe to:
Comments (Atom)
