AuthenticationLevelとは何? わかりやすく解説 Weblio辞書 (original) (raw)

メモ : この列挙体は、.NET Framework version 2.0新しく追加されたものです。

WebRequest クラスおよびその派生クラス使用してリソース要求する場合の、認証偽装に関するクライアント要件指定します

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

Visual Basic (宣言)

Public Enumeration AuthenticationLevel

Visual Basic (使用法)

Dim instance As AuthenticationLevel

C#

public enum AuthenticationLevel

C++

public enum class AuthenticationLevel

J#

public enum AuthenticationLevel

JScript

public enum AuthenticationLevel

メンバメンバ

| | メンバ名 | 説明 | | ---------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | MutualAuthRequested | クライアントサーバー認証する必要がありますサーバー認証されていない場合でも、要求失敗しません。相互認証が行われたかどうかを確認するには、WebResponse.IsMutuallyAuthenticated プロパティの値をチェックします。 | | MutualAuthRequired | クライアントサーバー認証する必要がありますサーバー認証されていない場合相互認証失敗したことを示す ProtocolViolationException 内部例外と共にIOExceptionアプリケーション発生します。 | | None | クライアントサーバー認証は必要ありません。 |

解説解説

この列挙体の値は、AuthenticationLevel プロパティ設定するために使用されます。

メモメモ
MutualAuthRequired と MutualAuthRequested は、Kerberos 認証関連する値です。Kerberos 認証は、直接サポートすることも、Negotiate セキュリティ プロトコル使用して実際セキュリティ プロトコル選択する場合使用することもできます認証プロトコルの詳細については、「インターネット認証」を参照してください

使用例使用例

要求認証フラグ設定するコード例次に示します

C#

// The following example uses the System, System.Net, // and System.IO namespaces.

public static void RequestMutualAuth(Uri resource) { // Create a new HttpWebRequest object for the specified resource. WebRequest request=(WebRequest) WebRequest.Create(resource); // Request mutual authentication. request.AuthenticationLevel = AuthenticationLevel.MutualAuthRequested; // Supply client credentials. request.Credentials = CredentialCache.DefaultCredentials; HttpWebResponse response = (HttpWebResponse) request.GetResponse(); // Determine whether mutual authentication was used. Console.WriteLine("Is mutually authenticated? {0}", response.IsMutuallyAuthenticated); // Read and display the response. Stream streamResponse = response.GetResponseStream(); StreamReader streamRead = new StreamReader(streamResponse); string responseString = streamRead.ReadToEnd(); Console.WriteLine(responseString); // Close the stream objects. streamResponse.Close(); streamRead.Close(); // Release the HttpWebResponse. response.Close(); }

C++

// The following example uses the System, System.Net, // and System.IO namespaces. static void RequestMutualAuth( Uri^ resource ) { // Create a new HttpWebRequest object for the specified resource. WebRequest^ request = dynamic_cast<WebRequest^>(WebRequest::Create( resource ));

// Request mutual authentication. request->AuthenticationLevel = AuthenticationLevel::MutualAuthRequested;

// Supply client credentials. request->Credentials = CredentialCache::DefaultCredentials; HttpWebResponse^ response = dynamic_cast<HttpWebResponse^>(request->GetResponse());

// Determine whether mutual authentication was used. Console::WriteLine( L"Is mutually authenticated? {0}", response->IsMutuallyAuthenticated );

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

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

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

プラットフォームプラットフォーム

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

開発プラットフォーム中には.NET Framework によってサポートされていないバージョンありますサポートされているバージョンについては、「システム要件」を参照してください

バージョン情報バージョン情報

.NET Framework
サポート対象 : 2.0

参照参照

関連項目
System.Net.Security 名前空間