Skip to content

Commit

Permalink
made a profile that builds a war with servlet authz configured and de…
Browse files Browse the repository at this point in the history
…mo fedoraAdmin user.

usage: mvn -P auth-war war:war

still working on a jetty:run profile that will enable auth..
  • Loading branch information
gregjan authored and cbeer committed Dec 13, 2013
1 parent 8fc5037 commit ae92a7e
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 3 deletions.
@@ -0,0 +1,37 @@
{
"name" : "repo",
"jndiName" : "",
"workspaces" : {
"predefined" : ["default"],
"default" : "default",
"allowCreation" : true
},
"query" : {
"enabled" : true,
"indexStorage" : {
"type" : "filesystem",
"location" : "${fcrepo.modeshape.index.location:target/indexes}",
"lockingStrategy" : "native",
"fileSystemAccessType" : "auto"
}
},
"storage" : {
"cacheName" : "FedoraRepository",
"cacheConfiguration" : "${fcrepo.infinispan.cache_configuration:config/infinispan/leveldb/infinispan.xml}",
"binaryStorage" : {
"type" : "cache",
"dataCacheName" : "FedoraRepositoryBinaryData",
"metadataCacheName" : "FedoraRepositoryMetaData"
}
},
"security" : {
"anonymous" : {
"roles" : ["readonly","readwrite","admin"],
"useOnFailedLogin" : false
},
"providers" : [
{ "classname" : "org.fcrepo.auth.commons.ServletContainerAuthenticationProvider" }
]
},
"node-types" : ["fedora-node-types.cnd"]
}
29 changes: 28 additions & 1 deletion fcrepo-webapp/pom.xml
Expand Up @@ -29,6 +29,7 @@
<maven.build.timestamp.format>yyyy-MM-dd</maven.build.timestamp.format>
<!-- for standalone operation -->
<jetty.version>8.1.13.v20130916</jetty.version>
<jetty.users.file>${project.build.directory}/test-classes/jetty-users.properties</jetty.users.file>
</properties>

<dependencies>
Expand Down Expand Up @@ -146,6 +147,7 @@
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
</archive>
<packagingExcludes>WEB-INF/classes/spring/auth-repo.xml</packagingExcludes>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -228,7 +230,7 @@
<loginServices>
<loginService implementation="org.eclipse.jetty.security.HashLoginService">
<name>fcrepo</name>
<config>${project.build.directory}/test-classes/jetty-users.properties</config>
<config>${jetty.users.file}</config>
</loginService>
</loginServices>
<scanIntervalSeconds>2</scanIntervalSeconds>
Expand Down Expand Up @@ -364,5 +366,30 @@
</plugins>
</build>
</profile>
<profile>
<id>auth-war</id>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>spring/repo.xml</exclude>
</excludes>
</resource>
<resource>
<directory>src/auth/resources</directory>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<classifier>auth</classifier>
<packagingExcludes>WEB-INF/classes/spring/repo.xml</packagingExcludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
31 changes: 31 additions & 0 deletions fcrepo-webapp/src/auth/resources/spring/auth-repo.xml
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">

<!-- Context that supports the actual ModeShape JCR itself -->

<context:annotation-config/>

<bean name="modeshapeRepofactory"
class="org.fcrepo.kernel.spring.ModeShapeRepositoryFactoryBean"
p:repositoryConfiguration="${fcrepo.modeshape.configuration:classpath:/config/servlet-auth/repository.json}"
depends-on="authenticationProvider"/>

<bean name="pep" class="org.fcrepo.auth.roles.basic.BasicRolesPEP"/>

<bean name="authenticationProvider" class="org.fcrepo.auth.ServletContainerAuthenticationProvider">
<property name="pep" ref="pep"/>
</bean>

<bean class="org.modeshape.jcr.JcrRepositoryFactory"/>



<!-- For the time being, load annotation config here too -->
<bean class="org.fcrepo.metrics.MetricsConfig"/>
</beans>
4 changes: 2 additions & 2 deletions fcrepo-webapp/src/test/resources/jetty-users.properties
@@ -1,2 +1,2 @@
testuser: testpass,admin
fedoraAdmin: fedoraAdmin,admin
testuser: testpass,fedoraUser
fedoraAdmin: fedoraAdmin,fedoraAdmin

0 comments on commit ae92a7e

Please sign in to comment.