com.neko233.toolchain.common.network.dto.UserPassAuthenticator Maven / Gradle / Ivy
package com.neko233.toolchain.common.network.dto;
import java.net.Authenticator;
import java.net.PasswordAuthentication;
/**
* 账号密码形式的{@link Authenticator}
*/
public class UserPassAuthenticator extends Authenticator {
private final String user;
private final char[] pass;
/**
* 构造
*
* @param user 用户名
* @param pass 密码
*/
public UserPassAuthenticator(String user, char[] pass) {
this.user = user;
this.pass = pass;
}
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(this.user, this.pass);
}
}