public Principal authenticate(HttpServletRequest hreq) {
try {
DigestParameterGenerator generator = DigestParameterGenerator.getInstance(DigestParameterGenerator.HTTP_DIGEST);
DigestAlgorithmParameter[] params = generator.generateParameters(new HttpAlgorithmParameterImpl(hreq));
Key key = null;
for(int i=0;i<params.length;i++){
DigestAlgorithmParameter dap = params[i];
if(A1.equals(dap.getName()) && (dap instanceof Key)){