Skip to content

Commit 8f5e6d3

Browse files
committed
Enhanced audit logging
1 parent 85a32cb commit 8f5e6d3

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

services-api/src/main/java/io/scalecube/services/RequestContext.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ public static Mono<RequestContext> deferSecured() {
184184
if (!context.hasPrincipal()) {
185185
if (LOGGER.isDebugEnabled()) {
186186
LOGGER.debug(
187-
"Insufficient permissions for secured method ({}): "
187+
"Insufficient permissions for secured method ({}) -- "
188188
+ "request context ({}) does not have principal",
189189
context,
190190
context.methodInfo());
@@ -198,9 +198,10 @@ public static Mono<RequestContext> deferSecured() {
198198
if (!methodInfo.allowedRoles().contains(principal.role())) {
199199
if (LOGGER.isDebugEnabled()) {
200200
LOGGER.debug(
201-
"Insufficient permissions for secured method ({}): "
202-
+ "principal role is not allowed (principal: {})",
201+
"Insufficient permissions for secured method ({}) -- "
202+
+ "principal role '{}' is not allowed (principal: {})",
203203
context.methodInfo(),
204+
principal.role(),
204205
principal);
205206
}
206207
throw new ForbiddenException("Insufficient permissions");
@@ -210,11 +211,11 @@ public static Mono<RequestContext> deferSecured() {
210211
if (!principal.hasPermission(allowedPermission)) {
211212
if (LOGGER.isDebugEnabled()) {
212213
LOGGER.debug(
213-
"Insufficient permissions for secured method ({}): "
214-
+ "allowed permission: {} is missing (principal: {})",
214+
"Insufficient permissions for secured method ({}) -- "
215+
+ "allowed permission '{}' is missing (principal: {})",
215216
context.methodInfo(),
216217
allowedPermission,
217-
principal.role());
218+
principal);
218219
}
219220
throw new ForbiddenException("Insufficient permissions");
220221
}

services-api/src/main/java/io/scalecube/services/methods/ServiceMethodInvoker.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ private Mono<Principal> mapPrincipal(RequestContext context) {
240240
} else {
241241
if (LOGGER.isDebugEnabled()) {
242242
LOGGER.debug(
243-
"Insufficient permissions for secured method ({}): "
243+
"Insufficient permissions for secured method ({}) -- "
244244
+ "request context ({}) does not have principal "
245245
+ "and principalMapper is also not set",
246246
context,

0 commit comments

Comments
 (0)