Class AuthorizeProjectStrategy
- java.lang.Object
-
- hudson.model.AbstractDescribableImpl<AuthorizeProjectStrategy>
-
- org.jenkinsci.plugins.authorizeproject.AuthorizeProjectStrategy
-
- All Implemented Interfaces:
ExtensionPoint
,Describable<AuthorizeProjectStrategy>
- Direct Known Subclasses:
AnonymousAuthorizationStrategy
,SpecificUsersAuthorizationStrategy
,SystemAuthorizationStrategy
,TriggeringUsersAuthorizationStrategy
public abstract class AuthorizeProjectStrategy extends AbstractDescribableImpl<AuthorizeProjectStrategy> implements ExtensionPoint
Extension point to define a new strategy to authorize builds configured in project configuration pages.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
-
Constructor Summary
Constructors Constructor Description AuthorizeProjectStrategy()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static DescriptorExtensionList<AuthorizeProjectStrategy,Descriptor<AuthorizeProjectStrategy>>
all()
Authentication
authenticate(AbstractProject<?,?> project, Queue.Item item)
Deprecated.useauthenticate(hudson.model.Job, Queue.Item)
instead.Authentication
authenticate(Job<?,?> project, Queue.Item item)
Returns theAuthentication
for the build.void
checkAuthorizationConfigurePermission(AccessControlled context)
Checks that the authorization can be configured by the current user.void
checkJobConfigurePermission(AccessControlled context)
Checks that the job can be reconfigured by the current user when this strategy is the configured strategy.AuthorizeProjectStrategyDescriptor
getDescriptor()
boolean
hasAuthorizationConfigurePermission(AccessControlled context)
Tests if the authorization can be configured by the current user.boolean
hasJobConfigurePermission(AccessControlled context)
Tests if the job can be reconfigured by the current user when this strategy is the configured strategy.protected Object
readResolve()
If we are being deserialized outside of loading the initial jobs (or reloading) then we need to cross check the strategy permissions to defend against somebody trying to push a configuration relating to a user other than themselves.
-
-
-
Method Detail
-
all
public static DescriptorExtensionList<AuthorizeProjectStrategy,Descriptor<AuthorizeProjectStrategy>> all()
- Returns:
- all the registered
AuthorizeProjectStrategy
.
-
authenticate
public Authentication authenticate(Job<?,?> project, Queue.Item item)
Returns theAuthentication
for the build.- Parameters:
project
- the project to run.item
- the item in queue, which will be a build.- Returns:
true
if authentication was successful
-
authenticate
@Deprecated public Authentication authenticate(AbstractProject<?,?> project, Queue.Item item)
Deprecated.useauthenticate(hudson.model.Job, Queue.Item)
instead.OldAbstractProject
based version ofauthenticate(Job, Queue.Item)
.- Parameters:
project
- the project to run.item
- the item in queue, which will be a build.- Returns:
true
if authentication was successful
-
getDescriptor
public AuthorizeProjectStrategyDescriptor getDescriptor()
- Specified by:
getDescriptor
in interfaceDescribable<AuthorizeProjectStrategy>
- Overrides:
getDescriptor
in classAbstractDescribableImpl<AuthorizeProjectStrategy>
-
checkJobConfigurePermission
public final void checkJobConfigurePermission(AccessControlled context)
Checks that the job can be reconfigured by the current user when this strategy is the configured strategy.- Parameters:
context
- the context of the job- Throws:
AccessDeniedException
- if the current user is not allowed to reconfigure the specified job- Since:
- 1.3.0
-
hasJobConfigurePermission
public boolean hasJobConfigurePermission(AccessControlled context)
Tests if the job can be reconfigured by the current user when this strategy is the configured strategy. Users withJenkins.ADMINISTER
permission skips this check.- Parameters:
context
- the context of the job- Returns:
true
if and only if the current user is allowed to reconfigure the specified job.- Since:
- 1.3.0
-
checkAuthorizationConfigurePermission
public final void checkAuthorizationConfigurePermission(AccessControlled context)
Checks that the authorization can be configured by the current user.- Parameters:
context
- the context of the job- Throws:
AccessDeniedException
- if the current user is not allowed to configure this authorization- Since:
- 1.3.0
-
hasAuthorizationConfigurePermission
public boolean hasAuthorizationConfigurePermission(AccessControlled context)
Tests if the authorization can be configured by the current user. Users withJenkins.ADMINISTER
permission skips this check.- Parameters:
context
- the context of the job- Returns:
true
if and only if the current user is allowed to configure this authorization.- Since:
- 1.3.0
-
readResolve
protected Object readResolve() throws ObjectStreamException
If we are being deserialized outside of loading the initial jobs (or reloading) then we need to cross check the strategy permissions to defend against somebody trying to push a configuration relating to a user other than themselves.- Returns:
this
- Throws:
ObjectStreamException
- if the object cannot be deserialized.- See Also:
AuthorizeProjectProperty.setStrategyCritical()
-
-