Aspect modified

This commit is contained in:
lucio 2020-01-23 11:23:25 +01:00
parent 03f63ca3ad
commit 405ba6329a
1 changed files with 1 additions and 1 deletions

View File

@ -47,7 +47,7 @@ public class AuthorizationAspect {
}
List<String> allowedRoles = Arrays.asList(authAnn.allowedRoles());
if (authAnn.allowedRoles().length!=0 && userRoles.stream().filter(i -> allowedRoles.contains(i)).collect(Collectors.toList()).isEmpty()) {
RuntimeException ex = authAnn.exception().getConstructor(Throwable.class).newInstance(new AuthorizationException(String.format("user %s not allowed to call method %s (role non allowed)", userId, method.getName())));
RuntimeException ex = authAnn.exception().getConstructor(Throwable.class).newInstance(new AuthorizationException(String.format("user %s not allowed to call method %s (role not valid)", userId, method.getName())));
throw ex;
}
}