1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%
String userName= request.getHeader("auth-user");
String passwd=request.getHeader("auth-pass");
String protocol=request.getHeader("auth-protocol");
if(protocol!=null){
protocol=protocol.toLowerCase();
}
String server="192.168.0.9"; //根据用户的所在地,修改相应的邮件服务器内网IP
String port="25";
if ("imap".equals(protocol)) {
port="143";
}
else if ("smtp".equals(protocol)) {
port="25";
}else if ("pop3".equals(protocol)) {
port="110";
}
//连接LDAP或者其他方式,判断用户的账号密码是否正确,如果错误 response.setHeader("Auth-Status","ERROR");
response.setHeader("Auth-Status","OK");//用户账号密码正确
response.setHeader("Auth-Server",server);
response.setHeader("Auth-Port",port);
response.setHeader("Auth-Pass",passwd);
response.setHeader("Auth-User",userName);
%>
|