From 858662a9c01408b56b849fa33935f2850a1deb3c Mon Sep 17 00:00:00 2001 From: rcbjBlueMars <9321971+rcbjBlueMars@users.noreply.github.com> Date: Mon, 30 Dec 2024 08:56:05 -0800 Subject: [PATCH] Pulling in jquery from npm modules rather http GET. Added ability to collapse all of the forms on debugger2 page. --- client/package.json | 3 ++- client/public/debugger.html | 2 -- client/public/debugger2.html | 32 +++++++++++++++++++------------- client/public/jwks.html | 2 -- client/public/privacypolicy.html | 2 -- client/public/userinfo.html | 1 - client/src/debugger.js | 30 +++++++++++++++++++++++++++--- client/src/debugger2.js | 24 ++++++++++++++---------- client/src/jwks.js | 1 + client/src/logout.js | 1 + client/src/token_detail.js | 1 + client/src/userinfo.js | 1 + 12 files changed, 66 insertions(+), 34 deletions(-) diff --git a/client/package.json b/client/package.json index 5845596..38f2bc5 100644 --- a/client/package.json +++ b/client/package.json @@ -18,6 +18,7 @@ "@peculiar/asn1-pkcs8": "latest", "envify": "latest", "bunyan": "latest", - "dompurify": "latest" + "dompurify": "latest", + "jquery": "latest" } } diff --git a/client/public/debugger.html b/client/public/debugger.html index 8a78e5e..370020d 100644 --- a/client/public/debugger.html +++ b/client/public/debugger.html @@ -31,8 +31,6 @@
-

This is a simple Client to use with any OAuth2 or OpenID Connect compliant identity provider.. diff --git a/client/public/debugger2.html b/client/public/debugger2.html index 3fba47d..42f398a 100644 --- a/client/public/debugger2.html +++ b/client/public/debugger2.html @@ -31,8 +31,6 @@

-

This is a simple Client to use with any OAuth2 or OpenID Connect compliant identity provider.. @@ -42,16 +40,13 @@

+ Configuration Parameters
- +
- Configuration Parameters -
- -
-
+ @@ -152,6 +147,9 @@
Exchange Authorization Code for Access Token + + +
@@ -331,10 +329,13 @@
-
- Obtain New Access Token Using Refresh Token - + Obtain New Access Token Using Refresh Token +
+ + +
+
@@ -397,9 +398,13 @@
 
-
- RP-initiated Logout + RP-initiated Logout +
+ + +
+
@@ -448,6 +453,7 @@
+
diff --git a/client/public/jwks.html b/client/public/jwks.html index 663ac1a..ead9a0e 100644 --- a/client/public/jwks.html +++ b/client/public/jwks.html @@ -31,8 +31,6 @@
-
diff --git a/client/public/privacypolicy.html b/client/public/privacypolicy.html index 99b349c..1744908 100644 --- a/client/public/privacypolicy.html +++ b/client/public/privacypolicy.html @@ -40,8 +40,6 @@
-

Privacy Policy

diff --git a/client/public/userinfo.html b/client/public/userinfo.html index afb316b..241d2ff 100644 --- a/client/public/userinfo.html +++ b/client/public/userinfo.html @@ -30,7 +30,6 @@
- Configuration Parameters diff --git a/client/src/debugger.js b/client/src/debugger.js index 240c975..2bc16cd 100644 --- a/client/src/debugger.js +++ b/client/src/debugger.js @@ -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 }); @@ -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(); @@ -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()."); @@ -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(); @@ -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."); }); } @@ -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() @@ -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; diff --git a/client/src/debugger2.js b/client/src/debugger2.js index bda609d..54005a8 100644 --- a/client/src/debugger2.js +++ b/client/src/debugger2.js @@ -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()); @@ -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(); @@ -1777,7 +1781,7 @@ regenerateNonce, recreateTokenDisplay, displayTokenCustomParametersCheck, generateCustomParametersListUI, -onClickShowConfigFieldSet, +onClickShowFieldSet, initFields, usePKCERFC, setPostAuthStyleCheckToken, diff --git a/client/src/jwks.js b/client/src/jwks.js index 933e77f..d0f3902 100644 --- a/client/src/jwks.js +++ b/client/src/jwks.js @@ -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()); diff --git a/client/src/logout.js b/client/src/logout.js index 27ae615..7777efe 100644 --- a/client/src/logout.js +++ b/client/src/logout.js @@ -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()); diff --git a/client/src/token_detail.js b/client/src/token_detail.js index b0b0d19..140bfa3 100644 --- a/client/src/token_detail.js +++ b/client/src/token_detail.js @@ -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()); diff --git a/client/src/userinfo.js b/client/src/userinfo.js index 8f360e3..8acbf00 100644 --- a/client/src/userinfo.js +++ b/client/src/userinfo.js @@ -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());