I am aware that swagger-ui
can be fully disabled using @Profile
on spring-boot
application but I still want certain privileged user to be able to access swagger-ui
and not fully disabled.
Is there a way to achieve this.
update:
currently I am using interceptor
approach but i don't want this approach.
@Override
public boolean preHandle(HttpServletRequest request,
HttpServletResponse response, Object handler) throws Exception {
if(request.getRequestURI().contains("swagger") &&
!request.isUserInRole("XX_YY_ZZ")) {
response.sendError(403, "You are not authorized to access "); }
return super.preHandle(request, response, handler);
}