Skip to main content

How to register a RealmAuthenticationAdapter when using Endpoint.publish()

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
1 reply [Last post]
markus_franke
Offline
Joined: 2007-10-10

For testing purposes I want to create my WS with Endpoint.publish() instead deploying it in a real container. But there is one problem now: how to register a own com.sun.xml.wss.RealmAuthenticationAdapter?
According the thread "JAAS integration with third party container" (see http://forums.java.net/node/663477) a RealmAuthenticationAdapter is done as follows:
1. Implement your own RealmAuthentication class that extends the RealmAuthenticationAdapter.
2. Package the implementation class inside your WAR File
3. Create a META-INF/services entry (inside the WAR) for your RealmAuthenticator. The services file should be named as : com.sun.xml.xwss.RealmAuthenticator and the contents of the file should be the fully qualified package name of your RealmAuthenticator class.
But how to proceed with Endpoint.publish()? Is there a way to register such an adapter dynamically besides adding a file META-INF/services/com.sun.xml.xwss.RealmAuthenticator to the classpath with the desired content?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
markus_franke
Offline
Joined: 2007-10-10

I found a semi-perfect solution. The step 3 as mentioned above works also in a container-less scenario, i.e. with pure Endpoint.publish(). Just create a <folder>/META-INF/services/com.sun.xml.xwss.RealmAuthenticator entry and put <folder> into the classpath of the application.
But I still prefer a solution that achieves that programmatically ...