Class AuthProviderUtils


  • public final class AuthProviderUtils
    extends Object
    Utility class to wrap inference of optimal auth provider from component configs.
    • Method Detail

      • extractAuthConfig

        public static AuthConfig extractAuthConfig​(PinotConfiguration pinotConfig,
                                                   String namespace)
        Extract an AuthConfig from a pinot configuration subset namespace.
        Parameters:
        pinotConfig - pinot configuration
        namespace - subset namespace
        Returns:
        auth config
      • makeAuthProvider

        public static AuthProvider makeAuthProvider​(String authToken)
        Create auth provider based on the availability of a static token only, if any. This typically applies to task specs
        Parameters:
        authToken - static auth token
        Returns:
        auth provider
      • makeAuthProvider

        public static AuthProvider makeAuthProvider​(AuthConfig authConfig)
        Create auth provider based on an auth config. Mimics legacy behavior for static tokens if provided, or dynamic auth providers if additional configs are given.
        Parameters:
        authConfig - auth config
        Returns:
        auth provider
      • toRequestHeaders

        public static List<org.apache.http.Header> toRequestHeaders​(@Nullable
                                                                    Map<String,​Object> headers)
        Convenience helper to convert Map to list of Http Headers
        Parameters:
        headers - header map
        Returns:
        list of http headers
      • toRequestHeaders

        public static List<org.apache.http.Header> toRequestHeaders​(@Nullable
                                                                    AuthProvider authProvider)
        Convenience helper to convert an optional authProvider to a list of http headers
        Parameters:
        authProvider - auth provider
        Returns:
        list of http headers
      • toStaticToken

        public static String toStaticToken​(@Nullable
                                           AuthProvider authProvider)
        Convenience helper to convert an optional authProvider to a static job spec token
        Parameters:
        authProvider - auth provider
        Returns:
        static token