简体   繁体   English

在jhipster中通过id限制URL访问控制

[英]Restrict URL access control by id in jhipster

I have a problem that each user can retrieve other users data from URL.我有一个问题,每个用户都可以从 URL 检索其他用户的数据。

For instance, I have a rest api like this:例如,我有一个 rest api 这样的:

@GetMapping("/getFindByPersonId/{perId}")
@Timed
public List<ComboVahedAmoozeshi> getFindBySkhsIdCombo(@PathVariable Long perId){
    return comboVahedAmoozeshiRepository.getFindBySkhsIdCombo(perId);
}

After authorization, each user can change id and get other users data like the image below:授权后,每个用户都可以更改id并获取其他用户的数据,如下图所示:

在此处输入图像描述

Is there any suggestion to restrict each user to don`t have access to call the method?是否有任何建议限制每个用户无权调用该方法? Or Jhipster have any options to use UUId to hide id?或者 Jhipster 有使用 UUId 隐藏 id 的选项吗?

Thanks from @atomferede for the right answer.感谢@atomferede 的正确答案。 I have to add jhi_user_id in other entities and used @postfilter annotation to limit user's access to data.我必须在其他实体中添加 jhi_user_id 并使用 @postfilter 注释来限制用户对数据的访问。 Although, maybe it`sa good idea to have this option in jhipster generator to enhance the security level and faster implementation.虽然,在 jhipster 生成器中使用此选项以提高安全级别和加快实施速度可能是个好主意。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM