From 943f83a33fdbf9f9ee7b28bdd21795e074f04676 Mon Sep 17 00:00:00 2001 From: gowthaman Date: Fri, 10 May 2024 11:45:49 +0530 Subject: [PATCH] supress some log and add a log --- src/main/kotlin/com/restapi/AppAccessManager.kt | 9 +++++++++ src/main/kotlin/com/restapi/config/Auth.kt | 2 +- src/main/resources/logback.xml | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/com/restapi/AppAccessManager.kt b/src/main/kotlin/com/restapi/AppAccessManager.kt index de65e6b..68d65f7 100644 --- a/src/main/kotlin/com/restapi/AppAccessManager.kt +++ b/src/main/kotlin/com/restapi/AppAccessManager.kt @@ -60,6 +60,15 @@ class AppAccessManager : AccessManager { //if role is allowed, or enforcement is turned off or no roles are explicitly allowed handler.handle(ctx) } else { + logger.warn( + "entity - {}, action {}, user roles = {}, allowed = {}, isAllowed? {}, enforce? {}", + entity, + action, + currentRoles(), + allowedRoles, + isAllowed, + appConfig.enforceRoleRestriction() + ) ctx.status(HttpStatus.FORBIDDEN).result("user not allowed to do this") } } diff --git a/src/main/kotlin/com/restapi/config/Auth.kt b/src/main/kotlin/com/restapi/config/Auth.kt index a0f5039..9175412 100644 --- a/src/main/kotlin/com/restapi/config/Auth.kt +++ b/src/main/kotlin/com/restapi/config/Auth.kt @@ -229,7 +229,7 @@ object Auth { .gt("refreshExpiresAt", LocalDateTime.now()) .findList() .onEach { - logger.warn("valid authToken for ${authUser.userName} is ${it.authToken}") + logger.warn("valid authToken for ${authUser.userName} is ${it.authToken.substring(0..10)}") } .firstOrNull { it.authToken.equals(authToken, ignoreCase = true) diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml index ed0ecb9..c774523 100644 --- a/src/main/resources/logback.xml +++ b/src/main/resources/logback.xml @@ -22,6 +22,7 @@ +