You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@linkis.apache.org by pe...@apache.org on 2022/04/03 06:13:05 UTC
[incubator-linkis] branch dev-1.1.1 updated: When a GatewaySSOUtils user successfully logs in to generate a cookie, it does not directly set the second-level domain name, but adds a configuration switch. The default configuration is false. https://github.com/apache/incubator-linkis/issues/1897 (#1898)
This is an automated email from the ASF dual-hosted git repository.
peacewong pushed a commit to branch dev-1.1.1
in repository https://gitbox.apache.org/repos/asf/incubator-linkis.git
The following commit(s) were added to refs/heads/dev-1.1.1 by this push:
new 21caff8 When a GatewaySSOUtils user successfully logs in to generate a cookie, it does not directly set the second-level domain name, but adds a configuration switch. The default configuration is false. https://github.com/apache/incubator-linkis/issues/1897 (#1898)
21caff8 is described below
commit 21caff800ebe026f22a461dd39a490be4ddff0b6
Author: weixiao <le...@gmail.com>
AuthorDate: Sun Apr 3 14:12:59 2022 +0800
When a GatewaySSOUtils user successfully logs in to generate a cookie, it does not directly set the second-level domain name, but adds a configuration switch. The default configuration is false. https://github.com/apache/incubator-linkis/issues/1897 (#1898)
Co-authored-by: leo_jie <we...@aliyun.com>
---
.../org/apache/linkis/gateway/config/GatewayConfiguration.scala | 3 ++-
.../scala/org/apache/linkis/gateway/security/GatewaySSOUtils.scala | 7 +++++--
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/linkis-spring-cloud-services/linkis-service-gateway/linkis-gateway-core/src/main/scala/org/apache/linkis/gateway/config/GatewayConfiguration.scala b/linkis-spring-cloud-services/linkis-service-gateway/linkis-gateway-core/src/main/scala/org/apache/linkis/gateway/config/GatewayConfiguration.scala
index af27f83..fecb4f7 100644
--- a/linkis-spring-cloud-services/linkis-service-gateway/linkis-gateway-core/src/main/scala/org/apache/linkis/gateway/config/GatewayConfiguration.scala
+++ b/linkis-spring-cloud-services/linkis-service-gateway/linkis-gateway-core/src/main/scala/org/apache/linkis/gateway/config/GatewayConfiguration.scala
@@ -70,7 +70,8 @@ object GatewayConfiguration {
val GATEWAY_HEADER_ALLOW_METHOD = CommonVars("wds.linkis.gateway.header.allow.methods", "POST, GET, OPTIONS, PUT, HEAD, DELETE")
- val GATEWAY_DOMAIN_LEVEL = CommonVars("wds.linkis.gateway.domain.level", 3)
+ val GATEWAY_DOMAIN_LEVEL = CommonVars("wds.linkis.gateway.domain.level", 3)
+ val GATEWAY_COOKIE_DOMAIN_SETUP_SWITCH = CommonVars("wds.linkis.gateway.cookie.domain.setup.switch", false)
// Use regex to match against URLs, if matched, let them pass anyway(even if not currently logged in), Use "()" and "|" to match against multiple URLs
val GATEWAY_NO_AUTH_URL_REGEX = CommonVars("wds.linkis.gateway.no.auth.url.regex", ".*visualis.*share.*")
diff --git a/linkis-spring-cloud-services/linkis-service-gateway/linkis-gateway-core/src/main/scala/org/apache/linkis/gateway/security/GatewaySSOUtils.scala b/linkis-spring-cloud-services/linkis-service-gateway/linkis-gateway-core/src/main/scala/org/apache/linkis/gateway/security/GatewaySSOUtils.scala
index 210d2e3..5caed1a 100644
--- a/linkis-spring-cloud-services/linkis-service-gateway/linkis-gateway-core/src/main/scala/org/apache/linkis/gateway/security/GatewaySSOUtils.scala
+++ b/linkis-spring-cloud-services/linkis-service-gateway/linkis-gateway-core/src/main/scala/org/apache/linkis/gateway/security/GatewaySSOUtils.scala
@@ -33,6 +33,7 @@ object GatewaySSOUtils extends Logging {
private val IP_REGEX = "([^:]+):.+".r
private val level = GatewayConfiguration.GATEWAY_DOMAIN_LEVEL.getValue
+ private val cookieDomainSetupSwitch = GatewayConfiguration.GATEWAY_COOKIE_DOMAIN_SETUP_SWITCH.getValue
/**
* "dss.com" -> "dss.com"
@@ -69,8 +70,10 @@ object GatewaySSOUtils extends Logging {
def setLoginUser(gatewayContext: GatewayContext, username: String): Unit = {
val proxyUser = ProxyUserUtils.getProxyUser(username)
SSOUtils.setLoginUser(c => {
- val host = gatewayContext.getRequest.getHeaders.get("Host")
- if(host != null && host.nonEmpty) c.setDomain(getCookieDomain(host.head))
+ if (cookieDomainSetupSwitch) {
+ val host = gatewayContext.getRequest.getHeaders.get("Host")
+ if(host != null && host.nonEmpty) c.setDomain(getCookieDomain(host.head))
+ }
gatewayContext.getResponse.addCookie(c)
}, proxyUser)
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@linkis.apache.org
For additional commands, e-mail: commits-help@linkis.apache.org