Skip to content

Instantly share code, notes, and snippets.

View sauthieg's full-sized avatar

Guillaume Sauthier sauthieg

View GitHub Profile
@sauthieg
sauthieg / hello-world-chain.json
Created October 5, 2014 18:54
OpenIG configuration file that shows interception mechanisms
{
"heap": {
"objects": [
{
"name": "HelloWorldChain",
"type": "Chain",
"comment": "Intercept the exchange processing",
"config": {
"filters": [ "AddHelloHeader" ],
"handler": "HelloWorld"
{
"heap": {
"objects": [
{
"name": "LogSink",
"comment": "Default sink for logging information.",
"type": "ConsoleLogSink",
"config": {
"level": "DEBUG"
}
@sauthieg
sauthieg / PrintSessionFilter.groovy
Created October 17, 2014 09:27
Prints the content of the session on System.out
import groovy.json.JsonOutput
println "SESSION BEFORE"
println JsonOutput.prettyPrint(JsonOutput.toJson(exchange.session))
next.handle(exchange)
println "SESSION AFTER"
println JsonOutput.prettyPrint(JsonOutput.toJson(exchange.session))
@sauthieg
sauthieg / gateway.log
Created October 18, 2014 20:34
Sample output of a CaptureFilter
--- REQUEST 0 --->
GET http://localhost:80/resources/sample.json HTTP/1.1
Authorization: Bearer c9063abd-b1e9-4de4-a21a-06efa75f76b8
Cache-Control: no-cache
Accept: */*
Connection: keep-alive
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.101 Safari/537.36
Host: localhost:8080
Accept-Encoding: gzip,deflate,sdch
@sauthieg
sauthieg / config.json
Created October 19, 2014 08:17
Install a CaptureFilter in a Chain
{
"heap": {
"objects": [
{
"name": "CapturingChain",
"type": "Chain",
"config": {
"filters": [ "Capture" ],
"handler": "Forwarder"
}
@sauthieg
sauthieg / ConsoleLogSink.json
Created October 19, 2014 10:49
Activate console traces
{
"name": "LogSink",
"comment": "Console-based sink for logging information.",
"type": "ConsoleLogSink",
"config": {
"level": "DEBUG"
}
}
@sauthieg
sauthieg / System.out
Created October 19, 2014 11:21
Sample DEBUG traces
2014-10-19T11:12:15Z:Resources.started:STAT:Started
2014-10-19T11:12:15Z:ResourceServer.started:STAT:Started
2014-10-19T11:12:15Z:ClientHandler.started:STAT:Started
2014-10-19T11:12:15Z:ClientHandler.elapsed:STAT:Elapsed time: 2 ms:2 ms
2014-10-19T11:12:15Z:ResourceServer.elapsed:STAT:Elapsed time: 3 ms:3 ms
2014-10-19T11:12:15Z:Resources.elapsed:STAT:Elapsed time: 3 ms:3 ms
2014-10-19T11:14:55Z:Carousel.started:STAT:Started
2014-10-19T11:14:55Z:OAuth2ClientFilter.started:STAT:Started
2014-10-19T11:14:55Z:OAuth2ClientFilter.elapsed:STAT:Elapsed time: 5 ms:5 ms
2014-10-19T11:14:55Z:Carousel.elapsed:STAT:Elapsed time: 5 ms:5 ms
@sauthieg
sauthieg / PrintSessionFilter.json
Created October 19, 2014 12:10
ScriptableFilter heap object declaration
{
"name": "PrintSessionFilter",
"type": "ScriptableFilter",
"config": {
"type": "application/x-groovy",
"file": "PrintSessionFilter.groovy"
}
}
@sauthieg
sauthieg / SanitizeQueryStringFilter.java
Created October 31, 2014 09:05
Sanitize the query string value in case of ill-formed values (example: `http://host.domain.com:80/?parm=1&parm2=x3|foo|bar`).
/*
* The contents of this file are subject to the terms of the Common Development and
* Distribution License (the License). You may not use this file except in compliance with the
* License.
*
* You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
* specific language governing permission and limitations under the License.
*
* When distributing Covered Software, include this CDDL Header Notice in each file and include
* the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
@sauthieg
sauthieg / openig-3.1
Created November 29, 2014 07:26
Prototype of OpenIG 3.1 Dockerfile
FROM tomcat:8
RUN rm -rf $CATALINA_HOME/webapps/*
RUN curl -SL http://download.forgerock.org/downloads/openig/nightly/OpenIG-3.1.0-SNAPSHOT.war -o $CATALINA_HOME/webapps/ROOT.war