BadCredentialsException: Kerberos validation not succesfull

十年热恋 提交于 2019-11-29 10:58:54

I found the problem. Spring-security-kerbos requires path to keytab file as "Resource String" (details: http://static.springsource.org/spring/docs/3.0.x/reference/resources.html). When I set path as "file:/home/xxxxx/conf/krb5/krb5.keytab" then application runs but I think that it can't open the file later and Kerberos cant load any key. Unfortunately Log from Kerberos is not so clear.

When I set path as "/home/xxxxx/conf/krb5/krb5.keytab" I got the following exception

Caused by: java.io.FileNotFoundException: ServletContext resource [/home/xxxxx/conf/krb5/krb5.keytab] cannot be resolved to URL because it does not exist

Solution for this issue can be the fix in the file SunJaasKerberosTicketValidator.java:

private String keyTabLocation;

LoginConfig loginConfig = new LoginConfig(keyTabLocation, servicePrincipal, debug);

instead of:

private Resource keyTabLocation;

LoginConfig loginConfig = new LoginConfig(keyTabLocation.getURL().toExternalForm(), servicePrincipal, debug);

With this fix everything works. We can set path to file in format "/home/xxxxx/conf/krb5/krb5.keytab"

If someone knows more details about it, please write it here.

Panu

At least Java 7 is not (or, my version is not) able to handle the "file:" prefix: See this link. I had to make the same modification to Spring sources as you did. Thanks, this was helpful. Wasted half a week on trying different configurations.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!