BAEL-2443: jsonview spring security (#6291)

* BAEL-2443: Implement filtering with @JsonView based on spring security role

* Cleanup test

* Rename tests

* Fix renaming roles after refactoring

* BAEL-2443: Restore return statement in controller advice
This commit is contained in:
Mikhail Chugunov 2019-02-06 20:37:22 +03:00 committed by maibin
parent 582bb8a3d5
commit 1f244261d0
1 changed files with 1 additions and 0 deletions

View File

@ -31,6 +31,7 @@ public class SecurityJsonViewControllerAdvice extends AbstractMappingJacksonResp
.collect(Collectors.toList());
if (jsonViews.size() == 1) {
bodyContainer.setSerializationView(jsonViews.get(0));
return;
}
throw new IllegalArgumentException("Ambiguous @JsonView declaration for roles "+ authorities.stream().map(GrantedAuthority::getAuthority).collect(Collectors.joining(",")));
}