⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 imapauthenticator.java

📁 支持IMAP/POP3协议的webmail源码
💻 JAVA
字号:
/* $Id: IMAPAuthenticator.java,v 1.1.1.1 2002/10/02 18:41:44 wastl Exp $ */import net.wastl.webmail.server.*;import net.wastl.webmail.exceptions.*;import javax.mail.*;import net.wastl.webmail.config.*;import java.util.*;/** * IMAPAuthenticator.java * * * Created: Mon Apr 19 12:03:53 1999 * * @author Sebastian Schaffert * @version */public class IMAPAuthenticator extends net.wastl.webmail.server.Authenticator {    public final String VERSION="1.2";    private Store st;    private Storage storage;    public IMAPAuthenticator() {	super();    }    public String getVersion() {	return VERSION;    }    public void init(Storage store) {	storage=store;	Session session=Session.getDefaultInstance(System.getProperties(),null);	try {	    st=session.getStore("imap");	} catch(NoSuchProviderException e) {	    e.printStackTrace();	}    }	    public void register(ConfigScheme store) {	key="IMAP";	store.configAddChoice("AUTH",key,"Authenticate against an IMAP server on the net. Does not allow password change.");    }        public void authenticatePreUserData(String user,String domain,String passwd)     throws InvalidPasswordException { 	super.authenticatePreUserData(user,domain,passwd);	WebMailVirtualDomain vd=storage.getVirtualDomain(domain);	String authhost=vd.getAuthenticationHost();	try {	    st.connect(authhost,user,passwd);	    st.close();	    storage.log(Storage.LOG_INFO,"IMAPAuthentication: user "+user+			" authenticated successfully (imap host: "+authhost+").");	} catch(MessagingException e) {	    storage.log(Storage.LOG_WARN,"IMAPAuthentication: user "+user+			" authentication failed (imap host: "+authhost+").");	    //e.printStackTrace();	    throw new InvalidPasswordException("IMAP authentication failed!");	}    }    public boolean canChangePassword() {	return false;    }} // IMAPAuthenticator

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -