开发者

Hibernate - encrypted reference by relations on usernames

开发者 https://www.devze.com 2023-01-07 17:57 出处:网络
I was wondering if my idea is possible with hibernate. What Iwant is that there is one table with usernames and every table wich has a reference to this ta开发者_如何学Pythonble has the username encr

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 ta开发者_如何学Pythonble 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

  • Security: Transparent encryption of persisted data (with Jasypt UserTypes)
0

精彩评论

暂无评论...
验证码 换一张
取 消