Spring Data Rest: Security based projection

后端 未结 3 1813
日久生厌
日久生厌 2020-12-04 11:46

I am using the current version of Spring Data Rest and Spring Data JPA and have following entity:

public class User {
    @Id
    @GeneratedValue
    private         


        
3条回答
  •  北海茫月
    2020-12-04 12:18

    You can also do it using a RegexRequestMatcher in your Spring Security config like this:

    .regexMatchers(HttpMethod.GET,"/user/.*projection=simple.*").hasRole("ROLE_ADMIN")
    

提交回复
热议问题