Skip to content

Commit 401a1b4

Browse files
committed
Cosmetic changes, smarter logging for Principal.NULL_PRINCIPAL
1 parent 8996385 commit 401a1b4

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,8 @@ public static Mono<RequestContext> deferSecured() {
185185
if (LOGGER.isDebugEnabled()) {
186186
LOGGER.debug(
187187
"Insufficient permissions for secured method ({}): "
188-
+ "request context does not have principal",
188+
+ "request context ({}) does not have principal",
189+
context,
189190
context.methodInfo());
190191
}
191192
throw new ForbiddenException("Insufficient permissions");

services-api/src/main/java/io/scalecube/services/auth/Principal.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@
44

55
public interface Principal {
66

7-
Principal NULL_PRINCIPAL = new Principal() {};
7+
Principal NULL_PRINCIPAL =
8+
new Principal() {
9+
@Override
10+
public String toString() {
11+
return "NULL_PRINCIPAL";
12+
}
13+
};
814

915
default String role() {
1016
return null;

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,9 @@ private Mono<Principal> mapPrincipal(RequestContext context) {
249249
if (LOGGER.isDebugEnabled()) {
250250
LOGGER.debug(
251251
"Insufficient permissions for secured method ({}): "
252-
+ "request context does not have principal and principalMapper is also not set",
252+
+ "request context ({}) does not have principal "
253+
+ "and principalMapper is also not set",
254+
context,
253255
methodInfo);
254256
}
255257
throw new ForbiddenException("Insufficient permissions");

0 commit comments

Comments
 (0)