Skip to content

Instantly share code, notes, and snippets.

@bvulaj
bvulaj / CrossDomainCookieCsrfTokenRepository.java
Created July 27, 2017 03:22
The Cookie based, provided implementation of CsrfTokenRepository, CookieCsrfTokenRepository, does not allow setting the domain or domain pattern, so it is not possible to use the cookie across sub-domains. This implementation, which assumes `httpOnly=false` at this time, allows you to customize the cookie's domain as you would with `org.springfr…
package com.phrankly.commons.security;
import java.lang.reflect.Method;
import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@oroce
oroce / bunyan-pipe-to-mongodb.js
Created November 10, 2012 21:29
pipe bunyan logger into mongodb (even with node-restify)
var mongoCol = require( "mongo-col" ),
mongoStream = require( "mongo-stream" ),
mongoInsertStream = mongoStream( mongoCol( "piped-collection", null, {
dbOptions:{
safe: true
}
})),
Logger = require( "bunyan" );
new Logger({