forked from TencentBlueKing/bk-repo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 镜像制品删除优化 TencentBlueKing#203 (TencentBlueKing#582)
* bug: 添加第三方镜像仓库package拉取扩展点 TencentBlueKing#462 * bug: 镜像仓库支持remote代理 TencentBlueKing#462 * bug: 接口调整 TencentBlueKing#462 * bug: 引用调整 TencentBlueKing#462 * bug: 代理url校验 TencentBlueKing#462 * bug: 代码优化 TencentBlueKing#462 * bug: 引用调整 TencentBlueKing#462 * bug: 代码调整 TencentBlueKing#462 * bug: 代码调整 TencentBlueKing#462 * bug: token缓存key调整 TencentBlueKing#462 * bug: 代码调整 TencentBlueKing#462 * bug: 代码调整 TencentBlueKing#462 * feat: 代码调整 TencentBlueKing#203 * feat: blob存储节点路径调整 TencentBlueKing#203 * feat: blob刷新接口 TencentBlueKing#203 * feat: 包与版本删除逻辑调整 TencentBlueKing#203 * feat: 方法名调整 TencentBlueKing#203 * feat: 版本删除路径调整 TencentBlueKing#203 * feat: 接口调整 TencentBlueKing#203 * feat: 删除逻辑调整 TencentBlueKing#203 * feat: blob节点刷新代码调整 TencentBlueKing#203 * feat: 增加打印 TencentBlueKing#203 * feat: 获取节点路径调整 TencentBlueKing#203 * feat: 节点刷新接口逻辑调整 TencentBlueKing#203 * feat: 代码调整 TencentBlueKing#203 * feat: 代码调整 TencentBlueKing#203 * feat: 去掉注释 TencentBlueKing#203 * feat: 代码调整 TencentBlueKing#203 * feat: 禁止v1的镜像manifest文件上传,部分客户端拉取会报错 TencentBlueKing#908 * bug: feign请求字段返回先转换成String再进行类型转换 TencentBlueKing#892 (cherry picked from commit ec46147) * bug: catalog相关接口调整 TencentBlueKing#203 * bug: 路径拼接调整 TencentBlueKing#203 * bug: 当包下没有版本时需要删掉包目录,清除存储在blobs目录下数据 TencentBlueKing#203 * feat: 历史数据修正方案调整 TencentBlueKing#203 * bug: 解决代码冲突TencentBlueKing#203 * bug: 代码扫描问题修复TencentBlueKing#203 * bug: 代码问题修复TencentBlueKing#203 * bug: 代码检查问题修复TencentBlueKing#203 * bug: mount上传增加元数据,用于区别新老 blob 存储路径TencentBlueKing#203 * bug: 镜像刷新前先判断是否已经是新版本路径TencentBlueKing#203 * feat: 镜像blob路径调整后,分发对应获取路径调整 TencentBlueKing#203
- Loading branch information
Showing
58 changed files
with
1,923 additions
and
1,031 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
...n/common-api/src/main/kotlin/com/tencent/bkrepo/common/api/constant/AuthenticationKeys.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Tencent is pleased to support the open source community by making BK-CI 蓝鲸持续集成平台 available. | ||
* | ||
* Copyright (C) 2022 THL A29 Limited, a Tencent company. All rights reserved. | ||
* | ||
* BK-CI 蓝鲸持续集成平台 is licensed under the MIT license. | ||
* | ||
* A copy of the MIT License is included in this file. | ||
* | ||
* | ||
* Terms of the MIT License: | ||
* --------------------------------------------------- | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated | ||
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation the | ||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to | ||
* permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of | ||
* the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT | ||
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN | ||
* NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
*/ | ||
|
||
package com.tencent.bkrepo.common.api.constant | ||
|
||
object AuthenticationKeys { | ||
const val BEARER_REALM = "Bearer realm" | ||
const val SERVICE = "service" | ||
const val SCOPE = "scope" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
...ommon/common-api/src/main/kotlin/com/tencent/bkrepo/common/api/util/AuthenticationUtil.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* Tencent is pleased to support the open source community by making BK-CI 蓝鲸持续集成平台 available. | ||
* | ||
* Copyright (C) 2022 THL A29 Limited, a Tencent company. All rights reserved. | ||
* | ||
* BK-CI 蓝鲸持续集成平台 is licensed under the MIT license. | ||
* | ||
* A copy of the MIT License is included in this file. | ||
* | ||
* | ||
* Terms of the MIT License: | ||
* --------------------------------------------------- | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated | ||
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation the | ||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to | ||
* permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of | ||
* the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT | ||
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN | ||
* NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | ||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
*/ | ||
|
||
package com.tencent.bkrepo.common.api.util | ||
|
||
import com.tencent.bkrepo.common.api.constant.AuthenticationKeys.BEARER_REALM | ||
import com.tencent.bkrepo.common.api.constant.AuthenticationKeys.SCOPE | ||
import com.tencent.bkrepo.common.api.constant.AuthenticationKeys.SERVICE | ||
import com.tencent.bkrepo.common.api.constant.StringPool | ||
import com.tencent.bkrepo.common.api.pojo.authentication.AuthenticationProperty | ||
|
||
object AuthenticationUtil { | ||
|
||
/** | ||
* 解析返回头中的WWW_AUTHENTICATE字段, 只针对为Bearer realm | ||
*/ | ||
fun parseWWWAuthenticateHeader(wwwAuthenticate: String, scope: String?): AuthenticationProperty? { | ||
val map: MutableMap<String, String> = mutableMapOf() | ||
return try { | ||
val params = wwwAuthenticate.split("\",") | ||
params.forEach { | ||
val param = it.split(Regex("="),2) | ||
val name = param.first() | ||
val value = param.last().replace("\"", "") | ||
map[name] = value | ||
} | ||
AuthenticationProperty( | ||
authUrl = map[BEARER_REALM]!!, | ||
service = map[SERVICE]!!, | ||
scope = scope | ||
) | ||
} catch (e: Exception) { | ||
null | ||
} | ||
} | ||
|
||
fun buildAuthenticationUrl(property: AuthenticationProperty, userName: String?): String? { | ||
if (property.authUrl.isBlank()) return null | ||
var result = if (property.authUrl.contains(StringPool.QUESTION)) { | ||
"${property.authUrl}&$SERVICE=${property.service}" | ||
} else { | ||
"${property.authUrl}?$SERVICE=${property.service}" | ||
} | ||
property.scope?.let { | ||
result += "&$SCOPE=${property.scope}" | ||
} | ||
userName?.let { result += "&account=$userName" } | ||
return result | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.