【发布时间】:2017-07-21 01:52:35
【问题描述】:
我有一个有两个域模型的应用程序 组织和票务问题。 经过身份验证的用户想要创建具有组织属性的票证来解决该问题 每个用户都允许这样的组织:
User1 对 Organization1 的许可
User2 允许 Organization2
TicketController.java 有创建票的保存方法。 我有这个漏洞:User1 可以使用具有 Organization2 的票证调用方法(没有权限)。 我正在使用 Hibernate 过滤器对 GET 方法中的数据进行授权,但我不知道如何保护用户想要持久且没有权限的数据??;
/ticket/save
{
id:-1,
organization:{
id:2,
title:'organization2' //not allowed this organization
}
}
@Entity
@Table(name = "core_organization_structure")
public class OrganizationStructure {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "title", nullable = false)
private String title;
}
@Entity
@Table(name = "core_Ticket")
public class Ticket {
..some prop
@ManyToOne
@JoinColumn(name = "org_id", nullable = false)
private OrganizationStructure org;
}
【问题讨论】:
标签: spring hibernate spring-security spring-security-acl