Skip to content

Instantly share code, notes, and snippets.

@serac
serac / kryo-tgt.bin
Created March 9, 2012 17:52
Comparison of Serialized TGT vs Kryo
TGT-1-JAGo69rXn4IuYt5M4oevMOKpXL4ggqOYystTowLYNgHJpb4ej5-cas-tier-1 0 1375
passwordStateACTIVEDENTIFIER 82A00DEAC2111F7EE0440003BA624FA9uid1145718
accountStateACTIVELOA@urn:oasis:names:tc:SAML:2.0:post:ac:classes:nist-800-63:v1-0-2:2authIdseracvirginiaTechAffiliationXX-EMPLOYEE-STATE
XX-EMPLOYEEXX-ACTIVE-MEMBERXX-STAFF
XX-STUDENTXX-ALUM-CONSTITUENTXX-ALUMgroupMembership5uugid=irm.dat.authz.fiddlestix,ou=Groups,dc=xx,dc=yyy)uugid=ita.osx.lion,ou=Groups,dc=xx,dc=yyy-uugid=fiddlestix.staff,ou=Groups,dc=xx,dc=yyy6uugid=fiddlestix.wiki.authz.ctu,ou=Groups,dc=xx,dc=yyy'uugid=seti.certs,ou=Groups,dc=xx,dc=yyyFormatted NameseracauthenticationMethod9org.jasig.cas.adaptors.ldap.BindLdapAuthenticationHandler%samlAuthenticationStatementAuthMethodAurn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransportLOA@urn:oasis:names:tc:SAML:2.0:post:ac:classes:nist-800-63:v1-0-2:2�����M%QBTGT-1-JAGo69rXn4IuYt5M4oevMOKpXL4ggqOYystTowLYNgHJpb4ej5-cas-tier-1
@serac
serac / WrappedSSLSocketFactory.java
Created May 22, 2012 18:28
One Strategy for Exposing Socket Configuration in Jasig Java CAS Client
/**
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a
* copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
@serac
serac / jdbc-pool-credentialfile.patch
Created May 23, 2012 18:35
Externalize jdbc-pool Datasource Credentials to Properties File
diff --git a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceFactory.java b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceFactory.java
index 4b91e4a..59a6d60 100644
--- a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceFactory.java
+++ b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceFactory.java
@@ -17,6 +17,9 @@
package org.apache.tomcat.jdbc.pool;
+import java.io.File;
+import java.io.FileInputStream;
@serac
serac / RegisteredServiceController.java
Created September 4, 2012 13:25
Service Manager Controller Using Spring MVC Annotations
/*
$Id: $
Copyright (C) 2012 Virginia Tech.
All rights reserved.
SEE LICENSE FOR MORE INFORMATION
Author: Middleware Services
Email: middleware@vt.edu
@serac
serac / samlValidateResponse-opensaml1.xml
Created October 9, 2012 18:04
CAS SAML 1.1 Test Vectors
<?xml version="1.0" encoding="utf-8" ?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header />
<SOAP-ENV:Body>
<Response xmlns="urn:oasis:names:tc:SAML:1.0:protocol" xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion"
xmlns:samlp="urn:oasis:names:tc:SAML:1.0:protocol" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" IssueInstant="2008-12-10T14:10:30.341Z"
MajorVersion="1" MinorVersion="1" Recipient="https://hostname.example.com/service"
ResponseID="_10767f54021bf5c76185783070e1e664">
<Status>
@serac
serac / tank-volume.py
Created October 23, 2012 01:19
Fuel Tank Measuring Stick Calibration
#!/usr/bin/env python
# Computes the volume of a fuel tank as a function of height from the bottom.
# The computation is intended to support creating a dipstick to measure
# fuel remaining as a function of fuel depth obtained from the dipstick.
# Tank shape is assumed to be the common one where the cross section is
# composed of a semicircle on the top and bottom separated by a rectangular
# region of arbitrary size.
# The input to the script are tank measurements length, width, and height
# in inches.
@serac
serac / authn-handler-beans.xml
Created February 2, 2013 13:49
Spring Wiring Example for cas-server-integration-ldaptive Components
<bean id="ldapAuthHandler"
class="edu.vt.middleware.cas.authentication.handler.LdapAuthenticationHandler">
<constructor-arg>
<bean id="authenticator" class="org.ldaptive.auth.Authenticator">
<!-- Define the strategy for resolving DNs from the CAS username. -->
<constructor-arg>
<bean class="org.ldaptive.auth.PooledSearchDnResolver"
p:baseDn="${ldap.baseDn}"
p:allowMultipleDns="false"
p:connectionFactory-ref="pooledLdapConnectionFactory"
@serac
serac / FinallyThrowsTest.java
Last active December 16, 2015 10:29
Demonstrate that catching an exception in a finally block does not consume the exception thrown from the outer try block.
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
public class FinallyThrowsTest {
public static void main(final String[] args) {
try {
throw new RuntimeException("Thrown from outer try");
} finally {
@serac
serac / jetty.xml
Created May 2, 2013 19:21
Sample Monolithic Jetty Configuration
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<!-- =========================================================== -->
<!-- Configure STDERR/STDOUT logging -->
<!-- =========================================================== -->
<New id="ServerLog" class="java.io.PrintStream">
<Arg>
@serac
serac / MultiThreadedWriteTest.java
Created May 8, 2013 15:12
Demonstrate Java NIO file locking capability.
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.lang.InterruptedException;
import java.lang.Thread;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.nio.channels.FileLock;
import java.nio.channels.OverlappingFileLockException;