• +94712452807
  • pubudu2013101@gmail.com
  • No 39, 2nd Lane, Dikhenapura, Horana
Authentication
Custom Authentication Provider in Web logic 12c

Custom Authentication Provider in Web logic 12c

If you are using Weblogic Server and you need to create a Weblogic custom authentication provider, I must say that you are in right place. When I was reaching how to implement the OAuth in WebLogic, I understood that It’s not possible to implement OAuth 2 in WebLogic because Weblogic 12c doesn’t provide any support to OAuth 2. So I had to create a new custom authentication provider in order to achieve Auth 2 implementation.

Creating a Custom Authentication Provider

There were several ways of implementing custom authentication providers in WebLogic. but after trying a lot of ways, the only way which was successfully worked is the maven implementation of Authentication.

As a first step you need to create basic maven project. After you created maven project, edit your pom.xml as follow.

First add following dependencies to pom.xml file.

Add following properties to pom.xml

Next, Add following build files to pom.xml

Then next step would be adding a profile for Linux users

Now we have successfully edited the pom.xml file. Our next step is to create CustomAuthentication.xml file inside the resource directory.

CustomAuthentication.xml

you need to add commo.dtd file to resource directory. download file from this link.

Now we are going to create SampleAuthenticationProvider class.

SampleAuthenticationProvider.java

Next, we are going implement SampleLoginModule.java class

SampleLoginModule.java

Finally, you need to create LoginTypeCallback.java call to handle user callbacks.

LoginTypeCallback.java

Now we have implemented a fully working authentication provider. If you do maven install, you will be able to see that your custom authentication provider is created in the target file. You need to copy this file to the WebLogic MBean type folder (This, we have done automatically using our pom.xml file).

Mbeantypes location : ../wlserver/server/lib/mbeantypes

Finally, restart the server. Now you can see your created custom authentication provider in the WebLogic authentication providers list.

Leave a Reply

Your email address will not be published.