【问题标题】:Spring Security 3.0- Customise basic http Authentication DialogSpring Security 3.0 - 自定义基本 http 身份验证对话框
【发布时间】:2011-02-15 02:29:51
【问题描述】:

而不是阅读;

http://localhost:8080 正在请求用户名和密码。该网站说:“Spring Security Application”

我想更改提示,或者至少更改“网站所说”的内容。有谁知道如何通过 resources.xml 做到这一点?

在我的Grails App Spring配置中,我当前的版本如下;

<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/security"
    xmlns:beans="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
                        http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd">
    <http auto-config="true" use-expressions="true">
        <http-basic/>
        <intercept-url pattern="/**" access="isAuthenticated()" />
    </http>

    <authentication-manager alias="authenticationManager">
        <authentication-provider>
            <user-service>
                <user name="admin" password="admin" authorities="ROLE_ADMIN"/>
            </user-service>
        </authentication-provider>
    </authentication-manager>
</beans:beans>

【问题讨论】:

    标签: grails spring-security


    【解决方案1】:

    你无法改变它。您的应用程序仅向浏览器发送“Spring Secuirty Application”部分。提示的其他部分由您的浏览器添加。

    要更改“Spring Security Application”部分,您可以使用&lt;http&gt; 元素的realm 属性:

    <http realm = "My Application" ... >
    

    【讨论】:

    • 太棒了,正是我需要的。谢谢。
    猜你喜欢
    • 2011-02-11
    • 2013-01-11
    • 2012-05-08
    • 2014-04-20
    • 2014-12-13
    • 1970-01-01
    • 2016-08-05
    • 2020-12-05
    • 2015-04-27
    相关资源
    最近更新 更多