0
假设我有/admin
和/login
网站。用户想要转到/admin
安全站点(需要登录)。 Spring安全性询问用户有关信用状况,登录后用户被重定向到default-target-url
。接下来他尝试去/admin
并再次登录窗体。哪里不对?Constat重定向到登录网站
窗台需要登录网站,我无法进入网站。
配置
<security:http auto-config="true" use-expressions="true">
<security:intercept-url pattern="/admin/*" access="hasRole('ROLE_ADMIN')"/>
<security:form-login default-target-url="/succes"/>
<security:session-management/>
</security:http>
<bean id="service" class="com.springapp.mvc.dao.HibernateService"/>
<bean id="sessionRegistry" class="org.springframework.security.core.session.SessionRegistryImpl"/>
<bean id="saltSource" class="org.springframework.security.authentication.dao.ReflectionSaltSource">
<property name="userPropertyToUse" value="username"></property>
</bean>
<bean id="passwordEncoder" class="org.springframework.security.authentication.encoding.Md5PasswordEncoder"/>
<security:authentication-manager>
<security:authentication-provider user-service-ref="service">
<security:password-encoder hash="md5">
<security:salt-source ref="saltSource"/>
</security:password-encoder>
</security:authentication-provider>
</security:authentication-manager>
我不明白你的问题。你想让用户在'/ admin'登录吗? – LaurentG
@LaurentG我想知道为什么通过表单成功自动化后,我无法进入'/ admin'网站,因为它需要信用。 – user902691
在这种情况下,请向我们展示您的Spring Security XML配置。 – LaurentG