Issue Details (XML | Word | Printable)

Key: SEC-955
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Luke Taylor
Reporter: Srinivasan Raguraman
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Spring Security

ability to externalize port mapping for secured channel to a property file

Created: 13/Aug/08 10:59 AM   Updated: 28/Aug/08 06:21 AM
Component/s: None
Affects Version/s: None
Fix Version/s: 2.0.4

Time Tracking:
Not Specified


 Description  « Hide
The schema for the security configuration allows only integer for the http and https property. (which is fine)

<security:port-mappings>
<security:port-mapping http="9052" https="9452"/>
</security:port-mappings>

but, it would be great if we could externalize this configuration to a property file and use property place holder instead.

<security:port-mappings>
<security:port-mapping http="${server.unsecure_port}" https="${server.secure_port}"/>
</security:port-mappings>

app.properties
---------------------
server.unsecure_port=9052
server.secure_port=9452

or at-least be able to autowire only the portMappings property in to the default bean. Right now the only way to externalize the property file, is to re-do all the secuirty configuration using beans namespace. which is cubersome.

Let me know any other better way to handle this.

 All   Comments   Work Log   Change History   FishEye   Builds      Sort Order: Ascending order - Click to sort in descending order
Luke Taylor added a comment - 20/Aug/08 08:58 AM
We may have to consider changing various attributes to xsd:string to accomodate placeholders. This is unfortunate as it reduces the protection offered by the schema file when editing configurations.

Srinivasan Raguraman added a comment - 20/Aug/08 01:15 PM
<?xml version="1.0" encoding="UTF-8"?>
How about changing to special schema type 'propertyInt' which is union of placeholder property and int. I have included the sample schema here. Would be happy to provide a patch if needed. Thanks.

<xsd:schema xmlns:this="http:///Test/MySchema.xsd"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http:///Test/MySchema.xsd">

<xsd:simpleType name="placeholderType">
<xsd:restriction base="xsd:string">
<xsd:pattern value="\{.+\}" />
</xsd:restriction>
</xsd:simpleType>

<xsd:simpleType name="propertyInt">
<xsd:union memberTypes="this:placeholderType xsd:int">
</xsd:union>
</xsd:simpleType>
</xsd:schema>

Luke Taylor added a comment - 21/Aug/08 11:05 AM - edited
Thanks. We've discussed the possibility in the past of using regular expressions to define a placeholder, but this may cause incompatibility with future expression support which doesn't match this syntax. The quality of error reporting also drops drastically in most editors when a regular expression is used. We might introduce this as a fix for 2.0.4, but ultimately it will probably be the kind of thing that is best handled by Spring-aware tooling (such as STS).

Luke Taylor added a comment - 26/Aug/08 08:21 AM
I've made the port mapping use xsd:string for the time being. We'll revisit the use of placeholders and expressions in 2.1.