I ran into the need of cross domain spring channel processing, so I developed simple wrapper called spring-extensions using spring framework for Cross-domain Spring channel processing. It is easy to configure and achieve with this library. In spring-extensions library cross domain spring channel processing implemented with similar nature of spring channel processing, which is PortMapper into Cross Domain Mapper logic.
- Cross-domain mapping in channel processing for respective port mapped in PortMapper
- Supports non-standard port of domain mapping in Cross Domain host-name
How to achieve Spring Channel Processing
We will be needing a Spring-Extensions Library and Cross domain spring channel processing applicationContext for port and domain address mapping.
Refer Spring-Extensions in project
For maven based project, spring-extensions library referred from Maven Central Repo.
<dependency> <groupId>com.myjeeva</groupId> <artifactId>spring-extensions</artifactId> <version>1.0.1</version> </dependency>
Need dependency info for Gradle, Scala SBT, etc.
Download Application Context
Ready to use applicationContext-channelProcessing.xml is here.
Update Domain Name and Port No.
Include the downloaded applicationContext-channelProcessing.xml and update the domain name and port no. in it. That’s it execute and test your application.
Things to know
Important bean definition for achieving cross domain spring channel processing
Cross Domain Mapper
<bean id="crossDomainMapper" class="com.myjeeva.spring.security.util.CrossDomainMapperImpl"> <property name="crossDomainMappings"> <map> <entry key="company.com" value="sso.company.com"/> <entry key="internal.samplesite.com" value="auth.internal.samplesite.com"/> </map> </property> </bean>
Secure & In-Secure Channel
<bean id="secureChannelEntryPoint" class="com.myjeeva.spring.security.securechannel.CrossDomainRetryWithHttpsEntryPoint"> <property name="portMapper" ref="portMapper"/> <property name="crossDomainMapper" ref="crossDomainMapper"/> </bean> <bean id="insecureChannelEntryPoint" class="com.myjeeva.spring.security.securechannel.CrossDomainRetryWithHttpEntryPoint"> <property name="portMapper" ref="portMapper"/> <property name="crossDomainMapper" ref="crossDomainMapper"/> </bean>
That’s it, we have successfully achieved a Cross Domain Spring Channel Processing!