/admin
私がと/login
サイトを持っていると仮定しましょう。/admin
ユーザーは保護されたサイトにアクセスしたい(ログインが必要)。ログインユーザーが にリダイレクトされた後、Spring セキュリティはクレジットについてユーザーに尋ねますdefault-target-url
。次に、/admin
ログイン フォームにアクセスしてもう一度確認します。なにが問題ですか?
Spring sill はサイトへのログインが必要ですが、サイトに入ることができません。
設定
<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>