Permission Sensitive Caching auth checker is not working in dispatcher
Hi,
I am doing the POC for Permission Sensitive Caching in dev environment and i have done the dispatcher configuration as per the below
/auth_checker
{
# request is sent to this URL with '?uri=<page>' appended
/url "/api/permissioncheck"
# only the requested pages matching the filter section below are checked,
# all other pages get delivered unchecked
/filter
{
/0000
{
/glob "*"
/type "deny"
}
/0001
{
/glob "/content/secure/*.html"
/type "allow"
}
}
# any header line returned from the auth_checker's HEAD request matching
# the section below will be returned as well
/headers
{
/0000
{
/glob "*"
/type "deny"
}
/0001
{
/glob "Set-Cookie:*"
/type "allow"
}
}
}
/cache
{
...
allowAuthorized “1”
...
}After doing the changes in dispatcher and done the restart iam not seeing the below message in dispatcher log
AuthChecker: initialized with URL ‘configured_url‘.
Due to this i couldnot able to validate my changes regarding PSC. Even i ignore the above message and wrote the servlet as below and validate in publisher logs it is not coming to the publisher server regarding Auth Checker
@8220494(service = Servlet.class,
property = {
"service.description= Auth checker Servlet",
"sling.servlet.paths=/api/permissioncheck",
"sling.servlet.methods=HEAD"
})
public class AuthcheckerServlet extends SlingSafeMethodsServlet {
private Logger logger = LoggerFactory.getLogger(this.getClass());
public void doHead(SlingHttpServletRequest request, SlingHttpServletResponse response) {
try{
//retrieve the requested URL
String uri = request.getParameter("uri");
//String authtoken = request.getParameter("authtoken");
//obtain the session from the request
Session session = request.getResourceResolver().adaptTo(javax.jcr.Session.class);
//perform the permissions check
try {
/* if (authtoken.equals("1111")) {
response.setStatus(SlingHttpServletResponse.SC_OK);
}*/
session.checkPermission(uri, Session.ACTION_READ);
logger.info("authchecker says OK");
response.setStatus(SlingHttpServletResponse.SC_OK);
} catch(Exception e) {
logger.info("authchecker says READ access DENIED!");
response.setStatus(SlingHttpServletResponse.SC_FORBIDDEN);
}
}catch(Exception e){
logger.error("authchecker servlet exception: " + e.getMessage());
}
}
}
Please help me what is the issue which is not executing the auth checker.
Thanks & Regards,
Kalyan