Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 基于登录表单的Spring3安全性_Java_Xml_Spring Mvc_Spring Security - Fatal编程技术网

Java 基于登录表单的Spring3安全性

Java 基于登录表单的Spring3安全性,java,xml,spring-mvc,spring-security,Java,Xml,Spring Mvc,Spring Security,我正在使用spring安全性进行身份验证登录。 我想在名称和密码中传递动态值,但我不想使用服务层,为此,我使用web服务调用控制器 这是我的密码: <?xml version="1.0" encoding="UTF-8"?> <beans:beans xmlns="http://www.springframework.org/schema/security" xmlns:beans="http://www.springf

我正在使用spring安全性进行身份验证登录。 我想在名称和密码中传递动态值,但我不想使用服务层,为此,我使用web服务调用控制器

这是我的密码:

        <?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.1.xsd">    

                <global-method-security pre-post-annotations="enabled" />
                 <http pattern="/auth/logout.html" security="none"/>
                 <http pattern="/css/**" security="none" />
                 <http pattern="/js/**" security="none" /> 

                <http auto-config="true"  use-expressions="true">
                <intercept-url pattern="/login" access="permitAll" />
                <intercept-url pattern="/logout" access="permitAll" />
                <intercept-url pattern="/accessdenied" access="permitAll" />
                <intercept-url pattern="/**" access="hasRole('ROLE_USER')" />
                <form-login login-page="/login" default-target-url="/suburb_analyser" authentication-failure-url="/accessdenied" />
                <logout logout-success-url="/logout" />
            </http>

            <authentication-manager alias="authenticationManager">
                <authentication-provider>
                    <user-service>
                        <user name="j@hotsal.com.au" password="mor55eover" authorities="ROLE_USER" />
                    </user-service>
                </authentication-provider>
            </authentication-manager>

        </beans:beans>

如果要在名称和密码中传递动态值。您需要声明一个实现接口的bean。然后将xml修改为:

<authentication-manager alias="authenticationManager">
    <authentication-provider user-service-ref="yourServiceBeanName">
    </authentication-provider>
</authentication-manager>


您可以使用JDBC、文件系统或内存在服务中动态生成您的姓名和密码。

您的意思是在本文中包含密码吗?在这一行中,我想使用动态姓名和密码来代替“姓名=”j@hotsal.com.au“password=”mor55eover“我明白你在问什么。我想知道您是否使用
mor55eover
作为密码。如果是这样的话,a)你不应该在这里发布,b)既然已经发布了,你应该立即在你使用它的任何地方更改密码。对不起,你的意思是如果我从这里删除了名称和密码,那么它的给定编译时间错误