本文整理汇总了Java中com.icegreen.greenmail.pop3.Pop3State.authenticate方法的典型用法代码示例。如果您正苦于以下问题:Java Pop3State.authenticate方法的具体用法?Java Pop3State.authenticate怎么用?Java Pop3State.authenticate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.icegreen.greenmail.pop3.Pop3State
的用法示例。
在下文中一共展示了Pop3State.authenticate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import com.icegreen.greenmail.pop3.Pop3State; //导入方法依赖的package包/类
public void execute(Pop3Connection conn, Pop3State state,
String cmd) {
GreenMailUser user = state.getUser();
if (user == null) {
conn.println("-ERR USER required");
return;
}
String[] args = cmd.split(" ");
if (args.length < 2) {
conn.println("-ERR Required syntax: PASS <username>");
return;
}
try {
String pass = args[1];
state.authenticate(pass);
conn.println("+OK");
} catch (Exception e) {
conn.println("-ERR Authentication failed: " + e);
}
}
示例2: execute
import com.icegreen.greenmail.pop3.Pop3State; //导入方法依赖的package包/类
@Override
public void execute(Pop3Connection conn, Pop3State state,
String cmd) {
GreenMailUser user = state.getUser();
if (user == null) {
conn.println("-ERR USER required");
return;
}
String[] args = cmd.split(" ");
if (args.length < 2) {
conn.println("-ERR Required syntax: PASS <username>");
return;
}
try {
String pass = args[1];
state.authenticate(pass);
conn.println("+OK");
} catch (Exception e) {
conn.println("-ERR Authentication failed: " + e);
}
}