I am trying to find out if it is possible to do proxy authentication in Java using jetty. I have been able to do basic and digest authentication schemes using jetty and there are easy ways in Jetty to set up these authentication schemes using pseudo code as this:
constraint = org.mortbay.jetty.security.Constraint();
constraint.setName(constraint.('__BASIC_AUTH'))
constraint.setRoles({'admin'});
constraint.setAuthenticate(true);
constraintMapping = ConstraintMapping();
constraintMapping.setConstraint(constraint);
constraintMapping.setPathSpec('/*');
securityHandler = SecurityHandler();
securityHandler.setUserRealm(myrealm);
securityHandler.setConstraintMappings(constraintMapping );
Similarly for DIGEST authentication __BASIC_AUTH can be replaced with __DIGEST_AUTH. I am using HttpServlets to handle requests/responses. However if I want to achieve proxy based authentication, how do I do this?
Do I need to use the httpservlet's doGet() and attempt authentication and explicit forwarding to another address or is there a way using jetty itself to setup a proxy based authentication(or a proxy localhost server) as shown in the pseudo above?
Can I get some help for code to do proxy based authentication that authenticates and forwards HttpServlet requests to another servlet/server?