Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
jenkins
提交
9c92d4f7
J
jenkins
项目概览
xxadev
/
jenkins
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jenkins
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9c92d4f7
编写于
3月 27, 2019
作者:
W
Wadeck Follonier
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'security-stable-2.138' into security-stable-2.150
上级
9d82815f
607eb49e
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
12 addition
and
8 deletion
+12
-8
core/src/main/java/hudson/cli/ClientAuthenticationCache.java
core/src/main/java/hudson/cli/ClientAuthenticationCache.java
+2
-5
test/src/test/java/hudson/cli/ClientAuthenticationCacheTest.java
...c/test/java/hudson/cli/ClientAuthenticationCacheTest.java
+4
-0
test/src/test/java/hudson/cli/ClientAuthenticationCacheWithUserSeedTest.java
...hudson/cli/ClientAuthenticationCacheWithUserSeedTest.java
+4
-3
test/src/test/java/hudson/security/CliAuthenticationTest.java
.../src/test/java/hudson/security/CliAuthenticationTest.java
+2
-0
未找到文件。
core/src/main/java/hudson/cli/ClientAuthenticationCache.java
浏览文件 @
9c92d4f7
...
...
@@ -95,7 +95,8 @@ public class ClientAuthenticationCache implements Serializable {
String
verificationPart
=
val
.
substring
(
idx
+
1
);
int
indexOfSeparator
=
verificationPart
.
indexOf
(
VERIFICATION_FRAGMENT_SEPARATOR
);
if
(
indexOfSeparator
==
-
1
)
{
return
legacy
(
username
,
verificationPart
,
val
);
LOGGER
.
log
(
Level
.
FINE
,
"The legacy method is no longer accepted: username={0}"
,
username
);
return
Jenkins
.
ANONYMOUS
;
}
/*
...
...
@@ -128,10 +129,6 @@ public class ClientAuthenticationCache implements Serializable {
return
getUserAuthIfValidMac
(
username
,
macFragment
,
val
);
}
private
Authentication
legacy
(
String
username
,
String
mac
,
String
fullValueStored
){
return
getUserAuthIfValidMac
(
username
,
mac
,
fullValueStored
);
}
/**
* restOfFragments format: [userSeed]
...
...
test/src/test/java/hudson/cli/ClientAuthenticationCacheTest.java
浏览文件 @
9c92d4f7
...
...
@@ -28,6 +28,7 @@ import com.google.common.collect.Lists;
import
hudson.ExtensionList
;
import
hudson.Launcher
;
import
hudson.model.User
;
import
hudson.security.FullControlOnceLoggedInAuthorizationStrategy
;
import
hudson.util.Secret
;
import
hudson.util.StreamTaskListener
;
...
...
@@ -80,6 +81,9 @@ public class ClientAuthenticationCacheTest {
r
.
jenkins
.
setSecurityRealm
(
r
.
createDummySecurityRealm
());
r
.
jenkins
.
setAuthorizationStrategy
(
new
FullControlOnceLoggedInAuthorizationStrategy
());
assertCLI
(
0
,
"Authenticated as: anonymous"
,
jar
,
"who-am-i"
);
// user must exist to use the new cli auth cache (which is the case in non-test context)
User
.
getById
(
"dev"
,
true
);
assertCLI
(
0
,
null
,
jar
,
"login"
,
"--username"
,
"dev"
,
"--password"
,
"dev"
);
try
{
assertCLI
(
0
,
"Authenticated as: dev"
,
jar
,
"who-am-i"
);
...
...
test/src/test/java/hudson/cli/ClientAuthenticationCacheWithUserSeedTest.java
浏览文件 @
9c92d4f7
...
...
@@ -84,8 +84,8 @@ public class ClientAuthenticationCacheWithUserSeedTest {
}
@Test
@Issue
(
"SECURITY-12
47
"
)
public
void
legacyCache_
smoothlyMigratedWithUserSeed
()
throws
Exception
{
@Issue
(
"SECURITY-12
89
"
)
public
void
legacyCache_
noLongerUsable
()
throws
Exception
{
ClientAuthenticationCache
cache
=
new
ClientAuthenticationCache
(
null
);
assertThat
(
cache
.
get
(),
is
(
Jenkins
.
ANONYMOUS
));
...
...
@@ -109,7 +109,8 @@ public class ClientAuthenticationCacheWithUserSeedTest {
File
jar
=
tmp
.
newFile
(
"jenkins-cli.jar"
);
FileUtils
.
copyURLToFile
(
r
.
jenkins
.
getJnlpJars
(
"jenkins-cli.jar"
).
getURL
(),
jar
);
assertCLI
(
0
,
"Authenticated as: "
+
user
.
getId
(),
jar
,
"who-am-i"
);
// the legacy method is no longer usable
assertCLI
(
0
,
"Authenticated as: anonymous"
,
jar
,
"who-am-i"
);
cache
=
new
ClientAuthenticationCache
(
null
);
String
valueAfterUsage
=
cache
.
props
.
getProperty
(
cache
.
getPropertyKey
());
...
...
test/src/test/java/hudson/security/CliAuthenticationTest.java
浏览文件 @
9c92d4f7
...
...
@@ -123,6 +123,8 @@ public class CliAuthenticationTest {
public
void
login
()
throws
Exception
{
j
.
jenkins
.
setSecurityRealm
(
j
.
createDummySecurityRealm
());
// user must exist to use the new cli auth cache (which is the case in non-test context)
hudson
.
model
.
User
.
getById
(
"abc"
,
true
);
successfulCommand
(
"login"
,
"--username"
,
"abc"
,
"--password"
,
"abc"
);
spySecurityListener
.
authenticatedCalls
.
assertLastEventIsAndThenRemoveIt
(
userDetails
->
userDetails
.
getUsername
().
equals
(
"abc"
));
spySecurityListener
.
loggedInCalls
.
assertLastEventIsAndThenRemoveIt
(
"abc"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录