Search code examples
kerberosjava-11gssapi

Java 11: Kerberos using GSS API


I'm upgrading a project to Java 11. I realized that some of the internal packages such as sun.security.krb5.Config & sun.security.krb5.KrbException are no longer "visible" due to modules. Few examples of how the codebase is consuming these packages are below:

Exception cause = ExceptionUtils.findCause(ne, KrbException.class);

LoginException le = (LoginException) ne.getCause();
                if (le.getCause() instanceof KrbException) {
                    KrbException ke = (KrbException) le.getCause();

try {
                    sun.security.krb5.Config.refresh();
                } catch (KrbException e) {
//log something
}

I read that these internal packages are supposed to be implemented using GSS APIs.

I have been going through the GSS classes and tutorials but couldn't find anything on replacing the internal packages mentioned above.


Solution

  • Take the LoginException as-is. JAAS is supposed to abstract from everything. You just have bad code.