Aspect modified
This commit is contained in:
parent
03f63ca3ad
commit
405ba6329a
|
@ -47,7 +47,7 @@ public class AuthorizationAspect {
|
||||||
}
|
}
|
||||||
List<String> allowedRoles = Arrays.asList(authAnn.allowedRoles());
|
List<String> allowedRoles = Arrays.asList(authAnn.allowedRoles());
|
||||||
if (authAnn.allowedRoles().length!=0 && userRoles.stream().filter(i -> allowedRoles.contains(i)).collect(Collectors.toList()).isEmpty()) {
|
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;
|
throw ex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue