Kimlik doğrulama amacıyla Spring 3.1 kullanıyorum.Spring 3.x çoklu oturum açma sayfaları için yapılandırma
Benim gereksinimi:
- İki farklı giriş sayfaları. Biri Müşteri ve Çalışan için diğer.
- Her başarılı kimlik doğrulamasından sonra, ilgili başarılı URL'ye iletilir.
public boolean supports(Class<? extends Object> authentication) { return UsernamePasswordAuthenticationToken.class.isAssignableFrom(authentication); }
kimlik doğrulamaya çalışırken, uygulamayı başlattıktan sonra, mesaj vardır giriş sayfalarında görüntülenen şu şekildedir:
<sec:http pattern="/resources/**" security="none" /> <sec:http auto-config="true"> <sec:intercept-url pattern="/**" access="IS_AUTHENTICATED_ANONYMOUSLY" /> <sec:intercept-url pattern="/customer/**" access="ROLE_CUSTOMER" /> <sec:intercept-url pattern="/employee/**" access="ROLE_EMPLOYEE" /> </sec:http> <bean id="springSecurityFilterChain" class="org.springframework.security.web.FilterChainProxy"> <sec:filter-chain-map path-type="ant"> <sec:filter-chain pattern="/**" filters="authenticationProcessingFilterForCustomer,authenticationProcessingFilterForEmployee" /> </sec:filter-chain-map> </bean> <bean id="authenticationProcessingFilterForCustomer" class="org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter"> <property name="authenticationManager" ref="authenticationManagerForCustomer" /> <property name="filterProcessesUrl" value="/j_spring_security_check_for_customer" /> <property name="authenticationSuccessHandler" ref="customerSuccessHandler" /> <property name="authenticationFailureHandler" ref="customerFailureHandler" /> </bean> <bean id="customerSuccessHandler" class="org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler"> <property name="defaultTargetUrl" value="/customer/index.html" /> </bean> <bean id="customerFailureHandler" class="org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler"> <property name="defaultFailureUrl" value="/customer.html?login_error=1" /> </bean> <bean id="authenticationManagerForCustomer" class="org.springframework.security.authentication.ProviderManager"> <property name="providers"> <list> <ref bean="customCustomerAuthenticationProvider" /> </list> </property> </bean> <bean id="customCustomerAuthenticationProvider" class="com.edu.CustomerCustomAuthenticationProvider"> <property name="userDetailsService"> <bean class="com.edu.CustomerUserDetailsService" /> </property> </bean> <bean id="authenticationProcessingFilterForEmployee" class="org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter"> <property name="authenticationManager" ref="authenticationManagerForEmployee" /> <property name="filterProcessesUrl" value="/j_spring_security_check_for_employee" /> <property name="authenticationSuccessHandler" ref="employeeSuccessHandler" /> <property name="authenticationFailureHandler" ref="employeeFailureHandler" /> </bean> <bean id="employeeSuccessHandler" class="org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler"> <property name="defaultTargetUrl" value="/employee/index.html" /> </bean> <bean id="employeeFailureHandler" class="org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler"> <property name="defaultFailureUrl" value="/employee.html?login_error=1" /> </bean> <bean id="authenticationManagerForEmployee" class="org.springframework.security.authentication.ProviderManager"> <property name="providers"> <list> <ref bean="customEmployeeAuthenticationProvider" /> </list> </property> </bean> <bean id="customEmployeeAuthenticationProvider" class="com.edu.EmployeeCustomAuthenticationProvider"> <property name="userDetailsService"> <bean class="com.edu.EmployeeUserDetailsService" /> </property> </bean> <sec:authentication-manager alias="authenticationManager"> <sec:authentication-provider ref="customCustomerAuthenticationProvider" /> <sec:authentication-provider ref="customEmployeeAuthenticationProvider" /> </sec:authentication-manager>
Hem CustomAuthenticationProvider Destek yöntemini uyguladık: My bahar güvenlik yapılandırması
:
Giriş girişiminiz n başarılı, tekrar dene.
Sebep: Hayır AuthenticationProvider org.springframework.security.authentication.UsernamePasswordAuthenticationToken
Ben Bahar 3.1 kullanıyorum bulundu. Herhangi bir yardım takdir edildi.
Sen
Belki de http://stackoverflow.com/questions/4783063/configuring-spring-security-3-x-to-have-multiple-entry-points ile ilgili veya çoğaltılıyor mu? – Raghuram
"Birden çok giriş noktasına sahip olmak için Spring Security 3.x'in yapılandırılması" çözümüne yönelik çözüm, farklı Kullanıcı Türleri için Tek Giriş Noktası ve Tek Başarılı Sayfayı kullanıyor. Sorun, birden çok giriş noktası var ve her biri kendi Başarılı Sayfasına sahip. –
@ManasSahu Sorunuza özel kimlik doğrulama sağlayıcınızın 'support()' yöntemlerinin kodunu ekleyebilir misiniz? – Ritesh