Package hudson.model

Class User.CanonicalIdResolver

All Implemented Interfaces:
ExtensionPoint, Describable<User.CanonicalIdResolver>, Comparable<User.CanonicalIdResolver>
Direct Known Subclasses:
DefaultUserCanonicalIdResolver, User.FullNameIdResolver, User.UserIDCanonicalIdResolver
Enclosing class:

public abstract static class User.CanonicalIdResolver extends AbstractDescribableImpl<User.CanonicalIdResolver> implements ExtensionPoint, Comparable<User.CanonicalIdResolver>
Resolves User IDs by ID, full names or other strings.

This extension point may be useful to map SCM user names to Jenkins User IDs. Currently the extension point is used in User.get(String, boolean, Map).

See Also:
  • Field Details

    • REALM

      public static final String REALM
      context key for realm (domain) where idOrFullName has been retrieved from. Can be used (for example) to distinguish ambiguous committer ID using the SCM URL. Associated Value is a String
      See Also:
  • Constructor Details

    • CanonicalIdResolver

      public CanonicalIdResolver()
  • Method Details

    • compareTo

      public int compareTo(@NonNull User.CanonicalIdResolver o)
      Specified by:
      compareTo in interface Comparable<User.CanonicalIdResolver>
    • resolveCanonicalId

      @CheckForNull public abstract String resolveCanonicalId(String idOrFullName, Map<String,?> context)
      extract user ID from idOrFullName with help from contextual infos. can return null if no user ID matched the input
    • getPriority

      public int getPriority()
      Gets priority of the resolver. Higher priority means that it will be checked earlier.

      Overriding methods must not use Integer.MIN_VALUE, because it will cause collisions with DefaultUserCanonicalIdResolver.

      Priority of the resolver.
    • all

      public static List<User.CanonicalIdResolver> all()
      Gets all extension points, sorted by priority.
      Sorted list of extension point implementations.
    • resolve

      @CheckForNull public static String resolve(@NonNull String idOrFullName, @NonNull Map<String,?> context)
      Resolves users using all available User.CanonicalIdResolvers.
      idOrFullName - ID or full name of the user
      context - Context
      Resolved User ID or null if the user ID cannot be resolved.