提交 9ba320f8 编写于 作者: K Kohsuke Kawaguchi

The filter can be left behind depending on the timing issue, so it

should clean up itself.
上级 8160324a
......@@ -557,16 +557,21 @@ public class HudsonPrivateSecurityRealm extends AbstractPasswordBasedSecurityRea
HttpServletRequest req = (HttpServletRequest) request;
if(req.getRequestURI().equals(req.getContextPath()+"/")) {
if(hasSomeUser()) {// the first user already created. the role of this filter is over.
if (needsToCreateFirstUser()) {
((HttpServletResponse)response).sendRedirect("securityRealm/firstUser");
} else {// the first user already created. the role of this filter is over.
PluginServletFilter.removeFilter(this);
chain.doFilter(request,response);
} else {
((HttpServletResponse)response).sendRedirect("securityRealm/firstUser");
}
} else
chain.doFilter(request,response);
}
private boolean needsToCreateFirstUser() {
return !hasSomeUser()
&& Hudson.getInstance().getSecurityRealm() instanceof HudsonPrivateSecurityRealm;
}
public void destroy() {
}
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册