Providing sample web.xml configuration for enabling basic authentication of REST API & GUI.
Change-Id: I1ee8853945611d7778a4a4dc38883cfe266a5efa
diff --git a/web/api/src/main/webapp/WEB-INF/web.xml b/web/api/src/main/webapp/WEB-INF/web.xml
index d345643..0f1ee18 100644
--- a/web/api/src/main/webapp/WEB-INF/web.xml
+++ b/web/api/src/main/webapp/WEB-INF/web.xml
@@ -20,6 +20,31 @@
id="ONOS" version="2.5">
<display-name>ONOS REST API v1.0</display-name>
+ <!--
+ <security-constraint>
+ <display-name>authenticated</display-name>
+ <web-resource-collection>
+ <web-resource-name>All files</web-resource-name>
+ <description/>
+ <url-pattern>/*</url-pattern>
+ </web-resource-collection>
+ <auth-constraint>
+ <description/>
+ <role-name>admin</role-name>
+ </auth-constraint>
+ </security-constraint>
+
+ <login-config>
+ <auth-method>BASIC</auth-method>
+ <realm-name>karaf</realm-name>
+ </login-config>
+
+ <security-role>
+ <description/>
+ <role-name>admin</role-name>
+ </security-role>
+ -->
+
<servlet>
<servlet-name>JAX-RS Service</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
diff --git a/web/gui/src/main/webapp/WEB-INF/web.xml b/web/gui/src/main/webapp/WEB-INF/web.xml
index d3e83bf..f757c6a 100644
--- a/web/gui/src/main/webapp/WEB-INF/web.xml
+++ b/web/gui/src/main/webapp/WEB-INF/web.xml
@@ -25,6 +25,31 @@
</welcome-file-list>
<!--
+ <security-constraint>
+ <display-name>authenticated</display-name>
+ <web-resource-collection>
+ <web-resource-name>All files</web-resource-name>
+ <description/>
+ <url-pattern>/*</url-pattern>
+ </web-resource-collection>
+ <auth-constraint>
+ <description/>
+ <role-name>admin</role-name>
+ </auth-constraint>
+ </security-constraint>
+
+ <login-config>
+ <auth-method>BASIC</auth-method>
+ <realm-name>karaf</realm-name>
+ </login-config>
+
+ <security-role>
+ <description/>
+ <role-name>admin</role-name>
+ </security-role>
+ -->
+
+ <!--
<servlet>
<servlet-name>Index Page</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>