Class MockAuthorizationStrategy

java.lang.Object
hudson.model.AbstractDescribableImpl<hudson.security.AuthorizationStrategy>
hudson.security.AuthorizationStrategy
org.jvnet.hudson.test.MockAuthorizationStrategy
All Implemented Interfaces:
hudson.ExtensionPoint, hudson.model.Describable<hudson.security.AuthorizationStrategy>

public class MockAuthorizationStrategy extends hudson.security.AuthorizationStrategy
An authorization strategy configured in a fluent style from test code. Install using Jenkins.setAuthorizationStrategy(hudson.security.AuthorizationStrategy). You probably also want to call Jenkins.setSecurityRealm(hudson.security.SecurityRealm) on JenkinsRule.createDummySecurityRealm().
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    class 
    A grant of a set of permissions.

    Nested classes/interfaces inherited from class hudson.security.AuthorizationStrategy

    hudson.security.AuthorizationStrategy.Unsecured

    Nested classes/interfaces inherited from interface hudson.ExtensionPoint

    hudson.ExtensionPoint.LegacyInstancesAreScopedToHudson
  • Field Summary

    Fields inherited from class hudson.security.AuthorizationStrategy

    LIST, UNSECURED
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new strategy granting no permissions.
  • Method Summary

    Modifier and Type
    Method
    Description
    hudson.security.ACL
    getACL(hudson.model.AbstractItem item)
     
    hudson.security.ACL
    getACL(hudson.model.Job<?,?> project)
     
     
    hudson.security.ACL
     
    grant(hudson.security.Permission... permissions)
    Begin granting a set of permissions.
    grantWithoutImplication(hudson.security.Permission... permissions)
    Like grant(hudson.security.Permission...) but does not honor Permission.impliedBy.

    Methods inherited from class hudson.security.AuthorizationStrategy

    all, getACL, getACL, getACL, getACL, getACL, getACL

    Methods inherited from class hudson.model.AbstractDescribableImpl

    getDescriptor

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • MockAuthorizationStrategy

      public MockAuthorizationStrategy()
      Creates a new strategy granting no permissions.
  • Method Details

    • grant

      public MockAuthorizationStrategy.Grant grant(hudson.security.Permission... permissions)
      Begin granting a set of permissions. Note that grants cannot be subsequently revoked, but you could reset the strategy to a newly configured one.
      Parameters:
      permissions - which permissions to grant (Permission.impliedBy is honored)
    • grantWithoutImplication

      public MockAuthorizationStrategy.Grant grantWithoutImplication(hudson.security.Permission... permissions)
      Like grant(hudson.security.Permission...) but does not honor Permission.impliedBy.
    • getRootACL

      @NonNull public hudson.security.ACL getRootACL()
      Specified by:
      getRootACL in class hudson.security.AuthorizationStrategy
    • getACL

      @NonNull public hudson.security.ACL getACL(hudson.model.AbstractItem item)
      Overrides:
      getACL in class hudson.security.AuthorizationStrategy
    • getACL

      @NonNull public hudson.security.ACL getACL(@NonNull hudson.model.Job<?,?> project)
      Overrides:
      getACL in class hudson.security.AuthorizationStrategy
    • getGroups

      @NonNull public Collection<String> getGroups()
      Specified by:
      getGroups in class hudson.security.AuthorizationStrategy