Enum CredentialsScope

    • Enum Constant Detail

      • SYSTEM

        public static final CredentialsScope SYSTEM
        This credential is only available to the object on which the credential is associated. Typically you would use SYSTEM scoped credentials for things like email auth, agent connection, etc, i.e. where the Jenkins instance itself is using the credential.
      • GLOBAL

        public static final CredentialsScope GLOBAL
        This credential is available to the object on which the credential is associated and all objects that are children of that object. Typically you would use GLOBAL scoped credentials for things that are needed by Jobs.
      • USER

        public static final CredentialsScope USER
        This credential is available to the user which which the credential is associated. Typically you would use USER scoped credentials where credentials are required for immediate actions. Some examples could include:
        • Tag this build
        • Deploy artifacts to some container NOW
        • etc
        The key point is that the user is making a request and instructing Jenkins to use one of their own credentials in the scope of the request. Where the request is something that happens automatically, e.g. a build triggered by SCM polling, then USER scoped credentials are not usually appropriate (unless the action is one that can fail gracefully)

        Another way of looking at this is, if the action is one that is configured from the Job's Configure page, then don't use USER scope, as that prevents another user from modifying the job configuration (because they will only be able to see their own credentials)

    • Method Detail

      • values

        public static CredentialsScope[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (CredentialsScope c : CredentialsScope.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static CredentialsScope valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • getDisplayName

        public abstract String getDisplayName()
        Gets the display name for the credentials.
        Returns:
        The display name for the credentials.
      • isVisible

        public abstract boolean isVisible​(ModelObject context)
        Tests if credentials with this scope are visible in the supplied context.
        Parameters:
        context - the context.
        Returns:
        true if credentials with this scope are visible in the supplied context.
        Since:
        2.1.5