smolnar82 commented on a change in pull request #441:
URL: https://github.com/apache/knox/pull/441#discussion_r624735325
##########
File path:
gateway-applications/src/main/resources/applications/tokengen/app/js/tokengen.js
##########
@@ -52,6 +52,56 @@ function b64DecodeUnicode(str) {
}).join(''));
}
+function setTokenStateServiceStatus() {
+ var pathname = window.location.pathname;
+ var topologyContext = pathname.replace(loginPageSuffix, "");
+ var baseURL = topologyContext.substring(0,
topologyContext.lastIndexOf('/'));
+ baseURL = baseURL.substring(0, baseURL.lastIndexOf('/') + 1);
+ var getTssStausURL = topologyContext +
'knoxtoken/api/v1/token/getTssStatus';
+ var request = ((window.XMLHttpRequest) ? new XMLHttpRequest() : new
ActiveXObject("Microsoft.XMLHTTP"));
+ request.open("GET", getTssStausURL, true);
+ request.send(null);
+ request.onreadystatechange = function() {
+ if (request.readyState == 4) {
+ if (request.status==200) {
+ var resp = JSON.parse(request.responseText);
+ var tokenManagementEnabled = resp.tokenManagementEnabled;
+ if (tokenManagementEnabled === 'true') {
+ var allowedTssForTokengen = resp.allowedTssForTokengen;
+ if (allowedTssForTokengen == 'true') {
+ var actualTssBackend = resp.actualTssBackend;
+ if (actualTssBackend == 'AliasBasedTokenStateService')
{
+ $('#tokenStateServiceStatusWarning').show();
+ $('#tokenStateServiceStatusWarning').text('Token
management backend is configured to store tokens in keystores. This is only
valid non-HA environments!');
+ $('#tokenStateServiceStatusError').hide();
+ $('#tokenStateServiceStatusInfo').hide();
Review comment:
It's not really duplicated as we show/hide different HTML elements in
different if-else cases (info, warning, or error). However, it should've been
clear from the code so I'm going to make it clearer.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]