java - Pass authentication info between web service and business layer (Spring, tomcat) -


i have spring web service , business layer deployed separately on 2 tomcat servers. (as explained in question spring ws separately deploy web service , bussiness layer).

business layer servlet container , web service communicate spring httpinvoker.

i use tomcat container based authentication springs preauthenticatedauthenticationprovider , j2eepreauthenticatedprocessingfilter. here not provide client application authentication token. (i mean not manually doing session handling. managed tomcat)

now want make sure requests business layers authenticated client. 1 thing found pass authentication object web service's security context securitycontextholder.getcontext().getauthentication() request parameter business layer. there not have way verify authentication object. idea on way achieve security in business layer?

the httpinvoker way of remoting uses http client, default wil use plain httpurlconnection jdk. way of connecting used determined imlementation of httpinvokerrequestexecutor default simplehttpinvokerrequestexecutor.

now switch use 1 of other implementations use apache commons httpclient under hood. use basic authentication (or digest) pass username/password service layer (instead of authentication object.

spring security supplies custom implementation you, thing need (client side) reconfigure httpinvokerproxyfactorybean.

<bean id="yourserviceproxy" class="org.springframework.remoting.httpinvoker.httpinvokerproxyfactorybean">     <property name="httpinvokerrequestexecutor" ref="requestexecutor" /> </bean>  <bean id="requestexecutor" class="org.springframework.security.remoting.httpinvoker.authenticationsimplehttpinvokerrequestexecutor"/> 

see javadoc , spring security reference guide. class can found in spring-security-remoting dependency. next dependency need configure business layer use basic authentication.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -