Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
jenkins
提交
c3eef5b5
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,发现更多精彩内容 >>
提交
c3eef5b5
编写于
6月 02, 2011
作者:
N
Nicolas De loof
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #130 from bap2000/master
Proxy password is encrypted in xml config file, and in the UI
上级
d5b8cf4a
c4d9fe8e
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
30 addition
and
6 deletion
+30
-6
core/src/main/java/hudson/ProxyConfiguration.java
core/src/main/java/hudson/ProxyConfiguration.java
+29
-5
core/src/main/resources/hudson/PluginManager/advanced.jelly
core/src/main/resources/hudson/PluginManager/advanced.jelly
+1
-1
未找到文件。
core/src/main/java/hudson/ProxyConfiguration.java
浏览文件 @
c3eef5b5
...
@@ -27,6 +27,7 @@ import hudson.model.Hudson;
...
@@ -27,6 +27,7 @@ import hudson.model.Hudson;
import
hudson.model.Saveable
;
import
hudson.model.Saveable
;
import
hudson.model.listeners.SaveableListener
;
import
hudson.model.listeners.SaveableListener
;
import
hudson.util.Scrambler
;
import
hudson.util.Scrambler
;
import
hudson.util.Secret
;
import
hudson.util.XStream2
;
import
hudson.util.XStream2
;
import
java.io.File
;
import
java.io.File
;
...
@@ -59,10 +60,17 @@ public final class ProxyConfiguration implements Saveable {
...
@@ -59,10 +60,17 @@ public final class ProxyConfiguration implements Saveable {
public
final
int
port
;
public
final
int
port
;
/**
/**
* Possibly null proxy user name and password.
* Possibly null proxy user name.
* Password is base64 scrambled since this is persisted to disk.
*/
*/
private
final
String
userName
,
password
;
private
final
String
userName
;
/**
* null
*/
private
String
password
;
/**
* encrypted password
*/
private
Secret
secretPassword
;
public
ProxyConfiguration
(
String
name
,
int
port
)
{
public
ProxyConfiguration
(
String
name
,
int
port
)
{
this
(
name
,
port
,
null
,
null
);
this
(
name
,
port
,
null
,
null
);
...
@@ -72,15 +80,24 @@ public final class ProxyConfiguration implements Saveable {
...
@@ -72,15 +80,24 @@ public final class ProxyConfiguration implements Saveable {
this
.
name
=
name
;
this
.
name
=
name
;
this
.
port
=
port
;
this
.
port
=
port
;
this
.
userName
=
userName
;
this
.
userName
=
userName
;
this
.
password
=
Scrambler
.
scramble
(
password
);
this
.
secretPassword
=
Secret
.
fromString
(
password
);
}
}
public
String
getUserName
()
{
public
String
getUserName
()
{
return
userName
;
return
userName
;
}
}
// This method is public, if it was public only for jelly, then should make it private (or inline contents)
// Have left public, as can't tell if anyone else is using from plugins
/**
* @return the password in plain text
*/
public
String
getPassword
()
{
public
String
getPassword
()
{
return
Scrambler
.
descramble
(
password
);
return
Secret
.
toString
(
secretPassword
);
}
public
String
getEncryptedPassword
()
{
return
(
secretPassword
==
null
)
?
null
:
secretPassword
.
getEncryptedValue
();
}
}
public
Proxy
createProxy
()
{
public
Proxy
createProxy
()
{
...
@@ -94,6 +111,13 @@ public final class ProxyConfiguration implements Saveable {
...
@@ -94,6 +111,13 @@ public final class ProxyConfiguration implements Saveable {
SaveableListener
.
fireOnChange
(
this
,
config
);
SaveableListener
.
fireOnChange
(
this
,
config
);
}
}
public
Object
readResolve
()
{
if
(
secretPassword
==
null
)
secretPassword
=
Secret
.
fromString
(
Scrambler
.
descramble
(
password
));
password
=
null
;
return
this
;
}
public
static
XmlFile
getXmlFile
()
{
public
static
XmlFile
getXmlFile
()
{
return
new
XmlFile
(
XSTREAM
,
new
File
(
Hudson
.
getInstance
().
getRootDir
(),
"proxy.xml"
));
return
new
XmlFile
(
XSTREAM
,
new
File
(
Hudson
.
getInstance
().
getRootDir
(),
"proxy.xml"
));
}
}
...
...
core/src/main/resources/hudson/PluginManager/advanced.jelly
浏览文件 @
c3eef5b5
...
@@ -48,7 +48,7 @@ THE SOFTWARE.
...
@@ -48,7 +48,7 @@ THE SOFTWARE.
<f:textbox name="proxy.userName" value="${app.proxy.userName}" />
<f:textbox name="proxy.userName" value="${app.proxy.userName}" />
</f:entry>
</f:entry>
<f:entry title="${%Password}">
<f:entry title="${%Password}">
<f:password name="proxy.password" value="${app.proxy.
p
assword}" />
<f:password name="proxy.password" value="${app.proxy.
encryptedP
assword}" />
</f:entry>
</f:entry>
<f:block>
<f:block>
<f:submit value="${%Submit}" />
<f:submit value="${%Submit}" />
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录