Hibernate - 用户名关系加密引用 [英] Hibernate - encrypted reference by relations on usernames
问题描述
我想要的是有一个表,用户名和每个表都有这个表的引用在列中加密了用户名。因此,用户名不能以普通文本形式显示,而是在每个具有用户表参考的表中进行加密。
所以我需要这样的东西:
@ManyToOne
@JoinColumn(name =userName,insertable = false,updatable = false,encrypted =md5)
public User getUser(){
return this.user;
}
public void setUser(User user){
this.user = user;
}
我希望我清楚。
您应该使用自定义的 UserType
和 Jasypt(Java简化加密)实际上提供了一套基本的可以满足您需要的Hibernate UserType
另请参阅
I was wondering if my idea is possible with hibernate.
What I want is that there is one table with usernames and every table wich has a reference to this table has the username encrypted in a column. So the username doesn't stand in normal text but encrypted in every table which have a reference to the user table.
So I need something like:
@ManyToOne
@JoinColumn(name = "userName", insertable=false, updatable=false, encrypted="md5")
public User getUser(){
return this.user;
}
public void setUser(User user ){
this.user = user;
}
I hope that I make myself clear.
You should implement this using a custom UserType
and Jasypt (Java Simplified Encryption) actually provides a basic set of Hibernate UserType
that may suit your needs.
See also
这篇关于Hibernate - 用户名关系加密引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!