Package org.jvnet.hudson.test
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
Modifier and TypeClassDescriptionclass
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
-
Method Summary
Modifier and TypeMethodDescriptionhudson.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) Likegrant(hudson.security.Permission...)
but does not honorPermission.impliedBy
.Methods inherited from class hudson.security.AuthorizationStrategy
all, getACL, getACL, getACL, getACL, getACL, getACL
Methods inherited from class hudson.model.AbstractDescribableImpl
getDescriptor
-
Constructor Details
-
MockAuthorizationStrategy
public MockAuthorizationStrategy()Creates a new strategy granting no permissions.
-
-
Method Details
-
grant
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) Likegrant(hudson.security.Permission...)
but does not honorPermission.impliedBy
. -
getRootACL
@NonNull public hudson.security.ACL getRootACL()- Specified by:
getRootACL
in classhudson.security.AuthorizationStrategy
-
getACL
@NonNull public hudson.security.ACL getACL(hudson.model.AbstractItem item) - Overrides:
getACL
in classhudson.security.AuthorizationStrategy
-
getACL
@NonNull public hudson.security.ACL getACL(@NonNull hudson.model.Job<?, ?> project) - Overrides:
getACL
in classhudson.security.AuthorizationStrategy
-
getGroups
- Specified by:
getGroups
in classhudson.security.AuthorizationStrategy
-