Tuesday, September 4, 2012

OPSS security registration via REST

I had been playing around with an ADF application developed by the Fusion Middleware Architecture Group called ezShare. This worked great with the integrated LDAP provided by JDeveloper. But what I wanted to do was see if we could leverage OpenLDAP and configure it to possibly use in our future implementations.

We recently installed an openLDAP to test out a prototype we were working on. I was able to leverage the ldapDC (LDAP DataControl) provided in the ezShare sample application (referenced below).

ezShare Application Reference (OPSS Sample Application):

Since the application had some pre-built OPSS service calls I decided to write a REST service wrapper so that I could invoke the “createUserProfile()” method already built for me. I took the ldapDC project and put it in my ADF application. I modified it to include a new group (which is defined in my openLDAP) “homeowner.”

Once I was finished with that I created a simple java class called “registerUser.” I exposed it as a service by including the @Path(“registeruser”) above the class name. I then added a new method called “postRegister” which was exposed as an @POST method which @Produces (“text/plain”). I could have easily used application/json or another mime type. But I just wanted to output the results of the service call.

I have a simple HTML form that posts the REST parameters via:
 
Once it’s invoked you should see a success message. If you are interested in the prototype application you’ll need to make sure you have an LDAP environment set up and your LDAPAuthenticator configured in your security realm of your weblogic instance. Post your comments and questions here and I’ll be happy to help you.

Code