Skip to content

Commit

Permalink
Pulling in jquery from npm modules rather http GET. Added ability to …
Browse files Browse the repository at this point in the history
…collapse all of the forms on debugger2 page.
  • Loading branch information
rcbjBlueMars committed Dec 30, 2024
1 parent f82f26e commit 858662a
Show file tree
Hide file tree
Showing 12 changed files with 66 additions and 34 deletions.
3 changes: 2 additions & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"@peculiar/asn1-pkcs8": "latest",
"envify": "latest",
"bunyan": "latest",
"dompurify": "latest"
"dompurify": "latest",
"jquery": "latest"
}
}
2 changes: 0 additions & 2 deletions client/public/debugger.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@

<div class="container">

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js" type="text/javascript">
</script>
<script type="text/javascript" src="/js/debugger.js">
</script>
<p>This is a simple Client to use with any <a href="https://medium.com/@robert.broeckelmann/saml2-vs-jwt-understanding-oauth2-4abde9e7ec8b">OAuth2</a> or <a href="https://medium.com/@robert.broeckelmann/understanding-openid-connect-series-37c93d25e92b">OpenID Connect</a> compliant identity provider..
Expand Down
32 changes: 19 additions & 13 deletions client/public/debugger2.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@

<div class="container">

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js" type="text/javascript">
</script>
<script type="text/javascript" src="/js/debugger2.js"></script>

<p>This is a simple Client to use with any <a href="https://medium.com/@robert.broeckelmann/saml2-vs-jwt-understanding-oauth2-4abde9e7ec8b">OAuth2</a> or <a href="https://medium.com/@robert.broeckelmann/understanding-openid-connect-series-37c93d25e92b">OpenID Connect</a> compliant identity provider..
Expand All @@ -42,16 +40,13 @@
<div class="authz-error-report" id="authz-error-report"></div>

<div class="step0" id="step0">
<legend>Configuration Parameters</legend>
<form id="step0_expand_form">
<input class="btn2" type="submit" name="config_expand_button" id="config_expand_button" value="Hide" onclick="return debugger2.onClickShowConfigFieldSet('config_fieldset');"/>
<input class="btn2" type="submit" name="config_expand_button" id="config_expand_button" value="Hide" onclick="return debugger2.onClickShowFieldSet('config_expand_button', 'config_fieldset');"/>
</form>
<fieldset id="config_fieldset" name="config_fieldset" style="display: block;">
<legend>Configuration Parameters
<div class="form-group">
<input type="hidden" name="response_type" value="" id="response_type" />
</div>
</legend>
<form action="" id="endpoints" name="endpoints">
<input type="hidden" name="response_type" value="" id="response_type" />
<table border="0">
<tbody>
<tr>
Expand Down Expand Up @@ -152,6 +147,9 @@
<div class="step3" id="step3">
<legend id="h2_title_2" name="h2_title_2">Exchange Authorization Code for Access Token
</legend>
<form id="step0_expand_form">
<input class="btn2" type="submit" name="token_expand_button" id="token_expand_button" value="Hide" onclick="return debugger2.onClickShowFieldSet('token_expand_button', 'token_fieldset');"/>
</form>
<fieldset id="token_fieldset" name="token_fieldset" style="display: block;">
<input class="input" id="token_grant_type" name="grant_type" type="hidden" value="authorization_code" />
<table>
Expand Down Expand Up @@ -331,10 +329,13 @@
</div>

<div class="step4" id="step4">
<fieldset id="refresh_fieldset" name="refresh_fieldset">
<legend id="h2_title_3" name="h2_title_3">Obtain New Access Token Using Refresh Token
<input class="input" id="refresh_grant_type" name="refresh_grant_type" type="hidden" value="refresh_token" />
<legend>Obtain New Access Token Using Refresh Token
</legend>
<form>
<input class="btn2" type="submit" name="refresh_expand_button" id="refresh_expand_button" value="Hide" onclick="return debugger2.onClickShowFieldSet('refresh_expand_button', 'refresh_fieldset');"/>
</form>
<fieldset id="refresh_fieldset" name="refresh_fieldset">
<input class="input" id="refresh_grant_type" name="refresh_grant_type" type="hidden" value="refresh_token" />
<table>
<tbody>
<tr>
Expand Down Expand Up @@ -397,9 +398,13 @@
<div class="refresh_endpoint_result" id="refresh_endpoint_result">&nbsp;
</div>
<div class="step5" id="step5">
<fieldset id="logout_fieldset" name="logout_fieldset">
<legend id="h2_title_3" name="h2_title_3">RP-initiated Logout
<legend>RP-initiated Logout
</legend>
<form>
<input class="btn2" type="submit" name="logout_expand_button" id="logout_expand_button" value="Hide" onclick="return debugger2.onClickShowFieldSet('logout_expand_button', 'logout_fieldset');"/>
</form>
<fieldset id="logout_fieldset" name="logout_fieldset" style="display: block;">
<form>
<table>
<tbody>
<tr>
Expand Down Expand Up @@ -448,6 +453,7 @@
</tr>
</tbody>
</table>
</form>
</fieldset>

</div>
Expand Down
2 changes: 0 additions & 2 deletions client/public/jwks.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@

<div class="container">

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" type="text/javascript">
</script>
<script type="text/javascript" src="/js/jwks.js">
</script>
<div class="step0" id="step0">
Expand Down
2 changes: 0 additions & 2 deletions client/public/privacypolicy.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@

<div class="container">

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" type="text/javascript">
</script>
<header class="entry-header">

<h1 class="page-title">Privacy Policy</h1>
Expand Down
1 change: 0 additions & 1 deletion client/public/userinfo.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
</div>

<div class="container">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" type="text/javascript"/></script>
<script type="text/javascript" src="/js/userinfo.js"></script>

<legend>Configuration Parameters
Expand Down
30 changes: 27 additions & 3 deletions client/src/debugger.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
var appconfig = require(process.env.CONFIG_FILE);
var bunyan = require("bunyan");
var DOMPurify = require("dompurify");
var $ = require("jquery");
console.log("logLevel: " + appconfig.logLevel);
var log = bunyan.createLogger({ name: 'debugger',
level: appconfig.logLevel });
Expand Down Expand Up @@ -59,6 +60,8 @@ function getParameterByName(name, url)

$(document).ready(function() {
log.debug("Entering ready function.");
// Eliminating use of window.onload function.
onload();
$("#authorization_grant_type").change(function() {
log.debug("Entering selection changed function().");
var value = $(this).val();
Expand All @@ -73,9 +76,30 @@ $(document).ready(function() {
var value = $("#authorization_grant_type").value;
resetUI(value);
recalculateAuthorizationRequestDescription();
initializeUIPostDebuggerInitialization();
log.debug("Leaving ready function.");
});

function initializeUIPostDebuggerInitialization()
{
log.debug("Entering initializeUIPostDebuggerInitialization().");
var debuggerInitialized = false;
if (localStorage) {
debuggerInitialized = getLSBooleanItem("debugger_initialized");
}
log.debug("debugger_initialized: " + debuggerInitialized);
if (debuggerInitialized) {
log.debug("The debugger configuration has been initialized through Discovery.");
document.getElementById("oidc_fieldset").style.display = "none";
document.getElementById("oidc_expand_button").value = "Expand";
document.getElementById("config_fieldset").style.display = "none";
document.getElementById("config_expand_button").value = "Expand";
document.getElementById("authz_fieldset").style.display = "block";
document.getElementById("authz_expand_button").value = "Collapse";
}
log.debug("Leaving initializeUIPostDebuggerInitialization().");
}

function resetUI(value)
{
log.debug("Entering resetUI().");
Expand Down Expand Up @@ -789,7 +813,7 @@ function recalculateRefreshRequestDescription()
log.debug("Leaving recalculateRefreshRequestDescription().");
}

window.onload = function() {
function onload() {
log.debug("Entering onload function.");
$("#password-form-group1").hide();
$("#password-form-group2").hide();
Expand Down Expand Up @@ -834,7 +858,6 @@ window.onload = function() {
localStorage.setItem("authzcustomParametersCheck-no", document.getElementById("authzcustomParametersCheck-no").checked);
localStorage.setItem("usePKCE-yes", document.getElementById("usePKCE-yes").checked );
localStorage.setItem("usePKCE-no", document.getElementById("usePKCE-no").checked );

log.debug("Leaving auth_step submit event listener function.");
});
}
Expand Down Expand Up @@ -960,7 +983,7 @@ $("#auth_step").submit(function () {
})
.prop("name", "");
});
log.debug("Leaving auth_step submit function.");
log.debug("Registered auth_step submit function.");
});

function recalculateAuthorizationErrorDescription()
Expand Down Expand Up @@ -1325,6 +1348,7 @@ function onSubmitPopulateFormsWithDiscoveryInformation() {
localStorage.setItem("token_scope", scopesSupported );
localStorage.setItem("jwks_endpoint", jwksUri);
localStorage.setItem("end_session_endpoint", endSessionEndpoint);
localStorage.setItem("debugger_initialized", true);
}
log.debug('Leaving OnSubmitPopulateFormsWithDiscoveryInformation().');
return true;
Expand Down
24 changes: 14 additions & 10 deletions client/src/debugger2.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
var appconfig = require(process.env.CONFIG_FILE);
var bunyan = require("bunyan");
var DOMPurify = require("dompurify");
var $ = require("jquery");
var log = bunyan.createLogger({ name: 'debugger2',
level: appconfig.logLevel });
log.info("Log initialized. logLevel=" + log.level());
Expand Down Expand Up @@ -1664,16 +1665,19 @@ function generateCustomParametersListUI()
recalculateTokenRequestDescription();
}

function onClickShowConfigFieldSet(id) {
log.debug('Entering onClickShowConfigFieldSet(). id=' + id + ', style.display=' + document.getElementById(id).style.display);
if(document.getElementById(id).style.display == 'block') {
log.debug('Hide ' + id + '.');
document.getElementById(id).style.display = 'none'
document.getElementById("config_expand_button").value='Expand';
function onClickShowFieldSet(expand_button_id, field_set_id) {
log.debug('Entering onClickShowConfigFieldSet(). expand_button_id='
+ expand_button_id + ', field_set_id=' + field_set_id
+ ', fieldset.style.display=' + document.getElementById(field_set_id).style.display
+ ', expand_button.value=' + document.getElementById(expand_button_id).value);
if(document.getElementById(field_set_id).style.display == 'block') {
log.debug('Hide ' + field_set_id + '.');
document.getElementById(field_set_id).style.display = 'none'
document.getElementById(expand_button_id).value='Expand';
} else {
log.debug('Show ' + id + '.');
document.getElementById(id).style.display = 'block';
document.getElementById("config_expand_button").value='Hide';
log.debug('Show ' + field_set_id + '.');
document.getElementById(field_set_id).style.display = 'block';
document.getElementById(expand_button_id).value='Hide';
}
document.getElementById("step0_expand_form").addEventListener("click", function(event) {
event.preventDefault();
Expand Down Expand Up @@ -1777,7 +1781,7 @@ regenerateNonce,
recreateTokenDisplay,
displayTokenCustomParametersCheck,
generateCustomParametersListUI,
onClickShowConfigFieldSet,
onClickShowFieldSet,
initFields,
usePKCERFC,
setPostAuthStyleCheckToken,
Expand Down
1 change: 1 addition & 0 deletions client/src/jwks.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
//
var appconfig = require(process.env.CONFIG_FILE);
var bunyan = require("bunyan");
var $ = require("jquery");
var log = bunyan.createLogger({ name: 'jwks',
level: appconfig.logLevel });
log.info("Log initialized. logLevel=" + log.level());
Expand Down
1 change: 1 addition & 0 deletions client/src/logout.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
//
var appconfig = require(process.env.CONFIG_FILE);
var bunyan = require("bunyan");
var $ = require("jquery");
var log = bunyan.createLogger({ name: 'logout',
level: appconfig.logLevel });
log.info("Log initialized. logLevel=" + log.level());
Expand Down
1 change: 1 addition & 0 deletions client/src/token_detail.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//
var appconfig = require(process.env.CONFIG_FILE);
var bunyan = require("bunyan");
var $ = require("jquery");
var log = bunyan.createLogger({ name: 'token_detail',
level: appconfig.logLevel });
log.info("Log initialized. logLevel=" + log.level());
Expand Down
1 change: 1 addition & 0 deletions client/src/userinfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
//
var appconfig = require(process.env.CONFIG_FILE);
var bunyan = require("bunyan");
var $ = require("jquery");
var log = bunyan.createLogger({ name: 'userinfo',
level: appconfig.logLevel });
log.info("Log initialized. logLevel=" + log.level());
Expand Down

0 comments on commit 858662a

Please sign in to comment.