Interface RoleSensitive

  • All Known Subinterfaces:
    Callable<V,​T>, DelegatingCallable<V,​T>

    public interface RoleSensitive
    Used by Callable-like objects to designate the intended recipient of the callable, to help verify callables are running in JVMs that it is intended to run.

    This interface is defined separately from Callable so that other callable-like interfaces can reuse this.

    Since:
    2.47
    Author:
    Kohsuke Kawaguchi
    See Also:
    RoleChecker
    • Method Detail

      • checkRoles

        void checkRoles​(RoleChecker checker)
                 throws SecurityException
        Verifies the roles expected by this callable by invoking RoleChecker.check(RoleSensitive, Collection) method (or its variants), to provide an opportunity for RoleChecker to reject this object.

        Do not implement this method unless you know what you are doing. If you have a Jenkins Callable or FileCallable, use the standard abstract base classes instead, such as MasterToSlaveCallable, MasterToSlaveFileCallable, NotReallyRoleSensitiveCallable, etc. See this document for details.

        If the method returns normally, the check has passed.

        Throws:
        SecurityException - If there's a mismatch in the expected roles and the actual roles that should prevent the execution of this callable.
        AbstractMethodError - In the history of this library, this interface was added rather later, so there's lots of Callables out there that do not implement this method. For this reason, code that calls this method should be prepared to receive AbstractMethodError, and treat that as if the invocation of checker.check(this,Role.UNKNOWN) has happened.