AuthenticationSection Class1

ASP.NET 認証を構成します。

構文

class AuthenticationSection : ConfigurationSectionWithCollection  

メソッド

次の表に、AuthenticationSection クラスによって公開されるメソッドの一覧を示します。

名前 説明
[追加] (ConfigurationSectionWithCollection から継承。)
Clear (ConfigurationSectionWithCollection から継承。)
Get (ConfigurationSectionWithCollection から継承。)
GetAllowDefinition (ConfigurationSection から継承。)
GetAllowLocation (ConfigurationSection から継承。)
削除 (ConfigurationSectionWithCollection から継承。)
RevertToParent (ConfigurationSection から継承。)
SetAllowDefinition (ConfigurationSection から継承。)
SetAllowLocation (ConfigurationSection から継承。)

プロパティ

次の表は、AuthenticationSection クラスによって公開されるプロパティの一覧です。

名前 説明
Forms Web アプリケーションのフォーム認証を構成する FormsAuthenticationConfiguration 値。
Location (ConfigurationSection から継承。)キー プロパティ。
Mode Web アプリケーションの認証モードを指定する、読み取り/書き込みの sint32 値。 使用できる値の一覧は、後述の「注釈」セクションに示します。
Passport 認証要求のリダイレクト先となる URL を含む PassportAuthentication 値。
Path (ConfigurationSection から継承。)キー プロパティ。
SectionInformation (ConfigurationSection から継承。)

サブクラス

このクラスにはサブクラスが含まれていません。

解説

次の表に、Mode プロパティとして使用できる値の一覧を示します。 既定値は 1 (Windows) です。

Value キーワード 説明
0 None 認証なしを指定します
1 Windows 認証モードとして Windows を指定します。 このモードは、ASP.NET が基本認証、ダイジェスト認証、統合 Windows 認証 (NTLM/Kerberos)、またはクライアント証明書マッピングの各認証方法を使用する場合に適用されます。
2 Passport 認証モードとして Microsoft Passport Network 認証を指定します。
3 Forms 認証モードとして ASP.NET フォーム認証を指定します。

次の例では、既定の Web サイトの認証モードを表示します。 認証モードが Passport の場合は、リダイレクト URL が表示されます。 モードが Forms の場合は、対応する情報が表示されます。

' Connect to the WMI WebAdministration namespace.  
Set oWebAdmin = _  
    GetObject("winmgmts:root\WebAdministration")  
  
' Get the authentication section.  
Set oSite = oWebAdmin.Get("Site.Name='Default Web Site'")  
oSite.GetSection "AuthenticationSection", oAuthSection  
  
' Display the path and location.  
WScript.Echo "Path: " & oAuthSection.Path  
WScript.Echo "Location: " & oAuthSection.Location  
WScript.Echo   
  
' Get the authentication mode and display it in text.  
strAuthMode = ModeText(oAuthSection.Mode)  
WScript.Echo "Authentication Mode: " &  _  
    "[ " & strAuthMode & " ]"  
  
' If the mode is Passport or Forms, display the   
' additional information.  
If strAuthMode = "Passport" Then  
  
    WScript.Echo "Passport URL: " & "[" & _  
        oAuthSection.Passport.RedirectUrl & "]"  
  
ElseIf strAuthMode = "Forms" then  
  
    DisplayFormsAuthSettings(oAuthSection.Forms)  
  
End If  
  
' Convert the Mode enumeration values to text.  
Function ModeText(enumValue)  
    Select Case enumValue  
        Case 0  
            ModeText = "None"  
        Case 1  
            ModeText = "Windows"  
        Case 2  
            ModeText = "Passport"  
        Case 3  
            ModeText = "Forms"  
        Case Else  
            ModeText = "Undefined enumeration value."  
    End Select  
End Function  
  
' Display the Forms authentication settings.  
Sub DisplayFormsAuthSettings(oFormsAuthConfig)  
    WScript.Echo vbCrLf & "Forms Authentication Settings"  
    WScript.Echo "-----------------------------"  
  
    WScript.Echo "Cookieless: [ " & _  
        CookielessText(oFormsAuthConfig.Cookieless) & " ]"  
  
    WScript.Echo "Default Url: [ " & _  
        oFormsAuthConfig.DefaultUrl & " ]"  
  
    WScript.Echo "Domain: [ " & _  
        oFormsAuthConfig.Domain & " ]"  
  
    WScript.Echo "EnableCrossAppRedirects: [" & _  
        oFormsAuthConfig.EnableCrossAppRedirects & " ]"  
  
    WScript.Echo "LoginUrl: [ " & _  
        oFormsAuthConfig.LoginUrl & " ]"  
  
    WScript.Echo "Name: [ " & _  
        oFormsAuthConfig.Name & " ]"  
  
    WScript.Echo "Path: [ " & _  
        oFormsAuthConfig.Path & " ]"  
  
    WScript.Echo "Protection: [ " & _  
        ProtectionText(oFormsAuthConfig.Protection) & " ]"  
  
    WScript.Echo "RequireSSL: [ " & _  
        oFormsAuthConfig.RequireSSL & " ]"  
  
    WScript.Echo "SlidingExpiration: [ " & _  
        oFormsAuthConfig.SlidingExpiration & " ]"  
  
    WScript.Echo "Timeout: [ " & _  
        oFormsAuthConfig.Timeout & " ]"  
  
    DisplayCredentials(oFormsAuthConfig.Credentials)  
  
End Sub  
  
' Convert the Cookieless enumeration values to text.  
Function CookielessText(enumValue)  
    Select Case enumValue  
        Case 0  
            CookielessText = "UseUri"  
        Case 1  
            CookielessText = "UseCookies"  
        Case 2  
            CookielessText = "AutoDetect"  
        Case 3  
            CookielessText = "UseDeviceProfile"  
        Case Else  
            CookielessText = "Undefined enumeration value."  
    End Select  
End Function  
  
' Convert the Protection enumeration values to text.  
Function ProtectionText(enumValue)  
    Select Case enumValue  
        Case 0  
            ProtectionText = "All"  
        Case 1  
            ProtectionText = "None"  
        Case 2  
            ProtectionText = "Encryption"  
        Case 3  
            ProtectionText = "Validation"  
        Case Else  
            ProtectionText = "Undefined enumeration value."  
    End Select  
End Function  
  
' Display the Forms authentication credentials.  
Sub DisplayCredentials(FA_Credentials)  
    WScript.Echo vbCrLf & "Forms Authentication Credentials"  
    WScript.Echo "--------------------------------"  
    WScript.Echo "Password Format: " & _  
        PwdFormatText(FA_Credentials.PasswordFormat) & VbCrLf  
  
    For Each FormsAuthUser In FA_Credentials.Credentials  
        WScript.Echo "    Name: [ " & FormsAuthUser.Name & " ]"  
        WScript.Echo "Password: [ " & _  
            FormsAuthUser.Password& " ]"  
        WScript.Echo  
    Next  
End Sub  
  
' Convert the PasswordFormat enumeration values to text.  
Function PwdFormatText(enumValue)  
    Select Case enumValue  
        Case 0  
            PwdFormatText = "Clear"  
        Case 1  
            PwdFormatText = "SHA1"  
        Case 2  
            PwdFormatText = "MD5"  
        Case Else  
            PwdFormatText = "Undefined enumeration value."  
    End Select  
End Function  
  

継承階層

ConfigurationSection

ConfigurationSectionWithCollection

AuthenticationSection

要件

説明
クライアント - Windows Vista 上の IIS 7.0
- Windows 7 上の IIS 7.5
- Windows 8 上の IIS 8.0
- Windows 10 上の IIS 10.0
[サーバー] - Windows Server 2008 上の IIS 7.0
- Windows Server 2008 R2 上の IIS 7.5
- Windows Server 2012 上の IIS 8.0
- Windows Server 2012 R2 上の IIS 8.5
- Windows Server 2016 上の IIS 10.0
Product - IIS 7.0、IIS 7.5、IIS 8.0、IIS 8.5、IIS 10.0
MOF ファイル WebAdministration.mof

参照

AnonymousAuthenticationSection クラス
BasicAuthenticationSection クラス
ClientCertificateMappingAuthenticationSection クラス
ConfigurationSectionWithCollection クラス
DigestAuthenticationSection クラス
FormsAuthenticationConfiguration クラス
FormsAuthenticationCredentials クラス
FormsAuthenticationUser クラス
IisClientCertificateMappingAuthenticationSection クラス
PassportAuthentication クラス
WindowsAuthenticationSection クラス