I have an application which uses spring (also spring security) where few services were kept outside the secured resource set by specifying like below in the applicationContext.xml:
<http pattern="/services/rest/nohisb/Msgs" security="none"/>
Now these services needs to be accessed only via https. Container is configured to have https. Requirement is when user access the above service on http, he should be redirected to https (port number too changes, as it in not the default 443).
Is it possible to achieve this via spring ?
thanks
Nohsib
Yes, it is possible to achieve using Spring Channel Processing and PortMapper
Spring Channel Processing used to define http/https access URL Patterns. For Example-
Https Access URL-
Http: Access URL-
Then if user access the secure URL in http mode “http://localhost/myapp/user/myaccount” spring channel security redirect the user to secure URL “https://localhost/myapp/user/myaccount” and vice verse.
PortMapper Bean is used map non-standard port numbers for HTTP and HTTPS mapping
Sample Configuration:
Channel Processing Bean Definition And Port Mapper-
Filter Mapping-