Been trying to understand how to work with the spel expressions.
@PostMapping("/wtf")
@PreAuthorize("partOfBU(businessUnitDTO.id())")
public ResponseEntity<Object> aaa(@RequestBody BusinessUnitDTO businessUnitDTO){
return new ResponseEntity<>(HttpStatus.OK);
}
rn I have this method. Inside the @PreAuthorize this is a spel expression.
ExpressionParser parser = new SpelExpressionParser();
Expression expression = parser.parseExpression(invocation.getMethod().getAnnotation(PreAuthorize.class).value());
parser.parseExpression(expression.getExpressionString()).getValue(this);
I really have no idea what I'm really doing with this. All I know is I'm calling the method inside (which is what I was trying to do).
The problem is the expression is coming back as partOfBU(bussinessDTO.id()) and not partOfBU(1) for example (Yes the object is correctly de-serialized and everything. I've debugged it way to many times at this point). Anyone who has any idea?
)