コード例 #1
0
 /// <summary>
 /// This provider expects URIs in the following form :
 /// kms://<PROTO>@<AUTHORITY>/<PATH>
 /// where :
 /// - PROTO = http or https
 /// - AUTHORITY = <HOSTS>[:<PORT>]
 /// - HOSTS = <HOSTNAME>[;<HOSTS>]
 /// - HOSTNAME = string
 /// - PORT = integer
 /// If multiple hosts are provider, the Factory will create a
 /// <see cref="LoadBalancingKMSClientProvider"/>
 /// that round-robins requests
 /// across the provided list of hosts.
 /// </summary>
 /// <exception cref="System.IO.IOException"/>
 public override KeyProvider CreateProvider(URI providerUri, Configuration conf)
 {
     if (SchemeName.Equals(providerUri.GetScheme()))
     {
         Uri    origUrl   = new Uri(ExtractKMSPath(providerUri).ToString());
         string authority = origUrl.GetAuthority();
         // check for ';' which delimits the backup hosts
         if (Strings.IsNullOrEmpty(authority))
         {
             throw new IOException("No valid authority in kms uri [" + origUrl + "]");
         }
         // Check if port is present in authority
         // In the current scheme, all hosts have to run on the same port
         int    port      = -1;
         string hostsPart = authority;
         if (authority.Contains(":"))
         {
             string[] t = authority.Split(":");
             try
             {
                 port = System.Convert.ToInt32(t[1]);
             }
             catch (Exception)
             {
                 throw new IOException("Could not parse port in kms uri [" + origUrl + "]");
             }
             hostsPart = t[0];
         }
         return(CreateProvider(providerUri, conf, origUrl, port, hostsPart));
     }
     return(null);
 }
コード例 #2
0
 /// <exception cref="System.IO.IOException"/>
 public override KeyProvider CreateProvider(URI providerName, Configuration conf)
 {
     if (SchemeName.Equals(providerName.GetScheme()))
     {
         return(new JavaKeyStoreProvider(providerName, conf));
     }
     return(null);
 }
コード例 #3
0
ファイル: UserProvider.cs プロジェクト: orf53975/hadoop.net
 /// <exception cref="System.IO.IOException"/>
 public override CredentialProvider CreateProvider(URI providerName, Configuration
                                                   conf)
 {
     if (SchemeName.Equals(providerName.GetScheme()))
     {
         return(new UserProvider());
     }
     return(null);
 }
コード例 #4
0
 /// <exception cref="System.IO.IOException"/>
 public override KeyProvider CreateProvider(URI providerName, Configuration conf)
 {
     if (SchemeName.Equals(providerName.GetScheme()))
     {
         try
         {
             return(new FailureInjectingJavaKeyStoreProvider((JavaKeyStoreProvider) new JavaKeyStoreProvider.Factory
                                                                 ().CreateProvider(new URI(providerName.ToString().Replace(SchemeName, JavaKeyStoreProvider
                                                                                                                           .SchemeName)), conf)));
         }
         catch (URISyntaxException e)
         {
             throw new RuntimeException(e);
         }
     }
     return(null);
 }