Jetty - Basic Auth sending 403 instead of 401 while configuring Gerrit -
i have war file (specifically, gerrit.war), expects container (specifically, jetty) handle basic http authentication , pass information down webapp. don't have access code or web.xml file.
i'm following these instructions use exiting jetty configs wrap gerrit in realm, when access base url (/login/) 403 (forbidden) error. i'd expect 401 prompt browser ask credentials (no?)
i can post files haven't changed example above. let me know if help, however..
there many ways in can occur. in case occured because constraint did not have role set. code generated 403:
private void secureservlet(servletcontexthandler handler) { constraintsecurityhandler security = new constraintsecurityhandler(); security.setrealmname(this.realm); security.setauthenticator(new basicauthenticator()); security.setloginservice(new webloginservice(this.engine)); constraint constraint = new constraint(); constraint.setname(constraint.__basic_auth); //constraint.setroles(new string[]{"user"}); constraint.setauthenticate(true); constraintmapping mapping = new constraintmapping(); mapping.setconstraint(constraint); mapping.setpathspec("/*"); security.addconstraintmapping(mapping); handler.setsecurityhandler(security); } commenting in role line prompt jetty answer 401:s instead.
Comments
Post a Comment