Package org.apache.pinot.common.auth
Class AuthProviderUtils
- java.lang.Object
-
- org.apache.pinot.common.auth.AuthProviderUtils
-
public final class AuthProviderUtils extends Object
Utility class to wrap inference of optimal auth provider from component configs.
-
-
Method Summary
Modifier and Type Method Description static AuthConfigextractAuthConfig(PinotConfiguration pinotConfig, String namespace)Extract an AuthConfig from a pinot configuration subset namespace.static AuthProviderextractAuthProvider(PinotConfiguration pinotConfig, String namespace)Create an AuthProvider after extracting a config from a pinot configuration subset namespacestatic AuthProvidermakeAuthProvider(String authToken)Create auth provider based on the availability of a static token only, if any.static AuthProvidermakeAuthProvider(AuthConfig authConfig)Create auth provider based on an auth config.static List<org.apache.http.Header>toRequestHeaders(Map<String,Object> headers)Convenience helper to convert Map to list of Http Headersstatic List<org.apache.http.Header>toRequestHeaders(AuthProvider authProvider)Convenience helper to convert an optional authProvider to a list of http headersstatic StringtoStaticToken(AuthProvider authProvider)Convenience helper to convert an optional authProvider to a static job spec token
-
-
-
Method Detail
-
extractAuthConfig
public static AuthConfig extractAuthConfig(PinotConfiguration pinotConfig, String namespace)
Extract an AuthConfig from a pinot configuration subset namespace.- Parameters:
pinotConfig- pinot configurationnamespace- subset namespace- Returns:
- auth config
-
extractAuthProvider
public static AuthProvider extractAuthProvider(PinotConfiguration pinotConfig, String namespace)
Create an AuthProvider after extracting a config from a pinot configuration subset namespace- Parameters:
pinotConfig- pinot configurationnamespace- subset namespace- Returns:
- auth provider
- See Also:
extractAuthConfig(PinotConfiguration, String)
-
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
-
-