AuthenticationSchemes 列挙型

定義

認証用のプロトコルを指定します。

この列挙体は、メンバー値のビットごとの組み合わせをサポートしています。

public enum class AuthenticationSchemes
[System.Flags]
public enum AuthenticationSchemes
[<System.Flags>]
type AuthenticationSchemes = 
Public Enum AuthenticationSchemes
継承
AuthenticationSchemes
属性

フィールド

Anonymous 32768

匿名認証を指定します。

Basic 8

基本認証を指定します。

Digest 1

ダイジェスト認証を指定します。

IntegratedWindowsAuthentication 6

Windows 認証を指定します。

Negotiate 2

クライアントとネゴシエートし、認証方式を決定します。 クライアントとサーバーの両方が Kerberos をサポートする場合は、この方式が使用されます。それ以外の場合は NTLM が使用されます。

None 0

認証は使用できません。 このフラグが設定された HttpListener オブジェクトを要求するクライアントは、常に "403 アクセス不可" のステータスを受け取ります。 リソースをクライアントに提供できない場合にこのフラグを使用します。

Ntlm 4

NTLM 認証を指定します。

次のコード例では、ネゴシエート列挙値を使用して、ネゴシエート セキュリティ プロトコルを使用してクライアントを認証することを指定します。

Console.WriteLine("Listening for {0} prefixes...", listener.Prefixes.Count);
HttpListenerContext context = listener.GetContext();
HttpListenerRequest request = context.Request;
Console.WriteLine("Received a request.");
// This server requires a valid client certificate
// for requests that are not sent from the local computer.

// Did the client omit the certificate or send an invalid certificate?
if (request.IsAuthenticated &&
    request.GetClientCertificate() == null ||
    request.ClientCertificateError != 0)
{
    // Send a 403 response.
    HttpListenerResponse badCertificateResponse = context.Response ;
    SendBadCertificateResponse(badCertificateResponse);
    Console.WriteLine("Client has invalid certificate.");
    continue;
}
Console.WriteLine("Listening for {0} prefixes...", listener.Prefixes.Count)
Dim context As HttpListenerContext = listener.GetContext()
Dim request As HttpListenerRequest = context.Request
Console.WriteLine("Received a request.")
' This server requires a valid client certificate
' for requests that are not sent from the local computer.

' Did the client omit the certificate or send an invalid certificate?
If request.IsAuthenticated AndAlso request.GetClientCertificate() Is Nothing OrElse request.ClientCertificateError <> 0 Then
    ' Send a 403 response.
    Dim badCertificateResponse As HttpListenerResponse = context.Response
    SendBadCertificateResponse(badCertificateResponse)
    Console.WriteLine("Client has invalid certificate.")
    Continue Do
End If

注釈

この列挙型は、オブジェクトによって HttpListener 処理されるクライアント要求を認証するために使用されるメソッドを指定するために使用されます。

重要

基本認証ではパスワードの交換が必要であるため、セキュリティで保護された暗号化された接続の場合を除き、避ける必要があります。

基本認証とダイジェスト認証の詳細については、「 RFC2617 - HTTP 認証: 基本認証とダイジェスト認証」を参照してください。 このドキュメントは次のページにあります https://www.rfc-editor.org

適用対象