diff --git a/DependencyInjection/Factory/AclAwareAmazonS3AdapterFactory.php b/DependencyInjection/Factory/AclAwareAmazonS3AdapterFactory.php
new file mode 100644
index 0000000..f68403a
--- /dev/null
+++ b/DependencyInjection/Factory/AclAwareAmazonS3AdapterFactory.php
@@ -0,0 +1,98 @@
+setDefinition($id.'.delegate', new DefinitionDecorator('knp_gaufrette.adapter.amazon_s3'))
+ ->addArgument(new Reference($config['amazon_s3_id']))
+ ->addArgument($config['bucket_name'])
+ ->addArgument($config['create'])
+ ;
+
+ $def = $container
+ ->setDefinition($id, new DefinitionDecorator('knp_gaufrette.adapter.acl_aware_amazon_s3'))
+ ->addArgument(new Reference($id.'.delegate'))
+ ->addArgument(new Reference($config['amazon_s3_id']))
+ ->addArgument($config['bucket_name'])
+ ;
+
+ if (isset($config['acl'])) {
+ $def->addMethodCall('setAclConstant', array($config['acl']));
+ }
+
+ if (isset($config['users'])) {
+ $def->addMethodCall('setUsers', array($config['users']));
+ }
+ }
+
+ /**
+ * Returns the key for the factory configuration
+ *
+ * @return string
+ */
+ public function getKey()
+ {
+ return 'acl_aware_amazon_s3';
+ }
+
+ /**
+ * Adds configuration nodes for the factory
+ *
+ * @param NodeBuilder $builder
+ */
+ public function addConfiguration(NodeDefinition $builder)
+ {
+ $builder
+ ->validate()
+ ->always(function($v) {
+ if (isset($v['acl']) && isset($v['users'])) {
+ throw new \Exception('"acl", and "users" cannot be set both at the same time.');
+ }
+
+ return $v;
+ })
+ ->end()
+ ->fixXmlConfig('user')
+ ->children()
+ ->scalarNode('amazon_s3_id')->isRequired()->cannotBeEmpty()->end()
+ ->scalarNode('bucket_name')->isRequired()->cannotBeEmpty()->end()
+ ->scalarNode('acl')->cannotBeEmpty()->end()
+ ->arrayNode('users')
+ ->prototype('array')
+ ->validate()
+ ->always(function($v) {
+ if (isset($v['group']) === isset($v['id'])) {
+ throw new \Exception('Either "group", or "id" must be set.');
+ }
+
+ return $v;
+ })
+ ->end()
+ ->children()
+ ->scalarNode('group')->cannotBeEmpty()->end()
+ ->scalarNode('id')->cannotBeEmpty()->end()
+ ->scalarNode('permission')->isRequired()->cannotBeEmpty()->end()
+ ->end()
+ ->end()
+ ->end()
+ ->booleanNode('create')->defaultFalse()->end()
+ ->end()
+ ;
+ }
+}
\ No newline at end of file
diff --git a/Resources/config/adapter_factories.xml b/Resources/config/adapter_factories.xml
index 52359ca..449b21a 100644
--- a/Resources/config/adapter_factories.xml
+++ b/Resources/config/adapter_factories.xml
@@ -20,6 +20,9 @@
+
+
+
diff --git a/Resources/config/gaufrette.xml b/Resources/config/gaufrette.xml
index 10cc03c..2d9b800 100644
--- a/Resources/config/gaufrette.xml
+++ b/Resources/config/gaufrette.xml
@@ -20,6 +20,7 @@
+