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 {
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 DEF_CREATE_PROVIDER = "true";
static final String ATT_HASH = "hash";
static final String DEF_HASH_PLAINTEXT = "plaintext";
static final String OPT_HASH_SHA_HEX = "sha:hex";
static final String OPT_HASH_SHA_BASE64 = "sha:base64";
static final String OPT_HASH_MD4_HEX = "md4:hex";
static final String OPT_HASH_MD4_BASE64 = "md4:base64";
static final String OPT_HASH_MD5_HEX = "md5:hex";
static final String OPT_HASH_MD5_BASE64 = "md5:base64";
static final String OPT_HASH_SHA_HEX = "sha-hex";
static final String OPT_HASH_SHA_BASE64 = "sha-base64";
static final String OPT_HASH_MD4_HEX = "md4-hex";
static final String OPT_HASH_MD4_BASE64 = "md4-base64";
static final String OPT_HASH_MD5_HEX = "md5-hex";
static final String OPT_HASH_MD5_BASE64 = "md5-base64";
public BeanDefinition parse(Element element, ParserContext parserContext) {
boolean createProvider = true;
@ -73,8 +73,8 @@ class RepositoryBeanDefinitionParser implements BeanDefinitionParser {
}
if (customUserServiceElt != null) {
String id = customUserServiceElt.getAttribute(ATT_ID);
BeanDefinition userDetailsService = parserContext.getRegistry().getBeanDefinition(id);
String ref = customUserServiceElt.getAttribute(ATT_REF);
BeanDefinition userDetailsService = parserContext.getRegistry().getBeanDefinition(ref);
createDaoAuthenticationProviderIfRequired(createProvider, customUserServiceElt.getAttribute(ATT_HASH), userDetailsService, parserContext);
}

View File

@ -12,7 +12,7 @@ start = http | ldap | repository
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.
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 =
## 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?
custom-user-service.attlist &=
## 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:restriction base="xs:token">
<xs:enumeration value="plaintext"/>
<xs:enumeration value="sha:hex"/>
<xs:enumeration value="sha:base64"/>
<xs:enumeration value="md5:hex"/>
<xs:enumeration value="md5:base64"/>
<xs:enumeration value="md4:hex"/>
<xs:enumeration value="md4:base64"/>
<xs:enumeration value="sha-hex"/>
<xs:enumeration value="sha-base64"/>
<xs:enumeration value="md5-hex"/>
<xs:enumeration value="md5-base64"/>
<xs:enumeration value="md4-hex"/>
<xs:enumeration value="md4-base64"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
@ -413,12 +413,12 @@
<xs:simpleType>
<xs:restriction base="xs:token">
<xs:enumeration value="plaintext"/>
<xs:enumeration value="sha:hex"/>
<xs:enumeration value="sha:base64"/>
<xs:enumeration value="md5:hex"/>
<xs:enumeration value="md5:base64"/>
<xs:enumeration value="md4:hex"/>
<xs:enumeration value="md4:base64"/>
<xs:enumeration value="sha-hex"/>
<xs:enumeration value="sha-base64"/>
<xs:enumeration value="md5-hex"/>
<xs:enumeration value="md5-base64"/>
<xs:enumeration value="md4-hex"/>
<xs:enumeration value="md4-base64"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
@ -465,12 +465,12 @@
<xs:simpleType>
<xs:restriction base="xs:token">
<xs:enumeration value="plaintext"/>
<xs:enumeration value="sha:hex"/>
<xs:enumeration value="sha:base64"/>
<xs:enumeration value="md5:hex"/>
<xs:enumeration value="md5:base64"/>
<xs:enumeration value="md4:hex"/>
<xs:enumeration value="md4:base64"/>
<xs:enumeration value="sha-hex"/>
<xs:enumeration value="sha-base64"/>
<xs:enumeration value="md5-hex"/>
<xs:enumeration value="md5-base64"/>
<xs:enumeration value="md4-hex"/>
<xs:enumeration value="md4-base64"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
@ -496,16 +496,16 @@
<xs:simpleType>
<xs:restriction base="xs:token">
<xs:enumeration value="plaintext"/>
<xs:enumeration value="sha:hex"/>
<xs:enumeration value="sha:base64"/>
<xs:enumeration value="md5:hex"/>
<xs:enumeration value="md5:base64"/>
<xs:enumeration value="md4:hex"/>
<xs:enumeration value="md4:base64"/>
<xs:enumeration value="sha-hex"/>
<xs:enumeration value="sha-base64"/>
<xs:enumeration value="md5-hex"/>
<xs:enumeration value="md5-base64"/>
<xs:enumeration value="md4-hex"/>
<xs:enumeration value="md4-base64"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="id" use="required" type="xs:string">
<xs:attribute name="ref" use="required" type="xs:string">
<xs:annotation>
<xs:documentation>The bean ID of your custom UserDetailsService implementation.</xs:documentation>
</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"/>
<repository>
<custom-user-service id="myDetails"/>
<custom-user-service ref="myDetails"/>
</repository>
</beans:beans>

View File

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