Permalink
Browse files

Linked in fcrepo-auth-oauth

  • Loading branch information...
ajs6f committed Jul 1, 2013
1 parent b3d4ea7 commit 82015a3c3033a8254229079afc0055c94965696d
View
@@ -57,6 +57,11 @@
<artifactId>fcrepo-http-api</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.fcrepo</groupId>
+ <artifactId>fcrepo-auth-oauth</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>com.sun.jersey.contribs</groupId>
<artifactId>jersey-spring</artifactId>
@@ -0,0 +1,37 @@
+<?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:annotation-config/>
+
+ <bean name="oauthFilter" class="org.fcrepo.auth.oauth.filter.OAuthFilter">
+ <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="wrapFilter"
+ class="org.fcrepo.auth.oauth.test.filter.AuthenticatedRequestWrappingFilter"/>
+-->
+
+ <bean name="authNFilter"
+ class="org.fcrepo.auth.oauth.filter.RestrictToAuthNFilter"/>
+
+</beans>
@@ -1,44 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
- version="3.0">
-
- <display-name>Fedora 4</display-name>
-
- <context-param>
- <param-name>contextConfigLocation</param-name>
- <param-value>WEB-INF/classes/spring/*.xml</param-value>
- </context-param>
-
- <listener>
- <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
- </listener>
-
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
+ version="3.0">
+
+ <display-name>Fedora 4</display-name>
+
+ <context-param>
+ <param-name>contextConfigLocation</param-name>
+ <param-value>WEB-INF/classes/spring/*.xml</param-value>
+ </context-param>
+
+ <listener>
+ <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
+ </listener>
+
<servlet>
<servlet-name>jersey-servlet</servlet-name>
<servlet-class>com.sun.jersey.spi.spring.container.servlet.SpringServlet</servlet-class>
<init-param>
<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>
-
+
<servlet-mapping>
<servlet-name>jersey-servlet</servlet-name>
<url-pattern>/rest/*</url-pattern>
- </servlet-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>
+ </servlet-mapping>
+
+ <filter>
+ <filter-name>OpFilter</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>TokenFilter</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>TokenFilter</filter-name>
+ <url-pattern>/token</url-pattern>
+ </filter-mapping>
+ <filter-mapping>
+ <filter-name>OpFilter</filter-name>
+ <url-pattern>/rest/objects/authenticated/*</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>
</web-app>

0 comments on commit 82015a3

Please sign in to comment.