[BAEL-1411] Format code
This commit is contained in:
parent
1b7e6957bb
commit
2bac6f88e7
@ -10,6 +10,5 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@Target(ElementType.METHOD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@PreAuthorize("hasRole('VIEWER')")
|
||||
public @interface IsViewer
|
||||
{
|
||||
public @interface IsViewer {
|
||||
}
|
@ -52,7 +52,7 @@ public class UserRoleService {
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('SYS_ADMIN')")
|
||||
public String getUsernameInLowerCase(){
|
||||
public String getUsernameLC() {
|
||||
return getUsername().toLowerCase();
|
||||
}
|
||||
|
||||
@ -67,8 +67,8 @@ public class UserRoleService {
|
||||
return securityContext
|
||||
.getAuthentication()
|
||||
.getAuthorities()
|
||||
.stream().map(auth -> auth.getAuthority())
|
||||
.collect(Collectors.joining(","));
|
||||
.stream()
|
||||
.map(auth -> auth.getAuthority()).collect(Collectors.joining(","));
|
||||
}
|
||||
|
||||
@PostAuthorize("returnObject.username == authentication.principal.nickName")
|
||||
@ -83,8 +83,7 @@ public class UserRoleService {
|
||||
|
||||
@PreFilter(value = "filterObject != authentication.principal.username", filterTarget = "usernames")
|
||||
public String joinUsernamesAndRoles(List<String> usernames, List<String> roles) {
|
||||
return usernames.stream().collect(Collectors.joining(";"))
|
||||
+":"+roles.stream().collect(Collectors.joining(";"));
|
||||
return usernames.stream().collect(Collectors.joining(";")) + ":" + roles.stream().collect(Collectors.joining(";"));
|
||||
}
|
||||
|
||||
@PostFilter("filterObject != authentication.principal.username")
|
||||
|
@ -81,7 +81,7 @@ public class TestMethodSecurity{
|
||||
@Test
|
||||
@WithMockUser(username = "JOHN", authorities = { "SYS_ADMIN" })
|
||||
public void givenAuthoritySysAdmin_whenCallGetUsernameInLowerCase_thenReturnUsername() {
|
||||
String username = userRoleService.getUsernameInLowerCase();
|
||||
String username = userRoleService.getUsernameLC();
|
||||
assertEquals("john", username);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user