I am working on spring boot application. Authorization of rest calls is something that is task common for all requests in the project - there might be a few groups but not that many. Therefore I think it's a good idea to move it to some sort of interceptors to avoid code duplication and/or to not forget to check for access rights.
In my project I have the endpoint that in a basic scenario requires pretty basic access rights. However, based on some conditions the business logic requires to take an extra step that is an endpoint on its own and requires elevated privileges. I am tempted to just call the endpoint from my own service.
Just to clarify - I know that in normal scenario I could just abstrace the code of this "subendpoint" to a function and call it directly. However if I want this authorization check which we achieve via interceptors to be triggered I think there is no other way than to do a self-rest-call. Or maybe I'm wrong and there is a method in SpringBoot to call all the pre-controller checks without actually issuing an http call?