Search code examples
javajakarta-eewebspherewebsphere-liberty

Detect if Websphere Liberty is secured?


We're trying to migrate from a traditional Websphere to Liberty profile. One of several issues that has come up is that under WAS, we use the class com.ibm.ws.security.core.SecurityContext to detect if the server's security is enabled by invoking isSecurityEnabled().

But this class is not found in Liberty and so creates errors. Is it in one of the features? I'm not sure how to find which one if so. If not, is there an equivalent technique for Liberty?


Solution

  • You can tell if security is enabled in Liberty if you've included the appSecurity-2.0 feature in your server.xml.

    Programmatically, you can call WSSecurityHelper.isServerSecurityEnabled() to find out if security is enabled on your Liberty Server