Forum Discussion
lbertacco
Nimbostratus
Apr 04, 2017deflate/inflate data in an irule
I'd like to decode a SAML request from an iRule. The reason is that I'd like to synthesize a SAML response when the user has no valid session.
The problem is that the SAML request, passed as an url p...
cjunior
Nacreous
Apr 04, 2017Hi, I don't know your exactly goal to the SAML, but maybe you can do the deflate/inflate with the zlib library from node.js with iRule LX. In the example below, I just created a workspace, plugin then an iRule and it has worked (at least on my lab :).
I hope it helps!
My iRule LX scenario hierarchy:
ilx_plugin
ilx_workspace
ilx_extension
index.js
rules
ilx_rule
index.js
'use strict'
var f5 = require('f5-nodejs');
var zlib = require('zlib');
var ilx = new f5.ILXServer();
ilx.addMethod('deflate_b64', function(req, res) {
var zip64 = zlib.deflateSync(req.params()[0]).toString('base64');
res.reply(zip64);
});
ilx.addMethod('inflate_b64', function(req, res) {
var unzip = zlib.inflateSync(new Buffer(req.params()[0], 'base64')).toString();
res.reply(unzip);
});
ilx.listen();
ilx_rule
when HTTP_REQUEST {
set handle [ILX::init "ilx_plugin" "ilx_extension"]
set b64response [ILX::call $handle "deflate_b64" "My string to deflate and base64 encoding"]
log local0. "Deflate response: $b64response"
set response [ILX::call $handle "inflate_b64" $b64response]
log local0. "Inflate response: $response"
}
Result:
Apr 4 12:32:01 bigiplab info tmm2[19039]: Rule /Common/ilx_plugin/ilx_rule : Deflate response: eJzzrVQoLinKzEtXKMlXSElNy0ksSVVIzEtRSEosTjUzUUjNS85PAUoDACY7DlU=
Apr 4 12:32:01 bigiplab info tmm2[19039]: Rule /Common/ilx_plugin/ilx_rule : Inflate response: My string to deflate and base64 encoding
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects
