package com.sidiw.util.jmail;
import javax.mail.Authenticator;
import javax.mail.PasswordAuthentication;
public class Auth extends Authenticator {
private String user, pwd;
public Auth(String user, String pwd) {
this.user = user;
this.pwd = pwd;
}
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(this.user, this.pwd);
}
}
此博客展示了一段Java代码,定义了一个名为Auth的类,继承自Authenticator,用于邮件认证。该类接收用户和密码作为参数,通过getPasswordAuthentication方法返回密码认证信息,属于Java后端开发相关内容。
8256

被折叠的 条评论
为什么被折叠?



