java - Spring Social and Spring Security using XML configuration -
i'm trying introduce spring social exising web-application spring security. existing web-app uses xml configuration, ie:
<security:http disable-url-rewriting="true" use-expressions="true" xmlns="http://www.springframework.org/schema/security"> ... <intercept-url pattern="/w/configuration/**" access="hasrole ('role_admin')"/> ... <form-login login-page="/w/welcome" authentication-success-handler-ref="authsuccesshandler" authentication-failure-handler-ref="authfailurehandler"/> <logout logout-success-url="/w/welcome"/> </security:http>
how add springsocialconfigurer() configuration? documentation on spring social uses java-based configuration want avoid, eg:
@override protected void configure(httpsecurity http) throws exception { http .formlogin() .loginpage("/signin") .loginprocessingurl("/signin/authenticate") .failureurl("/signin?param.error=bad_credentials") .and() .logout() .logouturl("/signout") .deletecookies("jsessionid") .and() .apply(new springsocialconfigurer()); }
what xml equivalent of apply() method?
after spending time reviewing code springsocialconfigurer, here somewhat equivalent xml configuration does:
<security:http disable-url-rewriting="true" use-expressions="true" xmlns="http://www.springframework.org/schema/security"> ... <intercept-url pattern="/w/configuration/**" access="hasrole ('role_admin')"/> ... <form-login login-page="/w/welcome" authentication-success-handler-ref="authsuccesshandler" authentication-failure-handler-ref="authfailurehandler"/> <logout logout-success-url="/w/welcome"/> <!-- add custom filter handle social media logins --> <custom-filter before="pre_auth_filter" ref="socialauthfilter"/> </security:http> <security:authentication-manager id="authenticationmanager" xmlns="http://www.springframework.org/schema/security"> <!-- social media sites authentication provider --> <authentication-provider ref="socialauthprovider"/> </security:authentication-manager> <!-- define framework required using social media sites authentication providers. --> <bean id="connectionfactorylocator" class="org.springframework.social.security.socialauthenticationserviceregistry"> <property name="connectionfactories"> <list> <bean class="org.springframework.social.facebook.connect.facebookconnectionfactory"> <constructor-arg value="${social.facebook.appid}" /> <constructor-arg value="${social.facebook.appsecret}" /> </bean> </list> </property> </bean> <bean id="socialusersconxrepo" class="org.springframework.social.connect.mem.inmemoryusersconnectionrepository"> <constructor-arg ref="connectionfactorylocator"/> </bean> <bean id="socialuseridsource" class="org.springframework.social.security.authenticationnameuseridsource"/> <bean id="socialauthfilter" class="org.springframework.social.security.socialauthenticationfilter"> <constructor-arg ref="authenticationmanager"/> <constructor-arg ref="socialuseridsource"/> <constructor-arg ref="socialusersconxrepo"/> <constructor-arg ref="connectionfactorylocator"/> </bean> <bean id="socialauthprovider" class="org.springframework.social.security.socialauthenticationprovider"> <constructor-arg ref="socialusersconxrepo"/> <!-- application defined @service --> <constructor-arg ref="socialgamermanager"/> </bean>
the application programmer expected write own "socialgamermanager" bean must implement org.springframework.social.security.socialuserdetailsservice
. "socialusersconxrepo" bean may changed use jdbc implementation.
Comments
Post a Comment