code: public static @Nonnull Authentication getAuthenticationOf(@Nonnull Task t) {
          for (QueueItemAuthenticator qia : QueueItemAuthenticatorProvider.authenticators()) {
              Authentication a = qia.authenticate(t);
              if (a != null) {
                  return a;
              }
          }
          return t.getDefaultAuthentication();
      }
docs: Finds what authentication a task is likely to be run under when scheduled.
  The actual authentication after scheduling ({@link hudson.model.Queue.Item#authenticate}) might differ,
  in case some {@link QueueItemAuthenticator#authenticate(hudson.model.Queue.Item)} takes (for example) actions into consideration.
  @param t a task
  @return an authentication as specified by some {@link QueueItemAuthenticator#authenticate(hudson.model.Queue.Task)}; else {@link Task#getDefaultAuthentication()}
  @since 1.560