Skip to content
Snippets Groups Projects
Commit 78c630dc authored by Scotty Logan's avatar Scotty Logan
Browse files

initial commit

parents
No related branches found
Tags 1.0.0
No related merge requests found
target/
pom.xml 0 → 100644
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>edu.stanford.itlab.shibboleth</groupId>
<artifactId>CookieServlet</artifactId>
<version>1.0.0</version>
<packaging>war</packaging>
<name>CookieServlet</name>
<url>https://itarch.stanford.edu</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<warSourceDirectory>src/main/webapp</warSourceDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
package edu.stanford.itlab.shibboleth;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.Cookie;
public class ClearIdpCookieServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
@Override
public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException {
Cookie c = new Cookie("shib_idp_session", null);
c.setMaxAge(0);
c.setPath("/idp");
c.setSecure(true);
c.setDomain(req.getServerName());
res.addCookie(c);
}
@Override
public void init() throws ServletException {
System.out.println("Servlet " + this.getServletName() + " has started");
}
@Override
public void destroy() {
System.out.println("Servlet " + this.getServletName() + " has stopped");
}
}
package edu.stanford.itlab.shibboleth;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.Cookie;
public class SetX509CookieServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
@Override
public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException {
Cookie c = new Cookie("x509passthrough", "true");
c.setMaxAge(86400 * 365 * 5);
c.setPath("/idp");
c.setSecure(true);
c.setDomain(req.getServerName());
res.addCookie(c);
}
@Override
public void init() throws ServletException {
System.out.println("Servlet " + this.getServletName() + " has started");
}
@Override
public void destroy() {
System.out.println("Servlet " + this.getServletName() + " has stopped");
}
}
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<display-name>IdP Cookie Clearing Servlet</display-name>
<servlet>
<servlet-name>clearIdpCookieServlet</servlet-name>
<servlet-class>edu.stanford.itlab.shibboleth.ClearIdpCookieServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>clearIdpCookieServlet</servlet-name>
<url-pattern>/clearIdpCookie</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>setX509CookieServlet</servlet-name>
<servlet-class>edu.stanford.itlab.shibboleth.SetX509CookieServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>setX509CookieServlet</servlet-name>
<url-pattern>/setX509Cookie</url-pattern>
</servlet-mapping>
</web-app>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment