AuthenticationSchemeSelector デリゲートとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > AuthenticationSchemeSelector デリゲートの意味・解説 

AuthenticationSchemeSelector デリゲート

メモ : このデリゲートは、.NET Framework version 2.0 で新しく追加されたものです。

HttpListener インスタンスの認証方式を選択します。

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

Public Delegate Function
 AuthenticationSchemeSelector ( _
    httpRequest As HttpListenerRequest _
) As AuthenticationSchemes
Dim instance As New AuthenticationSchemeSelector(AddressOf
 HandlerMethod)
public delegate AuthenticationSchemes AuthenticationSchemeSelector
 (
    HttpListenerRequest httpRequest
)
public delegate AuthenticationSchemes AuthenticationSchemeSelector
 (
    HttpListenerRequest^ httpRequest
)
/** @delegate */
public delegate AuthenticationSchemes AuthenticationSchemeSelector
 (
    HttpListenerRequest httpRequest
)
JScript では、デリゲートは使用できますが、新規に宣言することはできません。

パラメータ

httpRequest

認証方式の選択対象となる HttpListenerRequest インスタンス。

戻り値
指定したクライアント要求に使用する認証のメソッドを示す AuthenticationSchemes 値の 1 つ。

解説解説

この種類のデリゲートは、要求の特性に基づいて認証方式を選択するために HttpListener インスタンスによって使用されます。

AuthenticationSchemeSelector デリゲートは、認証情報を提供していない各受信要求の HttpListenerRequest オブジェクトに渡されます。このデリゲートによって呼び出されたメソッドは、HttpListenerRequest オブジェクトおよび他の入手可能な情報を使用して、必要な認証方式を決定します。このデリゲートは、AuthenticationSchemeSelectorDelegate プロパティを使用して指定されます。

使用例使用例

この種類のインスタンスを使用して AuthenticationSchemeSelectorDelegate プロパティを設定する例を次に示します。

// Set up a listener.
HttpListener listener = new HttpListener();
HttpListenerPrefixCollection prefixes = listener.Prefixes;
prefixes.Add(@"http://localhost:8080/");
prefixes.Add(@"http://contoso.com:8080/");

// Specify the authentication delegate.
listener.AuthenticationSchemeSelectorDelegate = 
    new AuthenticationSchemeSelector (AuthenticationSchemeForClient);

// Start listening for requests and process them 
// synchronously.
listener.Start();

前の例で AuthenticationSchemeSelector デリゲートによって呼び出されているメソッドの実装例を次に示します。

static AuthenticationSchemes AuthenticationSchemeForClient(HttpListenerRequest
 request)
{
    Console.WriteLine("Client authentication protocol selection in
 progress...");
    // Do not authenticate local machine requests.
    if (request.RemoteEndPoint.Address.Equals (IPAddress.Loopback))
    {
        return AuthenticationSchemes.None;
    }
    else
    {
        return AuthenticationSchemes.IntegratedWindowsAuthentication;
    }
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳

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

辞書ショートカット

すべての辞書の索引

「AuthenticationSchemeSelector デリゲート」の関連用語

AuthenticationSchemeSelector デリゲートのお隣キーワード
検索ランキング

   

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



AuthenticationSchemeSelector デリゲートのページの著作権

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

©2026 GRAS Group, Inc.RSS