6decf1c8ef
Prior to this commit, the ObjectIdentity id had to be a number. This commit allows for domain objects to use UUIDs as their identifier. The fully qualified class name of the identifier type can be specified in the acl_object_identity table and a ConversionService can be provided to BasicLookupStrategy to convert from String to the actual identifier type. There are the following other changes: - BasicLookupStrategy has a new property, aclClassIdSupported, which is used to retrieve the new column from the database. This preserves backwards-compatibility, as it is false by default. - JdbcMutableAclService has the same property, aclClassIdSupported, which is needed to modify the insert statement to write to the new column. Defaults to false for backwards-compatibility. - Tests have been updated to verify both the existing functionality for backwards-compatibility and the new functionality. Fixes gh-1224
106 lines
3.8 KiB
XML
106 lines
3.8 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
|
|
|
|
<!--
|
|
- Application context containing business beans.
|
|
-
|
|
- Used by all artifacts.
|
|
-
|
|
-->
|
|
|
|
<beans>
|
|
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
|
|
<property name="dataSource" ref="dataSource"/>
|
|
</bean>
|
|
|
|
<bean id="aclCache" class="org.springframework.security.acls.domain.EhCacheBasedAclCache">
|
|
<constructor-arg>
|
|
<bean class="org.springframework.cache.ehcache.EhCacheFactoryBean">
|
|
<property name="cacheManager">
|
|
<bean class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
|
|
<!-- This context is used in two tests so accept existing cache manager as the context will be reused -->
|
|
<property name="acceptExisting" value="true"/>
|
|
</bean>
|
|
</property>
|
|
<property name="cacheName" value="aclCache"/>
|
|
</bean>
|
|
</constructor-arg>
|
|
<constructor-arg>
|
|
<bean class="org.springframework.security.acls.domain.DefaultPermissionGrantingStrategy">
|
|
<constructor-arg>
|
|
<bean class="org.springframework.security.acls.domain.ConsoleAuditLogger"/>
|
|
</constructor-arg>
|
|
</bean>
|
|
</constructor-arg>
|
|
<constructor-arg>
|
|
<bean class="org.springframework.security.acls.domain.AclAuthorizationStrategyImpl">
|
|
<constructor-arg>
|
|
<list>
|
|
<bean class="org.springframework.security.core.authority.SimpleGrantedAuthority">
|
|
<constructor-arg value="ROLE_USER"/>
|
|
</bean>
|
|
</list>
|
|
</constructor-arg>
|
|
</bean>
|
|
</constructor-arg>
|
|
|
|
</bean>
|
|
|
|
<bean id="lookupStrategy" class="org.springframework.security.acls.jdbc.BasicLookupStrategy">
|
|
<constructor-arg ref="dataSource"/>
|
|
<constructor-arg ref="aclCache"/>
|
|
<constructor-arg ref="aclAuthorizationStrategy"/>
|
|
<constructor-arg>
|
|
<bean class="org.springframework.security.acls.domain.ConsoleAuditLogger"/>
|
|
</constructor-arg>
|
|
</bean>
|
|
|
|
<bean id="aclAuthorizationStrategy" class="org.springframework.security.acls.domain.AclAuthorizationStrategyImpl">
|
|
<constructor-arg>
|
|
<list>
|
|
<bean class="org.springframework.security.core.authority.SimpleGrantedAuthority">
|
|
<constructor-arg value="ROLE_ADMINISTRATOR"/>
|
|
</bean>
|
|
<bean class="org.springframework.security.core.authority.SimpleGrantedAuthority">
|
|
<constructor-arg value="ROLE_ADMINISTRATOR"/>
|
|
</bean>
|
|
<bean class="org.springframework.security.core.authority.SimpleGrantedAuthority">
|
|
<constructor-arg value="ROLE_ADMINISTRATOR"/>
|
|
</bean>
|
|
</list>
|
|
</constructor-arg>
|
|
</bean>
|
|
|
|
<bean id="aclService" class="org.springframework.security.acls.jdbc.JdbcMutableAclService">
|
|
<constructor-arg ref="dataSource"/>
|
|
<constructor-arg ref="lookupStrategy"/>
|
|
<constructor-arg ref="aclCache"/>
|
|
|
|
<!-- Uncomment to use PostgreSQL
|
|
<property name="classIdentityQuery" value="select currval(pg_get_serial_sequence('acl_class', 'id'))"/>
|
|
<property name="sidIdentityQuery" value="select currval(pg_get_serial_sequence('acl_sid', 'id'))"/>
|
|
-->
|
|
</bean>
|
|
|
|
<!-- PostgreSQL DataSource configuration
|
|
|
|
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
|
|
<property name="driverClassName" value="org.postgresql.Driver"/>
|
|
<property name="url" value="jdbc:postgresql://localhost:5432/acltest"/>
|
|
<property name="username" value="acltest"/>
|
|
<property name="password" value="acltest"/>
|
|
</bean>
|
|
-->
|
|
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
|
|
<property name="driverClassName" value="org.hsqldb.jdbcDriver"/>
|
|
<property name="url" value="jdbc:hsqldb:mem:acltest"/>
|
|
<property name="username" value="sa"/>
|
|
<property name="password" value=""/>
|
|
</bean>
|
|
|
|
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
|
|
<property name="dataSource" ref="dataSource"/>
|
|
</bean>
|
|
|
|
</beans>
|