Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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>
like image 654
gav Avatar asked May 03 '10 15:05

gav


1 Answers

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" ... >
like image 56
axtavt Avatar answered Sep 28 '22 08:09

axtavt