Skip to content

Instantly share code, notes, and snippets.

@AlainODea
Created August 1, 2018 19:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AlainODea/9fd46ef07e254283f0277c1bdb827dd8 to your computer and use it in GitHub Desktop.
Save AlainODea/9fd46ef07e254283f0277c1bdb827dd8 to your computer and use it in GitHub Desktop.
Local web page that can decode URL-encoded Base64-encoded content (like SAMLResponse)
<!DOCTYPE html>
<html>
<head>
<title>URL Encoded Base 64 Decoder</title>
<script type="text/javascript">
function decode() {
var urlDecoded = decodeURIComponent(document.getElementById('urlencoded-base64-input').value);
var base64Decoded = atob(urlDecoded);
var encodedStr = base64Decoded.replace(/[\u00A0-\u9999<>\&]/gim, function(i) {
return '&#' + i.charCodeAt(0) + ';';
});
var result = encodedStr;
document.getElementById('plain-output').innerHTML = result;
}
</script>
</head>
<body>
<div>
<textarea rows="10" cols="50" id="urlencoded-base64-input"></textarea>
</div>
<div>
<input type="button" onclick="decode()" value="Decode" />
</div>
<div>
<textarea rows="80" cols="80" id="plain-output"></textarea>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment