我有两个类“用户资料”和“指纹资料”,它们都扩展了一个抽象类“资料”。
资料:
我的下一节课是用户资料。
看起来这个类很可疑,像这样检索密码似乎完全是错误的(即使get方法是私有的)。
当我创建我的FingerPrintProfile类时,似乎也会遇到同样的问题,因为它包含一个“FingerprintData”对象,它本质上也需要保密。
有人知道一种安全的方法,或者最好是一种解决这种情况的常用模式吗?
谢谢!
额外的问题:
我创建了一个抽象类,为两种类型的配置文件提供模板,似乎指纹数据和文本密码之间存在共同点。然而,不可能创建一个抽象字段“密码”,它可能是字符数组或FingerprintData对象。有什么想法吗?
/**
* Template for User profiles or Fingerprint profiles
*/
public abstract class Profile {
/**
* Profile Name
*/
private String name;
/**
* Profile id
*/
private int id;
/**
* Set the name of this profile
* @param name
*/
public void setProfileName(String name) {
this.name = name;
}
/**
* Set the id of this profile
* @param name
*/
public void setIdNumber(int id) {
this.id = id;
}
/**
* Get the name of this profile
*/
public String getProfileName() {
return name;
}
/**
* Get the id of this profile
*/
public int getIdNumber() {
return id;
}
}
我的下一节课是用户资料。
public class UserProfile extends Profile {
/**
* Users password
*/
private char[] password;
/**
* Set User password
* @param password
*/
public void setPassword(char[] password){
this.password = password;
}
/**
* Get User password
*/
public char[] getPassword(){
return password;
}
}
看起来这个类很可疑,像这样检索密码似乎完全是错误的(即使get方法是私有的)。
当我创建我的FingerPrintProfile类时,似乎也会遇到同样的问题,因为它包含一个“FingerprintData”对象,它本质上也需要保密。
有人知道一种安全的方法,或者最好是一种解决这种情况的常用模式吗?
谢谢!
额外的问题:
我创建了一个抽象类,为两种类型的配置文件提供模板,似乎指纹数据和文本密码之间存在共同点。然而,不可能创建一个抽象字段“密码”,它可能是字符数组或FingerprintData对象。有什么想法吗?