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.
  • Constructor Details

    • AuthorizeProjectStrategy

      public AuthorizeProjectStrategy()
  • Method Details

    • all

      Returns:
      all the registered AuthorizeProjectStrategy.
    • authenticate

      public abstract org.springframework.security.core.Authentication authenticate(Job<?,?> project, Queue.Item item)
      Returns the Authentication 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
    • getDescriptor

      public AuthorizeProjectStrategyDescriptor getDescriptor()
      Specified by:
      getDescriptor in interface Describable<AuthorizeProjectStrategy>
      Overrides:
      getDescriptor in class AbstractDescribableImpl<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:
      org.springframework.security.access.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 with Jenkins.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:
      org.springframework.security.access.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 with Jenkins.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: