AuthenticationManager.CustomTargetNameDictionary プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > AuthenticationManager.CustomTargetNameDictionary プロパティの意味・解説 

AuthenticationManager.CustomTargetNameDictionary プロパティ

メモ : このプロパティは、.NET Framework version 2.0新しく追加されたものです。

WebRequest およびその派生クラス使用して行われた要求対すKerberos 認証中にホスト識別するために使用されるサービス プリンシパル名 (SPN) を格納したディクショナリを取得します

名前空間: System.Net
アセンブリ: System (system.dll 内)
構文構文

Public Shared ReadOnly Property
 CustomTargetNameDictionary As StringDictionary
Dim value As StringDictionary

value = AuthenticationManager.CustomTargetNameDictionary
public static StringDictionary CustomTargetNameDictionary
 { get; }
public:
static property StringDictionary^ CustomTargetNameDictionary {
    StringDictionary^ get ();
}
/** @property */
public static StringDictionary get_CustomTargetNameDictionary
 ()
public static function get
 CustomTargetNameDictionary () : StringDictionary

プロパティ
ホスト情報構成されているキーSPN 値を格納している書き込み可能な StringDictionary。

解説解説

SPN は、相互認証のために、クライアントサービスインスタンスサーバー上のアプリケーション一意識別するために使用する名前です。相互認証は、既定要求されます。また、WebRequest.AuthenticationLevel を MutualAuthRequired に設定することにより、要求がこの認証を必要とするように指定することもできます

WebRequest相互認証を必要とする場合送信先SPNクライアント側指定する必要がありますSPN判明している場合は、要求送信前に CustomTargetNameDictionary追加できます。このディクショナリに SPN 情報追加されていない場合、AuthenticationManager は RequestUri メソッド使用して最も可能性が高い SPN構成しますが、これは算出された値であり、正しくない可能性あります相互認証試行され失敗した場合は、ディクショナリをチェックして算出されSPN確認できます認証プロトコル相互認証サポートしてない場合SPN はディクショナリに入力されません。

このディクショナリに SPN 値を追加するには、キーとして RequestUri の AbsoluteUri を使用しますキーは、内部的にSchemeHost、および Port (これが既定ポートではない場合) を含むように切り詰められます。

メモメモ

CustomTargetNameDictionaryメソッドおよびプロパティアクセスするには、無制限の WebPermission が必要です。

使用例使用例

CustomTargetNameDictionary内容表示するコード例次に示します

       public static void RequestResource(Uri
 resource)
        {
            // Set policy to send credentials when using HTTPS and basic
 authentication.

            // Create a new HttpWebRequest object for the specified
 resource.
            WebRequest request=(WebRequest) WebRequest.Create(resource);
            // Supply client credentials for basic authentication.
            request.UseDefaultCredentials = true;
            request.AuthenticationLevel = AuthenticationLevel.MutualAuthRequired;
            HttpWebResponse response = (HttpWebResponse) request.GetResponse();
            // Determine mutual authentication was used.
            Console.WriteLine("Is mutually authenticated? {0}", response.IsMutuallyAuthenticated);

             System.Collections.Specialized.StringDictionary spnDictionary = AuthenticationManager.CustomTargetNameDictionary;
            foreach (System.Collections.DictionaryEntry e in
 spnDictionary)
            {
                Console.WriteLine("Key: {0}  - {1}", e.Key as string,
 e.Value as string);
            }
            // Read and display the response.
            System.IO.Stream streamResponse = response.GetResponseStream();
            System.IO.StreamReader streamRead = new System.IO.StreamReader(streamResponse);
            string responseString = streamRead.ReadToEnd();
            Console.WriteLine(responseString);
            // Close the stream objects.
            streamResponse.Close();
            streamRead.Close();
            // Release the HttpWebResponse.
            response.Close();
        }
        
/*

The output from this example will differ based on the requested
 resource
and whether mutual authentication was successful. For the purpose of illustration
,
a sample of the output is shown here:

Is mutually authenticated? True
Key: http://server1.someDomain.contoso.com  - HTTP/server1.someDomain.contoso.com

<html>
...
</html>

*/

static void RequestResource( Uri^ resource
 )
{
   // Set policy to send credentials when using HTTPS and basic authentication.
   // Create a new HttpWebRequest object for the specified resource.
   WebRequest^ request = dynamic_cast<WebRequest^>(WebRequest::Create( resource
 ));

   // Supply client credentials for basic authentication.
   request->UseDefaultCredentials = true;
   request->AuthenticationLevel = AuthenticationLevel::MutualAuthRequired;
   HttpWebResponse^ response = dynamic_cast<HttpWebResponse^>(request->GetResponse());

   // Determine mutual authentication was used.
   Console::WriteLine( L"Is mutually authenticated? {0}", response->IsMutuallyAuthenticated
 );
   System::Collections::Specialized::StringDictionary^ spnDictionary = AuthenticationManager::CustomTargetNameDictionary;
   System::Collections::IEnumerator^ myEnum = spnDictionary->GetEnumerator();
   while ( myEnum->MoveNext() )
   {
      DictionaryEntry^ e = safe_cast<DictionaryEntry^>(myEnum->Current);
      Console::WriteLine( "Key: {0}  - {1}", dynamic_cast<String^>(e->Key),
 dynamic_cast<String^>(e->Value) );
   }

   // Read and display the response.
   System::IO::Stream^ streamResponse = response->GetResponseStream();
   System::IO::StreamReader^ streamRead = gcnew System::IO::StreamReader( streamResponse
 );
   String^ responseString = streamRead->ReadToEnd();
   Console::WriteLine( responseString );

   // Close the stream objects.
   streamResponse->Close();
   streamRead->Close();

   // Release the HttpWebResponse.
   response->Close();
}

/*

The output from this example will differ based on the requested
 resource
and whether mutual authentication was successful. For the purpose of illustration
,
a sample of the output is shown here:

Is mutually authenticated? True
Key: http://server1.someDomain.contoso.com  - HTTP/server1.someDomain.contoso.com

<html>
...
</html>

*/
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
AuthenticationManager クラス
AuthenticationManager メンバ
System.Net 名前空間


このページでは「.NET Framework クラス ライブラリ リファレンス」からAuthenticationManager.CustomTargetNameDictionary プロパティを検索した結果を表示しています。
Weblioに収録されているすべての辞書からAuthenticationManager.CustomTargetNameDictionary プロパティを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からAuthenticationManager.CustomTargetNameDictionary プロパティ を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

AuthenticationManager.CustomTargetNameDictionary プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



AuthenticationManager.CustomTargetNameDictionary プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS