We have an application which is using spring security for authentication and authorization. We are moving this process to another web application as part single sign on but we want to keep the existing infrastructre like intercept URL pattern and acces roles in the existing application. Below is the key part of existing application, If we move the authentication to another web application how the existing application constucts the Authetication object by reading roles from single sign on application? (Single sign on application will send username, roles through a cookie to existing application).
Code:Contents of security-context.xml and authentication service <security:http entry-point-ref="AppEntryPoint"> <security:intercept-url pattern="/home.htm" access="role1"/> <security:intercept-url pattern="/**/images/**" filters="none" /> </security:http> <security:authentication-manager alias="authenticationManager"/> <bean id="customizedFormLoginFilter" class="org.springframework.security.ui.webapp.AuthenticationProcessingFilter" > <security:custom-filter position="AUTHENTICATION_PROCESSING_FILTER"/> <property name="defaultTargetUrl" value="someurl.htm"/> <property name="authenticationFailureUrl" value="someurl.html" /> <property name="authenticationManager" ref="myAuthenticationManager"/> <property name="allowSessionCreation" value="true" /> </bean> <bean id="myAuthenticationManager" class="com.test.AuthenticationService"> </bean> public class AuthenticationService implements UserDetailsService,AuthenticationManager { public Authentication authenticate(Authentication authentication) throws AuthenticationException{ //Some code here.. return new UsernamePasswordAuthenticationToken(user, authentication.getCredentials(), grantedAuthorities); } public UserDetails loadUserByUsername(String userName) throws UsernameNotFoundException, DataAccessException { //Some code here.. return user; } }


Reply With Quote
