Add AAA protection to alto REST endpoints 38/37838/2
authorRyan Goulding <ryandgoulding@gmail.com>
Tue, 19 Apr 2016 19:31:25 +0000 (15:31 -0400)
committerjensenzhang <jingxuan.n.zhang@gmail.com>
Thu, 21 Apr 2016 11:03:35 +0000 (19:03 +0800)
Add AAAShiroFilter protection to alto's non-RESTCONF REST endpoints.

Change-Id: Ie226f6eb943ecb9442b6339b0cfac9b7e32dc100
Signed-off-by: Ryan Goulding <ryandgoulding@gmail.com>
alto-core/northbound/impl/pom.xml
alto-core/northbound/impl/src/main/resources/WEB-INF/web.xml

index 182559ba48dbaeec88716c0fe7fe73784c4eccba..d6612a96f0bd8b948bc5ccf5ac6b7a4cebb61e17 100644 (file)
@@ -98,7 +98,15 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
         <extensions>true</extensions>
         <configuration>
           <instructions>
-            <Import-Package>*,com.sun.jersey.spi.container.servlet, org.eclipse.jetty.servlets</Import-Package>
+            <Import-Package>
+              *,
+              com.sun.jersey.spi.container.servlet,
+              org.eclipse.jetty.servlets,
+              org.opendaylight.aaa.shiro.filters,
+              org.opendaylight.aaa.shiro.realm,
+              org.opendaylight.aaa.shiro.web.env,
+              org.apache.shiro.web.env
+            </Import-Package>
             <Web-ContextPath>/alto</Web-ContextPath>
           </instructions>
         </configuration>
index 9b964c1aba84e869e34a65cb43c388129b9d1a08..abf97436fb585e4538497ca7aa1ad6cdc3482b4c 100644 (file)
         <servlet-name>org.opendaylight.alto.core.northbound.AltoNorthboundApplication</servlet-name>
         <url-pattern>/*</url-pattern>
     </servlet-mapping>
+
+    <context-param>
+      <param-name>shiroEnvironmentClass</param-name>
+      <param-value>org.opendaylight.aaa.shiro.web.env.KarafIniWebEnvironment</param-value>
+    </context-param>
+
+    <listener>
+      <listener-class>org.apache.shiro.web.env.EnvironmentLoaderListener</listener-class>
+    </listener>
+
+    <filter>
+      <filter-name>ShiroFilter</filter-name>
+      <filter-class>org.opendaylight.aaa.shiro.filters.AAAShiroFilter</filter-class>
+    </filter>
+
+    <filter-mapping>
+      <filter-name>ShiroFilter</filter-name>
+      <url-pattern>/*</url-pattern>
+    </filter-mapping>
+
     <filter>
         <filter-name>cross-origin-restconf</filter-name>
         <filter-class>org.eclipse.jetty.servlets.CrossOriginFilter</filter-class>