Skip to content

Commit 1f24426

Browse files
mchugunovmaibin
authored andcommitted
BAEL-2443: jsonview spring security (eugenp#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
1 parent 582bb8a commit 1f24426

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

spring-security-mvc-jsonview/src/main/java/com/baeldung/spring/SecurityJsonViewControllerAdvice.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ protected void beforeBodyWriteInternal(MappingJacksonValue bodyContainer, MediaT
3131
.collect(Collectors.toList());
3232
if (jsonViews.size() == 1) {
3333
bodyContainer.setSerializationView(jsonViews.get(0));
34+
return;
3435
}
3536
throw new IllegalArgumentException("Ambiguous @JsonView declaration for roles "+ authorities.stream().map(GrantedAuthority::getAuthority).collect(Collectors.joining(",")));
3637
}

0 commit comments

Comments
 (0)