Javamail,IMAP和Kerberos [英] Javamail, IMAP and Kerberos
问题描述
我正在使用javamail检查IMAP收件箱,此刻,我只是通过存储用户名和密码来登录IMAP服务器.但是,我们在工作中的安全政策要求对此加以刻板处理.
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.
我一直在阅读javamail,IMAP和kerberos,一些资源说这是不可能的,而另一些资源则认为有可能.不幸的是,我找不到任何示例来说明如何通过via进行连接. kerberos.
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.
我只是想知道是否有人可以确认/拒绝是否可以通过IMAP服务器进行连接. kerberos和javamail,如果有人遇到过可能有用的任何资源,将不胜感激.
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.
谢谢
马丁.
推荐答案
在Java 1.5或更高版本以及Kerberos v5中,通过设置 docs ),并使用
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.
对我来说幸运的是,我不受外部安全策略的束缚:-),所以我最终在SSL上使用了IMAP,这反而更加简单了.
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.
这篇关于Javamail,IMAP和Kerberos的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!