Package org.jenkinsci.remoting
Class RoleChecker
- java.lang.Object
-
- org.jenkinsci.remoting.RoleChecker
-
public abstract class RoleChecker extends Object
Verifies that the callable is getting run on the intended recipient.- Since:
- 2.47
- Author:
- Kohsuke Kawaguchi
- See Also:
ChannelBuilder.withRoleChecker(RoleChecker)
-
-
Constructor Summary
Constructors Constructor Description RoleChecker()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
check(RoleSensitive subject, Collection<Role> expected)
Called fromRoleSensitive.checkRoles(RoleChecker)
to ensure that this side of the channel is willing to executeCallable
s that expects one of the given roles on their intended recipients.void
check(RoleSensitive subject, Role expected)
void
check(RoleSensitive subject, Role... expected)
-
-
-
Method Detail
-
check
public abstract void check(@NonNull RoleSensitive subject, @NonNull Collection<Role> expected) throws SecurityException
Called fromRoleSensitive.checkRoles(RoleChecker)
to ensure that this side of the channel is willing to executeCallable
s that expects one of the given roles on their intended recipients.If you think you need to implement
RoleSensitive.checkRoles(org.jenkinsci.remoting.RoleChecker)
please reread that method’s Javadoc.Normally, each side of the channel has a fixed set of roles (say
actualRoles
), and the implementation would beactualRoles.containsAll(roles)
.- Parameters:
subject
- Object whose role we are checking right now. Useful context information when reporting an error.expected
- The current JVM that executes the callable should have one of these roles. Never empty nor null.- Throws:
SecurityException
- Any exception thrown will prevent the callable from getting executed, but we recommendSecurityException
-
check
public void check(@NonNull RoleSensitive subject, @NonNull Role expected) throws SecurityException
- Throws:
SecurityException
-
check
public void check(@NonNull RoleSensitive subject, Role... expected) throws SecurityException
- Throws:
SecurityException
-
-