Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
FIY695
jenkins
提交
65b71c20
J
jenkins
项目概览
FIY695
/
jenkins
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
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,发现更多精彩内容 >>
提交
65b71c20
编写于
11月 17, 2014
作者:
S
Stephen Connolly
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Allow programmatic QueueItemAuthenticators that are not user configurable
上级
7335916f
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
82 addition
and
1 deletion
+82
-1
core/src/main/java/hudson/model/Queue.java
core/src/main/java/hudson/model/Queue.java
+2
-1
core/src/main/java/jenkins/security/QueueItemAuthenticatorConfiguration.java
...jenkins/security/QueueItemAuthenticatorConfiguration.java
+12
-0
core/src/main/java/jenkins/security/QueueItemAuthenticatorProvider.java
...java/jenkins/security/QueueItemAuthenticatorProvider.java
+68
-0
未找到文件。
core/src/main/java/hudson/model/Queue.java
浏览文件 @
65b71c20
...
...
@@ -65,6 +65,7 @@ import hudson.model.queue.CauseOfBlockage.BecauseLabelIsOffline;
import
hudson.model.queue.CauseOfBlockage.BecauseNodeIsBusy
;
import
hudson.model.queue.WorkUnitContext
;
import
hudson.security.ACL
;
import
jenkins.security.QueueItemAuthenticatorProvider
;
import
jenkins.util.Timer
;
import
hudson.triggers.SafeTimerTask
;
import
hudson.util.TimeUnit2
;
...
...
@@ -1643,7 +1644,7 @@ public class Queue extends ResourceController implements Saveable {
*/
@Nonnull
public
Authentication
authenticate
()
{
for
(
QueueItemAuthenticator
auth
:
QueueItemAuthenticator
Configuration
.
get
().
getA
uthenticators
())
{
for
(
QueueItemAuthenticator
auth
:
QueueItemAuthenticator
Provider
.
a
uthenticators
())
{
Authentication
a
=
auth
.
authenticate
(
this
);
if
(
a
!=
null
)
return
a
;
...
...
core/src/main/java/jenkins/security/QueueItemAuthenticatorConfiguration.java
浏览文件 @
65b71c20
package
jenkins.security
;
import
edu.umd.cs.findbugs.annotations.NonNull
;
import
hudson.Extension
;
import
hudson.model.AbstractProject
;
import
hudson.security.ACL
;
...
...
@@ -12,6 +13,7 @@ import org.acegisecurity.Authentication;
import
org.kohsuke.stapler.StaplerRequest
;
import
java.io.IOException
;
import
java.util.List
;
/**
* Show the {@link QueueItemAuthenticator} configurations on the system config page.
...
...
@@ -55,4 +57,14 @@ public class QueueItemAuthenticatorConfiguration extends GlobalConfiguration {
public
static
QueueItemAuthenticatorConfiguration
get
()
{
return
Jenkins
.
getInstance
().
getInjector
().
getInstance
(
QueueItemAuthenticatorConfiguration
.
class
);
}
@Extension
(
ordinal
=
100
)
public
static
class
ProviderImpl
extends
QueueItemAuthenticatorProvider
{
@NonNull
@Override
public
List
<
QueueItemAuthenticator
>
getAuthenticators
()
{
return
get
().
getAuthenticators
();
}
}
}
core/src/main/java/jenkins/security/QueueItemAuthenticatorProvider.java
0 → 100644
浏览文件 @
65b71c20
package
jenkins.security
;
import
edu.umd.cs.findbugs.annotations.NonNull
;
import
hudson.Extension
;
import
hudson.ExtensionPoint
;
import
jenkins.model.Jenkins
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.NoSuchElementException
;
/**
* There are cases where a plugin need to provide a {@link QueueItemAuthenticator} that cannot be controlled or
* configured by the user. This extension point provides the mechanism whereby the a {@link QueueItemAuthenticator}
* can be provided either before or after those provided by {@link QueueItemAuthenticatorConfiguration} which
* will use {@link Extension#ordinal()} of {@code 100}
* @since 1.592
*/
public
abstract
class
QueueItemAuthenticatorProvider
implements
ExtensionPoint
{
@NonNull
public
abstract
List
<
QueueItemAuthenticator
>
getAuthenticators
();
public
static
Iterable
<
QueueItemAuthenticator
>
authenticators
()
{
return
new
IterableImpl
();
}
private
static
class
IteratorImpl
implements
Iterator
<
QueueItemAuthenticator
>
{
private
final
Iterator
<
QueueItemAuthenticatorProvider
>
providers
;
private
Iterator
<
QueueItemAuthenticator
>
delegate
=
null
;
private
IteratorImpl
()
{
final
Jenkins
jenkins
=
Jenkins
.
getInstance
();
providers
=
new
ArrayList
<
QueueItemAuthenticatorProvider
>(
jenkins
==
null
?
Collections
.<
QueueItemAuthenticatorProvider
>
emptyList
()
:
jenkins
.
getExtensionList
(
QueueItemAuthenticatorProvider
.
class
)).
iterator
();
}
@Override
public
boolean
hasNext
()
{
while
((
delegate
==
null
||
!
delegate
.
hasNext
())
&&
(
providers
.
hasNext
()))
{
final
QueueItemAuthenticatorProvider
provider
=
providers
.
next
();
if
(
provider
==
null
)
{
continue
;
}
delegate
=
new
ArrayList
<
QueueItemAuthenticator
>(
provider
.
getAuthenticators
()).
iterator
();
}
return
delegate
!=
null
&&
delegate
.
hasNext
();
}
@Override
public
QueueItemAuthenticator
next
()
{
if
(!
hasNext
())
{
throw
new
NoSuchElementException
();
}
return
delegate
.
next
();
}
}
private
static
class
IterableImpl
implements
Iterable
<
QueueItemAuthenticator
>
{
@Override
public
Iterator
<
QueueItemAuthenticator
>
iterator
()
{
return
new
IteratorImpl
();
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录