I need to support both HTTP and HTTPS in my Spring Security file and dynamically switch between those at runtime.
So I am trying to create properties file which would contain one of any/http/https, but that won’t parse the XML config.
Spring Security config:
<sec:http entry-point-ref="portalEntryPoint">
<sec:anonymous />
<sec:intercept-url pattern = "/portal" access="IS_AUTHENTICATED_ANONYMOUSLY"
requires-channel="${user-security.login.channel}" />
<!-- rest omitted -->
</sec:http>
Properties file:
user-security.login.channel=https
I am getting following error:
Caused by: org.xml.sax.SAXParseException: cvc-enumeration-valid: Value '${user-security.login.channel}' is not facet-valid with respect to enumeration '[http, https, any]'. It must be a value from the enumeration.
I am using Spring 3 and Spring Security 2. Any ideas?
If you absolutely MUST then use profiles to configure your portal entry point. Obviously this means a lot of copy and paste in your spring config ….
Example from springsource docs :
link http://blog.springsource.com/2011/02/14/spring-3-1-m1-introducing-profile/