Merge branch 'master' into audit-be-minor-refactoring

This commit is contained in:
Ilya Kuramshin 2023-08-01 19:07:32 +04:00 committed by GitHub
commit 24381904b3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -51,6 +51,8 @@ import reactor.core.publisher.Mono;
@Slf4j
public class AccessControlService {
private static final String ACCESS_DENIED = "Access denied";
@Nullable
private final InMemoryReactiveClientRegistrationRepository clientRegistrationRepository;
private final RoleBasedAccessControlProperties properties;
@ -97,6 +99,17 @@ public class AccessControlService {
return Mono.empty();
}
if (CollectionUtils.isNotEmpty(context.getApplicationConfigActions())) {
return getUser()
.doOnNext(user -> {
boolean accessGranted = isApplicationConfigAccessible(context, user);
if (!accessGranted) {
throw new AccessDeniedException(ACCESS_DENIED);
}
}).then();
}
return getUser()
.doOnNext(user -> {
boolean accessGranted =
@ -113,7 +126,7 @@ public class AccessControlService {
&& isAuditAccessible(context, user);
if (!accessGranted) {
throw new AccessDeniedException("Access denied");
throw new AccessDeniedException(ACCESS_DENIED);
}
})
.then();