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.
you need to add commo.dtd file to resource directory. download file from this link.
Now we are going to create SampleAuthenticationProvider class.
Next, we are going implement SampleLoginModule.java class
Finally, you need to create LoginTypeCallback.java call to handle user callbacks.
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.