Skip to content

Instantly share code, notes, and snippets.

View sauthieg's full-sized avatar

Guillaume Sauthier sauthieg

View GitHub Profile
package org.forgerock.openig.launcher;
import java.util.Deque;
import java.util.concurrent.ConcurrentLinkedDeque;
import java.util.concurrent.CountDownLatch;
import java.util.function.Function;
import io.reactivex.rxjava3.core.Flowable;
import io.reactivex.rxjava3.schedulers.Schedulers;
import io.vertx.codegen.annotations.Fluent;
if (request.method == 'OPTIONS') {
/**
* Supplies a response to a CORS preflight request.
*
* Example response:
*
* HTTP/1.1 200 OK
* Access-Control-Allow-Origin: http://app.example.com:8081
* Access-Control-Allow-Methods: POST
* Access-Control-Allow-Headers: Authorization
def response = new Response(Status.OK)
//response.cause = new Exception("boom")
response.entity.string = """
<html>
<head>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" integrity="sha512-dTfge/zgoMYpP7QbHy4gWMEGsbsdZeCXz7irItjcC3sPUFtf0kuFbDz/ixG7ArTxmDjLXDmezHubeNikyKGVyQ==" crossorigin="anonymous">
<!-- Optional theme -->
@sauthieg
sauthieg / CrestHttpClient.groovy
Created October 6, 2015 07:39
Demonstrate usage of ForgeRock CREST Http Client
import org.forgerock.http.handler.HttpClientHandler
import org.forgerock.services.context.RootContext
import static org.forgerock.json.JsonValue.json
import static org.forgerock.json.resource.Requests.*
import static org.forgerock.json.resource.http.CrestHttp.newConnectionFactory
import static org.forgerock.util.query.QueryFilter.alwaysTrue
def handler = new HttpClientHandler()
connection = newConnectionFactory(handler, new URI("http://localhost:8080/")).connection

Keybase proof

I hereby claim:

  • I am sauthieg on github.
  • I am sauthieg (https://keybase.io/sauthieg) on keybase.
  • I have a public key whose fingerprint is DBD8 AB87 0EEC E4C3 45D5 7C1A 8B37 2A63 B871 ADA5

To claim this, I am signing this object:

@sauthieg
sauthieg / route-sample.json
Created December 5, 2014 11:41
Route sample
{
"heap": {
"objects": [
{
"name": "OutgoingChain",
"type": "Chain",
"comment": "Intercept the exchange processing",
"config": {
"filters": [ ],
"handler": "Forwarder"
@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
@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 / 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 / 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