开发者

Spring Security 3.0- Customise basic http Authentication Dialog

Rather than reading;

A user name and password are being requested by http://localhost:8080. The site says: "Spring Security Application"

I want to change the prompt, or at least change what the "site says". Does anyone know how to do this via resources.xml?

In my Grails App Spring configuration, my current version is as follows;

<?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>


You can't change it. Your application sends to the browser only the "Spring Secuirty Application" part. Other parts of the prompt are added by you browser.

To change the "Spring Security Application" part, you can use realm attribute of the <http> element:

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜