You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@knox.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2021/05/02 18:25:00 UTC

[jira] [Work logged] (KNOX-2597) Fallback to AliasBasedTokenStateService in case of DB errors

     [ https://issues.apache.org/jira/browse/KNOX-2597?focusedWorklogId=592024&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-592024 ]

ASF GitHub Bot logged work on KNOX-2597:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 02/May/21 18:24
            Start Date: 02/May/21 18:24
    Worklog Time Spent: 10m 
      Work Description: 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:
users@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 592024)
    Time Spent: 0.5h  (was: 20m)

> Fallback to AliasBasedTokenStateService in case of DB errors
> ------------------------------------------------------------
>
>                 Key: KNOX-2597
>                 URL: https://issues.apache.org/jira/browse/KNOX-2597
>             Project: Apache Knox
>          Issue Type: Task
>    Affects Versions: 1.6.0
>            Reporter: Sandor Molnar
>            Assignee: Sandor Molnar
>            Priority: Major
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> We recently added support to pure JDBC-based token state management. It'd be great to make deployments smooth with the following safety net: if there is (are) any issue(s) with the configured DB connection, the Knox Gateway should start using the {{AliasBasedTokenStateService}} instead of fail-fast. Additionally, the {{tokengen}} UI should indicate the fact if the underlying token back-end is the one the user configured.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)