Skip to content

Instantly share code, notes, and snippets.

@yesil
Last active November 18, 2016 10:19
Show Gist options
  • Save yesil/dcb3697376ce07004b0202bb9424fb5d to your computer and use it in GitHub Desktop.
Save yesil/dcb3697376ce07004b0202bb9424fb5d to your computer and use it in GitHub Desktop.
Simple proxy to alter the POST request content that is sent IdP
{
"name": "samlproxy",
"version": "1.0.0",
"description": "",
"main": "server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Ilyas Türkben",
"license": "ISC",
"dependencies": {
"http-proxy": "^1.15.2"
}
}
var httpProxy = require('http-proxy')
var http = require('http')
var proxy = new httpProxy.createProxyServer({
target: {
host: 'idp',
port: 9015
}
})
proxy.on('proxyReq', function (proxyReq, req, res, options) {
proxyReq.write("RelayState=https%3A%2F%2Fidp.test&")
})
var proxyServer = http.createServer(function (req, res) {
proxy.web(req, res)
})
proxyServer.listen(8015)
@yesil
Copy link
Author

yesil commented Nov 18, 2016

  1. Download package.json and server.js
  2. npm install
  3. In AEM set the IdP host to this proxy and put the real IdP post & port in server.js (lines 6-7)
  4. Modify line 12 for adding new request parameters to IdP
  5. npm start

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment