Javamail, IMAP and Kerberos

拜拜、爱过 提交于 2020-01-02 19:28:49

问题


I'm using javamail to check an IMAP inbox, and at the moment I'm simply logging into the IMAP server by storing the username and password. Our security policy at work requires this to be kerberised however.

I've been reading up on javamail, IMAP and kerberos, and some resources say it isn't possible, whilst others suggest it is possible. And unfortunately I couldn't find any examples showing how to connect via. kerberos.

I was just wondering if anybody could confirm/deny whether it is possible to connect to an IMAP server via. kerberos with javamail, and if anybody has come across any resources that may be useful it would be very much appreciated.

Thanks,

Martin.


回答1:


It's theoretically possible in Java 1.5 or higher and Kerberos v5 by setting mail.imap.sasl.mechanisms property of JavaMail IMAP provider to GSSAPI (docs) and using JAAS and Java GSS API for authentication, but it's an absolute bitch to implement.

I went through the above links as well as this tutorial and I kind of got it to work in dev environment, but the result was extremely brittle. Now I'm not implying that is Sun's implementation fault - I'm quite sure it's mine; but the lack of available examples is suggesting that this may not be a time-tested production-ready solution.

Luckily for me, I'm not bound by external security policies :-) so I ended up using IMAP over SSL instead which is infinitely more straightforward.



来源:https://stackoverflow.com/questions/1282279/javamail-imap-and-kerberos

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