Skip to content

Commit

Permalink
wire in fcrepo-auth-oauth
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeer committed Jun 13, 2013
1 parent a2476be commit 6ee0899
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 2 deletions.
5 changes: 5 additions & 0 deletions pom.xml
Expand Up @@ -44,6 +44,11 @@
<artifactId>fcrepo-webhooks</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.fcrepo</groupId>
<artifactId>fcrepo-auth-oauth</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>com.codahale.metrics</groupId>
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/spring/master.xml
Expand Up @@ -14,5 +14,6 @@
<import resource="classpath:/spring/rest.xml"/>
<import resource="classpath:/spring/transactions.xml"/>
<import resource="classpath:/spring/policy_driven_storage.xml"/>
<import resource="classpath:/spring/security.xml"/>

</beans>
39 changes: 39 additions & 0 deletions src/main/resources/spring/security.xml
@@ -0,0 +1,39 @@
<?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"
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/>


<context:component-scan
base-package="org.fcrepo.auth.oauth.api"/>


<bean name="oauthFilter" class="org.fcrepo.auth.oauth.filter.OAuthFilter" init-method="init">
<property name="realm" value="fedora"/>
<property name="provider">
<bean class="org.fcrepo.auth.oauth.DefaultOAuthResourceProvider">
<property name="sessionFactory">
<!-- mints JCR Sessions : needs to reappear here because it can't be autowired from the enclosed contexts-->
<ref bean="org.fcrepo.session.SessionFactory"/>
</property>
</bean>
</property>
<property name="parameterStyles">
<set
value-type="org.apache.oltu.oauth2.common.message.types.ParameterStyle">
<value>QUERY</value>
<value>HEADER</value>
</set>
</property>
</bean>

<bean name="authNFilter" class="org.fcrepo.auth.oauth.filter.RestrictToAuthNFilter" init-method="init" />

</beans>
52 changes: 50 additions & 2 deletions src/main/webapp/WEB-INF/web.xml
Expand Up @@ -23,6 +23,10 @@
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>org.fcrepo</param-value>
</init-param>
<init-param>
<param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>

Expand All @@ -31,6 +35,23 @@
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>

<!-- engaging the ModeShape REST API -->

<context-param>
<param-name>org.modeshape.jcr.URL</param-name>
<param-value>WEB-INF/classes/config/repository.json</param-value>
</context-param>

<context-param>
<param-name>org.modeshape.jcr.RepositoryName</param-name>
<param-value>repo</param-value>
</context-param>

<!-- Required parameter for ModeShape REST - should not be modified -->
<listener>
<listener-class>org.modeshape.web.jcr.ModeShapeJcrDeployer</listener-class>
</listener>

<!-- BEGIN CMIS -->
<listener>
<listener-class>org.modeshape.cmis.CmisContextListener</listener-class>
Expand Down Expand Up @@ -286,7 +307,34 @@
<session-timeout>60</session-timeout>
</session-config>


<filter>
<filter-name>delegating-1</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
<init-param>
<param-name>targetBeanName</param-name>
<param-value>oauthFilter</param-value>
</init-param>
</filter>
<filter>
<filter-name>delegating-2</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
<init-param>
<param-name>targetBeanName</param-name>
<param-value>authNFilter</param-value>
</init-param>
</filter>

<filter-mapping>
<filter-name>delegating-1</filter-name>
<url-pattern>/token</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>delegating-2</filter-name>
<url-pattern>/authorization</url-pattern>
</filter-mapping>

<!-- BASIC security parameters -->
<!-- <login-config> <auth-method>BASIC</auth-method> <realm-name>fcrepo</realm-name>
</login-config> <security-role> <role-name>admin</role-name> </security-role> -->
<login-config> <auth-method>BASIC</auth-method> <realm-name>fcrepo</realm-name>
</login-config> <security-role> <role-name>admin</role-name> </security-role>
</web-app>

0 comments on commit 6ee0899

Please sign in to comment.