2010-05-03 147 views
6

而不是閱讀;Spring Security 3.0-自定義基本http身份驗證對話框

http://localhost:8080正在請求用戶名和密碼。該網站說:「彈簧安全應用程序」

我想改變提示,或至少改變「網站說」。有誰知道如何通過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> 

回答

9

你不能改變它。您的應用程序僅向瀏覽器發送「Spring安全應用程序」部分。提示的其他部分由您的瀏覽器添加。

要更改「Spring Security的應用程序」的一部分,你可以使用realm屬性<http>元素:

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

歡呼聲讓我知道。 – gav 2010-05-03 16:33:36

+0

真棒,正是我需要的。感謝名單。 – 2011-03-30 08:24:24

相關問題