【发布时间】:2012-12-19 15:22:06
【问题描述】:
我有两个类“User Profile”和“FingerprintProfile”,它们扩展了一个抽象类“Profile”。
简介:
/**
* 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;
}
}
我的下一堂课是 UserProfile
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方法是private)。
在制作我的 FingerPrintProfile 类以及拥有一个“FingerprintData”对象时,我似乎将面临同样的问题,该对象本身也需要安全。
有没有人知道一种安全的方法,或者最好是人们用来解决这种情况的一种模式?
谢谢!
奖金问题
我创建了抽象类来为两种类型的配置文件提供模板,指纹数据和文本密码之间似乎存在共同点。但是,不可能创建一个可能是 char 数组或 FingerprintData 对象的抽象字段“密码”。有任何想法吗??
【问题讨论】:
-
密码加密了吗?
-
不是密码没有加密,你看的是我现在的开发阶段。
标签: java design-patterns passwords abstract-class password-protection