Modify attribute names to use "ref" instead of "id", plus use a hyphen

as an attribute value separator rather than a colon. This was changed 
for compatibility with other components in the Spring Portfolio. tests 
pass.
This commit is contained in:
Ben Alex 2007-12-13 20:19:56 +00:00
parent 0f12d31d90
commit fa510b3187
5 changed files with 38 additions and 38 deletions

View File

@ -27,19 +27,19 @@ import org.w3c.dom.Element;
class RepositoryBeanDefinitionParser implements BeanDefinitionParser { class RepositoryBeanDefinitionParser implements BeanDefinitionParser {
static final String ATT_DATA_SOURCE = "data-source"; static final String ATT_DATA_SOURCE = "data-source";
static final String ATT_ID = "id"; static final String ATT_REF = "ref";
static final String ATT_CREATE_PROVIDER = "create-provider"; static final String ATT_CREATE_PROVIDER = "create-provider";
static final String DEF_CREATE_PROVIDER = "true"; static final String DEF_CREATE_PROVIDER = "true";
static final String ATT_HASH = "hash"; static final String ATT_HASH = "hash";
static final String DEF_HASH_PLAINTEXT = "plaintext"; static final String DEF_HASH_PLAINTEXT = "plaintext";
static final String OPT_HASH_SHA_HEX = "sha:hex"; static final String OPT_HASH_SHA_HEX = "sha-hex";
static final String OPT_HASH_SHA_BASE64 = "sha:base64"; static final String OPT_HASH_SHA_BASE64 = "sha-base64";
static final String OPT_HASH_MD4_HEX = "md4:hex"; static final String OPT_HASH_MD4_HEX = "md4-hex";
static final String OPT_HASH_MD4_BASE64 = "md4:base64"; static final String OPT_HASH_MD4_BASE64 = "md4-base64";
static final String OPT_HASH_MD5_HEX = "md5:hex"; static final String OPT_HASH_MD5_HEX = "md5-hex";
static final String OPT_HASH_MD5_BASE64 = "md5:base64"; static final String OPT_HASH_MD5_BASE64 = "md5-base64";
public BeanDefinition parse(Element element, ParserContext parserContext) { public BeanDefinition parse(Element element, ParserContext parserContext) {
boolean createProvider = true; boolean createProvider = true;
@ -73,8 +73,8 @@ class RepositoryBeanDefinitionParser implements BeanDefinitionParser {
} }
if (customUserServiceElt != null) { if (customUserServiceElt != null) {
String id = customUserServiceElt.getAttribute(ATT_ID); String ref = customUserServiceElt.getAttribute(ATT_REF);
BeanDefinition userDetailsService = parserContext.getRegistry().getBeanDefinition(id); BeanDefinition userDetailsService = parserContext.getRegistry().getBeanDefinition(ref);
createDaoAuthenticationProviderIfRequired(createProvider, customUserServiceElt.getAttribute(ATT_HASH), userDetailsService, parserContext); createDaoAuthenticationProviderIfRequired(createProvider, customUserServiceElt.getAttribute(ATT_HASH), userDetailsService, parserContext);
} }

View File

@ -12,7 +12,7 @@ start = http | ldap | repository
hash = hash =
## Defines the type of hashing used on user passwords. If unspecified, "plaintext" is nominated, which indicates that the passwords are not hashed. We recommend strongly against using MD4, as it is a very weak hashing algorithm. ## Defines the type of hashing used on user passwords. If unspecified, "plaintext" is nominated, which indicates that the passwords are not hashed. We recommend strongly against using MD4, as it is a very weak hashing algorithm.
attribute hash {"plaintext" | "sha:hex" | "sha:base64" | "md5:hex" | "md5:base64" | "md4:hex" | "md4:base64"} attribute hash {"plaintext" | "sha-hex" | "sha-base64" | "md5-hex" | "md5-base64" | "md4-hex" | "md4-base64"}
path-type = path-type =
## Defines the type of pattern used to specify URL paths (either JDK 1.4-compatible regular expressions, or Apache Ant expressions). Defaults to "ant" if unspecified. ## Defines the type of pattern used to specify URL paths (either JDK 1.4-compatible regular expressions, or Apache Ant expressions). Defaults to "ant" if unspecified.
@ -224,5 +224,5 @@ custom-user-service.attlist &=
hash? hash?
custom-user-service.attlist &= custom-user-service.attlist &=
## The bean ID of your custom UserDetailsService implementation. ## The bean ID of your custom UserDetailsService implementation.
attribute id {xsd:string} attribute ref {xsd:string}

View File

@ -9,12 +9,12 @@
<xs:simpleType> <xs:simpleType>
<xs:restriction base="xs:token"> <xs:restriction base="xs:token">
<xs:enumeration value="plaintext"/> <xs:enumeration value="plaintext"/>
<xs:enumeration value="sha:hex"/> <xs:enumeration value="sha-hex"/>
<xs:enumeration value="sha:base64"/> <xs:enumeration value="sha-base64"/>
<xs:enumeration value="md5:hex"/> <xs:enumeration value="md5-hex"/>
<xs:enumeration value="md5:base64"/> <xs:enumeration value="md5-base64"/>
<xs:enumeration value="md4:hex"/> <xs:enumeration value="md4-hex"/>
<xs:enumeration value="md4:base64"/> <xs:enumeration value="md4-base64"/>
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
</xs:attribute> </xs:attribute>
@ -413,12 +413,12 @@
<xs:simpleType> <xs:simpleType>
<xs:restriction base="xs:token"> <xs:restriction base="xs:token">
<xs:enumeration value="plaintext"/> <xs:enumeration value="plaintext"/>
<xs:enumeration value="sha:hex"/> <xs:enumeration value="sha-hex"/>
<xs:enumeration value="sha:base64"/> <xs:enumeration value="sha-base64"/>
<xs:enumeration value="md5:hex"/> <xs:enumeration value="md5-hex"/>
<xs:enumeration value="md5:base64"/> <xs:enumeration value="md5-base64"/>
<xs:enumeration value="md4:hex"/> <xs:enumeration value="md4-hex"/>
<xs:enumeration value="md4:base64"/> <xs:enumeration value="md4-base64"/>
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
</xs:attribute> </xs:attribute>
@ -465,12 +465,12 @@
<xs:simpleType> <xs:simpleType>
<xs:restriction base="xs:token"> <xs:restriction base="xs:token">
<xs:enumeration value="plaintext"/> <xs:enumeration value="plaintext"/>
<xs:enumeration value="sha:hex"/> <xs:enumeration value="sha-hex"/>
<xs:enumeration value="sha:base64"/> <xs:enumeration value="sha-base64"/>
<xs:enumeration value="md5:hex"/> <xs:enumeration value="md5-hex"/>
<xs:enumeration value="md5:base64"/> <xs:enumeration value="md5-base64"/>
<xs:enumeration value="md4:hex"/> <xs:enumeration value="md4-hex"/>
<xs:enumeration value="md4:base64"/> <xs:enumeration value="md4-base64"/>
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
</xs:attribute> </xs:attribute>
@ -496,16 +496,16 @@
<xs:simpleType> <xs:simpleType>
<xs:restriction base="xs:token"> <xs:restriction base="xs:token">
<xs:enumeration value="plaintext"/> <xs:enumeration value="plaintext"/>
<xs:enumeration value="sha:hex"/> <xs:enumeration value="sha-hex"/>
<xs:enumeration value="sha:base64"/> <xs:enumeration value="sha-base64"/>
<xs:enumeration value="md5:hex"/> <xs:enumeration value="md5-hex"/>
<xs:enumeration value="md5:base64"/> <xs:enumeration value="md5-base64"/>
<xs:enumeration value="md4:hex"/> <xs:enumeration value="md4-hex"/>
<xs:enumeration value="md4:base64"/> <xs:enumeration value="md4-base64"/>
</xs:restriction> </xs:restriction>
</xs:simpleType> </xs:simpleType>
</xs:attribute> </xs:attribute>
<xs:attribute name="id" use="required" type="xs:string"> <xs:attribute name="ref" use="required" type="xs:string">
<xs:annotation> <xs:annotation>
<xs:documentation>The bean ID of your custom UserDetailsService implementation.</xs:documentation> <xs:documentation>The bean ID of your custom UserDetailsService implementation.</xs:documentation>
</xs:annotation> </xs:annotation>

View File

@ -9,7 +9,7 @@ http://www.springframework.org/schema/security http://www.springframework.org/sc
<beans:bean id="myDetails" class="org.springframework.security.config.CustomUserDetailsService"/> <beans:bean id="myDetails" class="org.springframework.security.config.CustomUserDetailsService"/>
<repository> <repository>
<custom-user-service id="myDetails"/> <custom-user-service ref="myDetails"/>
</repository> </repository>
</beans:beans> </beans:beans>

View File

@ -31,7 +31,7 @@
</http> </http>
<repository> <repository>
<user-service hash="md5:hex"> <user-service hash="md5-hex">
<user name="rod" password="a564de63c2d0da68cf47586ee05984d7" authorities="ROLE_SUPERVISOR,ROLE_USER" /> <!-- koala --> <user name="rod" password="a564de63c2d0da68cf47586ee05984d7" authorities="ROLE_SUPERVISOR,ROLE_USER" /> <!-- koala -->
<user name="dianne" password="65d15fe9156f9c4bbffd98085992a44e" authorities="ROLE_USER" /> <!-- emu --> <user name="dianne" password="65d15fe9156f9c4bbffd98085992a44e" authorities="ROLE_USER" /> <!-- emu -->
<user name="scott" password="2b58af6dddbd072ed27ffc86725d7d3a" authorities="ROLE_USER" /> <!-- wombat --> <user name="scott" password="2b58af6dddbd072ed27ffc86725d7d3a" authorities="ROLE_USER" /> <!-- wombat -->