You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by xx...@apache.org on 2022/12/07 03:37:54 UTC

[kylin] branch kylin5 updated (21a6b9f7f6 -> 6496e014f0)

This is an automated email from the ASF dual-hosted git repository.

xxyu pushed a change to branch kylin5
in repository https://gitbox.apache.org/repos/asf/kylin.git


    from 21a6b9f7f6 KYLIN-5326 Fix request parameter json deserializer
     new ea2efd9e73 [KYLIN-5310] fix spring session timeout config not work issue when the session store-type is jdbc
     new 6496e014f0 [KYLIN-5310] adjust code format

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../java/org/apache/kylin/common/KylinConfigBase.java    |  5 +++++
 .../apache/kylin/rest/controller/NUserController.java    | 16 ++++++++++++++++
 2 files changed, 21 insertions(+)


[kylin] 02/02: [KYLIN-5310] adjust code format

Posted by xx...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xxyu pushed a commit to branch kylin5
in repository https://gitbox.apache.org/repos/asf/kylin.git

commit 6496e014f0ef0f48b5d66cdb8ab3e6ed8d2830ec
Author: cli2 <ss...@pku.edu.cn>
AuthorDate: Thu Dec 1 11:19:44 2022 +0800

    [KYLIN-5310] adjust code format
---
 .../src/main/java/org/apache/kylin/rest/controller/NUserController.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/metadata-server/src/main/java/org/apache/kylin/rest/controller/NUserController.java b/src/metadata-server/src/main/java/org/apache/kylin/rest/controller/NUserController.java
index 4dee368683..37b64a1917 100644
--- a/src/metadata-server/src/main/java/org/apache/kylin/rest/controller/NUserController.java
+++ b/src/metadata-server/src/main/java/org/apache/kylin/rest/controller/NUserController.java
@@ -645,7 +645,7 @@ public class NUserController extends NBasicController implements ApplicationList
                 ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes()))
                         .getRequest();
         //todo other session store-type
-        if (type.equals("jbdc")) {
+        if ("jbdc".equals(type)) {
             request.getSession().setMaxInactiveInterval(env.getJdbcSessionMaxInactiveInterval());
         }
     }


[kylin] 01/02: [KYLIN-5310] fix spring session timeout config not work issue when the session store-type is jdbc

Posted by xx...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xxyu pushed a commit to branch kylin5
in repository https://gitbox.apache.org/repos/asf/kylin.git

commit ea2efd9e7342affeb8db7729e5c6006c5833e8ef
Author: cli2 <ss...@pku.edu.cn>
AuthorDate: Thu Dec 1 10:53:13 2022 +0800

    [KYLIN-5310] fix spring session timeout config not work issue when the session store-type is jdbc
---
 .../java/org/apache/kylin/common/KylinConfigBase.java    |  5 +++++
 .../apache/kylin/rest/controller/NUserController.java    | 16 ++++++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/src/core-common/src/main/java/org/apache/kylin/common/KylinConfigBase.java b/src/core-common/src/main/java/org/apache/kylin/common/KylinConfigBase.java
index dec30004b8..c1a6e84bb3 100644
--- a/src/core-common/src/main/java/org/apache/kylin/common/KylinConfigBase.java
+++ b/src/core-common/src/main/java/org/apache/kylin/common/KylinConfigBase.java
@@ -2931,6 +2931,11 @@ public abstract class KylinConfigBase implements Serializable {
         return getOptional("spring.session.store-type", "");
     }
 
+
+    public int getJdbcSessionMaxInactiveInterval() {
+        return Integer.parseInt(getOptional("spring.session.timeout", "3600"));
+    }
+
     public int getCapacitySampleRows() {
         return Integer.parseInt(getOptional("kylin.capacity.sample-rows", "1000"));
     }
diff --git a/src/metadata-server/src/main/java/org/apache/kylin/rest/controller/NUserController.java b/src/metadata-server/src/main/java/org/apache/kylin/rest/controller/NUserController.java
index 5321112578..4dee368683 100644
--- a/src/metadata-server/src/main/java/org/apache/kylin/rest/controller/NUserController.java
+++ b/src/metadata-server/src/main/java/org/apache/kylin/rest/controller/NUserController.java
@@ -105,6 +105,10 @@ import com.google.common.collect.Sets;
 import io.swagger.annotations.ApiOperation;
 import lombok.SneakyThrows;
 import lombok.val;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+
+import javax.servlet.http.HttpServletRequest;
 
 @Controller
 @RequestMapping(value = "/api/user", produces = { HTTP_VND_APACHE_KYLIN_JSON })
@@ -475,6 +479,7 @@ public class NUserController extends NBasicController implements ApplicationList
     @ResponseBody
     public EnvelopeResponse<UserDetails> authenticate() {
         EnvelopeResponse<UserDetails> response = authenticatedUser();
+        checkSessionStoreType(KylinConfig.getInstanceFromEnv());
         logger.debug("User login: {}", response.getData());
         return response;
     }
@@ -633,4 +638,15 @@ public class NUserController extends NBasicController implements ApplicationList
             throw new KylinException(REPEATED_PARAMETER, "authorities");
         }
     }
+
+    private void checkSessionStoreType(KylinConfig env) {
+        String type = env.getSpringStoreType();
+        HttpServletRequest request =
+                ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes()))
+                        .getRequest();
+        //todo other session store-type
+        if (type.equals("jbdc")) {
+            request.getSession().setMaxInactiveInterval(env.getJdbcSessionMaxInactiveInterval());
+        }
+    }
 }