This is a quick post about how to log in programmaticallyagainst your WLS when working with ADF applications that are ADF Security enabled. The use case is simple; an ADF application with ADF Security Enabled with two pages. One of the pages is open to the world while other is only accessible to authenticated role. This is a 126.96.36.199 application but the same should work in other versions.
Now, the flow is simple, this is the adfc-config.xml;
In this case, home page is only available after authentication is done. Our Jazn-data looks like this:
Now, all magic happens on the login page and its managed bean;
Since this code was used in an old application, you can safely replace the deprecated method
SimpleCallbackHandler for URLCallbackHandler.
Our login page only shows, using the securityContext if the user is authenticated and what is the user’s user name.
Running the application, with a username and password that exists in the WLS auth provider;
And home page;