Skip to content

Commit

Permalink
feat: 支持websocket TencentBlueKing#2494
Browse files Browse the repository at this point in the history
  • Loading branch information
yaoxuwan authored Nov 28, 2024
1 parent 7b68f9a commit 6290bb2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import com.tencent.bkrepo.common.security.http.jwt.JwtAuthProperties
import com.tencent.bkrepo.common.security.manager.AuthenticationManager
import com.tencent.bkrepo.common.security.util.JwtUtils
import com.tencent.bkrepo.websocket.constant.APP_ENDPOINT
import com.tencent.bkrepo.websocket.constant.DESKTOP_ENDPOINT
import com.tencent.bkrepo.websocket.constant.SESSION_ID
import com.tencent.bkrepo.websocket.constant.USER_ENDPOINT
import com.tencent.bkrepo.websocket.service.WebsocketService
Expand Down Expand Up @@ -104,7 +105,7 @@ class SessionHandler(
val sessionId = HostUtils.getRealSession(uri?.query)
when {
uri == null -> throw AuthenticationException("uri is null")
uri.path.startsWith(USER_ENDPOINT) -> {
uri.path.startsWith(USER_ENDPOINT) || uri.path.startsWith(DESKTOP_ENDPOINT) -> {
val platformToken = session.handshakeHeaders[HttpHeaders.AUTHORIZATION]?.firstOrNull()?.toString()
?.removePrefix(PLATFORM_AUTH_PREFIX) ?: throw AuthenticationException("platform credential is null")
val (accessKey, secretKey) = String(Base64.getDecoder().decode(platformToken)).split(COLON)
Expand Down
6 changes: 3 additions & 3 deletions support-files/templates/gateway#vhosts#bkrepo.server.conf
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ server {
# 运营管理后台静态资源网关路径
include vhosts/bkrepo.admin.conf;

# web接口网关路径
include vhosts/bkrepo.web.conf;

# websocket网关路径
include vhosts/bkrepo.websocket.conf;

# web接口网关路径
include vhosts/bkrepo.web.conf;

# 后台的网关路径
include vhosts/bkrepo.backend.conf;
}

0 comments on commit 6290bb2

Please sign in to comment.