Micha Kops avatar Micha Kops committed 7be0846

initial import

Comments (0)

Files changed (5)

+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>com.hascode.sample</groupId>
+	<artifactId>maven-tomcat-embedded-auth</artifactId>
+	<packaging>war</packaging>
+	<version>0.0.1-SNAPSHOT</version>
+	<name>Maven Embedded Tomcat Basic Auth Sample</name>
+	<url>http://www.hascode.com</url>
+
+	<build>
+		<finalName>maven-tomcat-embedded-auth</finalName>
+		<plugins>
+			<plugin>
+				<groupId>org.codehaus.mojo</groupId>
+				<artifactId>tomcat-maven-plugin</artifactId>
+				<version>1.1</version>
+				<configuration>
+					<mode>both</mode>
+					<path>/tcembed</path>
+				</configuration>
+			</plugin>
+		</plugins>
+	</build>
+</project>

src/main/tomcatconf/tomcat-users.xml

+<?xml version="1.0" encoding="UTF-8"?>
+<tomcat-users>
+	<user name="admin" password="admin" roles="admin" />
+</tomcat-users>

src/main/webapp/WEB-INF/web.xml

+<?xml version="1.0" encoding="UTF-8"?>
+<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+    
+    <welcome-file-list>
+    	<welcome-file>/test.jsp</welcome-file>
+    </welcome-file-list>
+    
+    <security-role>
+        <role-name>admin</role-name>
+    </security-role>
+    
+    <security-constraint>
+        <display-name>MySecurityConstraint</display-name>
+        <web-resource-collection>
+            <web-resource-name>securedresources</web-resource-name>
+            <url-pattern>/secure/*</url-pattern>
+        </web-resource-collection>
+        <auth-constraint>
+            <role-name>admin</role-name>
+        </auth-constraint>
+    </security-constraint>
+    
+    <login-config>
+        <auth-method>BASIC</auth-method>
+        <realm-name>hasCode.com Secured Area</realm-name>
+    </login-config>
+</web-app>

src/main/webapp/secure/info.jsp

+<html><head></head><body>
+<h1>This is some sensitive information</h1>
+</body></html>

src/main/webapp/test.jsp

+<html><head></head><body>
+<h1>This is a test page</h1>
+<a href="/tcembed/secure/info.jsp">To the restricted area</a>
+</body></html>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.