Custom Authentication Provider in Web logic 12c

pubudu jayasanka
2 min readFeb 23, 2018

--

If you are using Weblogic Server and you need to create Weblogic custom authentication provider, I must say that you are in correct place. When I was reaching how to implement the OAuth in weblogic, I understood that It’s not possible implement OAuth 2 in weblogic because Weblogic 12c doesn’t provide any support to OAuth 2. So I had to create 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 maven implementation of Authentication.

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

First, add the 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 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 WebLogic mbeantype 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.

If you like this post, you can read more articles on my personal blog devpubba.com.

--

--

pubudu jayasanka
pubudu jayasanka

Written by pubudu jayasanka

Software Engineer at Creative Software

Responses (4)