github.com/treeverse/lakefs@v1.24.1-0.20240520134607-95648127bfb0/clients/hadoopfs/src/main/java/io/lakefs/auth/LakeFSTokenProviderFactory.java (about) 1 package io.lakefs.auth; 2 3 import org.apache.hadoop.conf.Configuration; 4 import io.lakefs.Constants; 5 import io.lakefs.FSConfiguration; 6 7 import java.io.IOException; 8 9 public class LakeFSTokenProviderFactory { 10 11 public static LakeFSTokenProvider newLakeFSTokenProvider(String scheme, Configuration conf) throws IOException { 12 String providerClassPath = FSConfiguration.get(conf, scheme, Constants.LAKEFS_AUTH_PROVIDER_KEY_SUFFIX); 13 if (providerClassPath == null) { 14 throw new IOException("Missing lakeFS Auth provider configuration"); 15 } 16 // Load the Token Provider class and create an instance of it. 17 // This setup is similar to Custom AWS Credential Provider in Hadoop-AWS: allow using custom Token Provider provided by runtime. 18 try { 19 LakeFSTokenProvider provider = (LakeFSTokenProvider) Class.forName(providerClassPath).getConstructor(String.class, Configuration.class).newInstance(scheme, conf); 20 return provider; 21 } catch (Exception e) { 22 throw new IOException(String.format("Failed loading LakeFSTokenProvider %s %s \n%s", providerClassPath, e.getCause(), e)); 23 } 24 } 25 }