Hi @akshaybhujbale Sling Engine will take care of permissions if you register servlet using Resource Type.
Users who cannot access a particular resource will not be able to invoke the servlet.
Path-bound servlets cannot be access controlled using the default JCR repository ACLs.
Reference - https://sling.apache.org/documentation/the-sling-engine/servlets.html#example-registration-by-resour...
@Component(service = Servlet.class)
@SlingServletResourceTypes(
resourceTypes = "services/testServlet",
methods = { HttpConstants.METHOD_GET }
)
@ServiceDescription("Test Servlet")
public class TestServlet extends SlingAllMethodsServlet {
@Override
protected void doGet(final SlingHttpServletRequest request, final
SlingHttpServletResponse response)
throws ServletException, IOException {
// business-logic over here
}
}
Hope this helps!
Thanks