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