-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdemo-post.js
29 lines (21 loc) · 925 Bytes
/
demo-post.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/* global Buffer */
var async = require('async');
var saml = require('./');
var str = '<?xml version="1.0" encoding="UTF-8"?><samlp:AuthnRequest xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" ID="dghihjdeegajbpejllikgcpnkceilmnmblhaidgl" Version="2.0" IssueInstant="2016-01-27T19:57:05Z" ProtocolBinding="urn:oasis:names.tc:SAML:2.0:bindings:HTTP-Redirect" ProviderName="pennmutual.com/prodplace" AssertionConsumerServiceURL=""/>';
console.log("ORIGINAL:\n", str);
async.waterfall([
async.apply(saml.encodeSamlPost, str),
encodeCallback,
saml.decodeSamlPost,
decodeCallback
], function (err, result) {
console.log('\n\nFinal Result:', result);
});
function encodeCallback(encoded, callback) {
console.log("\n\nENCODED:\n", encoded);
callback(null, encoded);
}
function decodeCallback(decoded, callback) {
console.log("\n\nDECODED:\n", decoded);
callback(null, decoded);
}