scalecube-services
scalecube-services copied to clipboard
Enhance/Refactor ServiceMethodInvoker.mapPrincipal()
-
Even if method is not secured - still apply
principalMapper.map(context)(if mapper is present) -
Simplify
return Mono.defer(() -> principalMapper.map(context))
.switchIfEmpty(Mono.just(context.principal()));
to
return Mono.defer(() -> principalMapper.map(context))
Let client worry about what to return in the mapper. Don't make scalecube to "fallback" something if it was null.
-
Refactor
io.scalecube.services.RequestContext#toString -
Fix bug in audit log:
if (!context.hasPrincipal()) {
LOGGER.warn(
"Insufficient permissions for secured method ({}) -- "
+ "request context ({}) does not have principal",
context,
context.methodInfo());
throw new ForbiddenException("Insufficient permissions");
}