decode button

This commit is contained in:
Alfredo Oliviero 2024-03-05 09:48:43 +01:00
parent b77c02b171
commit 1a956b4e25
2 changed files with 28 additions and 4 deletions

View File

@ -2,7 +2,7 @@
## [v1.2.0] - 2023-03-20
- TODO:
- Decode Button
## [v1.0.1] - 2022-05-25

View File

@ -10,12 +10,27 @@ pageContext.setAttribute("userGroups", userGroups);
List<String> userContexts = (List<String>) request.getAttribute("userContexts");
pageContext.setAttribute("userContexts", userContexts);
%>
<script type="text/javascript">
function decodeFunction(token) {
var token = $("#tokenResult").val();
$('#txt_name').val();
window.open(
"https://jwt.io/#id_token=" + token,
'_blank' // <- This is what makes it open in a new window.
);
}
function getUMAToken(endpoint) {
console.log("getUMAToken:" + endpoint);
$('#umaButton').attr("disabled", true);
$('#buttonCopy').hide();
$('#div_decode').hide();
var selectedContext = $("#myselect").val();
$('#tokenResult').text('');
$.ajax({
@ -30,6 +45,11 @@ pageContext.setAttribute("userContexts", userContexts);
if (resultObject.success) {
$('#tokenResult').text(resultObject.comment);
$('#buttonCopy').show();
$('#div_decode').show();
//console.log("resultObject", resultObject)
$('jsonresp').html(resultObject)
} else {
$('#tokenResult').text(resultObject.comment);
$('#tokenResult').css('color', 'red');
@ -70,12 +90,16 @@ pageContext.setAttribute("userContexts", userContexts);
<button id="buttonCopy" class="btn btn-mini" onclick="copyFunction()">
<i class="icon-copy"></i> Copy
</button>
<textarea style="width: 90%;" 300px; margin: 10px;" id="tokenResult"></textarea>
</div>
<div>
You can use <a href="https://jwt.io/" target="blank">https://jwt.io/</a>
to decode.
<div id="div_decode">
You can use <a href="https://jwt.io/#debugger-io" target="blank">https://jwt.io/</a>
to <button id="buttonDecode" class="btn btn-mini" onclick="decodeFunction()">
<i class="icon-repository"></i> Decode
</button>
</div>
<script>
$('#buttonCopy').hide();
$('#div_decode').hide();
</script>