我使用Spring Security
(版本3.0.5.RELEASE
)。这是我的XML配置设置:
<security:http>
<security:http-basic/>
</security:http>
当我尝试访问系统时,Spring向我提供了一条消息:
A username and password are being requested by http://localhost:8080. The site says "Spring Security Application"
我想将消息Spring Security Application
更改为另一封消息。我试图使用处理程序:
<security:access-denied-handler ref="accessDeniedHandler"/>
我的Java bean:
public class MyAccessDeniedHandler implements AccessDeniedHandler {
@Override
public void handle(HttpServletRequest req, HttpServletResponse resp, AccessDeniedException exception) throws IOException, ServletException {
resp.setHeader("WWW-Authenticate", "Basic realm=\"My authenticate\"");
}
}
但它不起作用。如何更改消息?
UPD
标题中的问题。它包含下一个ket值:WWW-Authenticate:Basic realm="Spring Security Application"
。即使我设置auto-config <security:http auto-config="true">
,我的代码也不起作用。
答案 0 :(得分:0)
有一个属性:
<security:http realm="My authenticate">
<security:http-basic/>
</security:http>