ConnectionProfile.IsDomainAuthenticatedBy(DomainAuthenticationKind) Methode

Definition

Fragt ab, ob die angegebene Domänenauthentifizierungsmethode für dieses Verbindungsprofil erfolgreich war.

public:
 virtual bool IsDomainAuthenticatedBy(DomainAuthenticationKind kind) = IsDomainAuthenticatedBy;
bool IsDomainAuthenticatedBy(DomainAuthenticationKind const& kind);
public bool IsDomainAuthenticatedBy(DomainAuthenticationKind kind);
function isDomainAuthenticatedBy(kind)
Public Function IsDomainAuthenticatedBy (kind As DomainAuthenticationKind) As Boolean

Parameter

kind
DomainAuthenticationKind

Die spezifische Domänenauthentifizierungsmethode, zu der Abfragen ausgeführt werden sollen.

Gibt zurück

Boolean

bool

true , wenn dieses Verbindungsprofil über die gleiche Domänenauthentifizierungsart wie im kind-Parameter verfügt; false , wenn dieses Verbindungsprofil über eine andere Domänenauthentifizierungsart als die angegebene verfügt.

Windows-Anforderungen

Gerätefamilie
Windows 11 Insider Preview (eingeführt in 10.0.23504.0)
API contract
Windows.Foundation.UniversalApiContract (eingeführt in v15.0)

Beispiele

Das Szenario für dieses Codebeispiel ist, dass ein Netzwerkdiagnosetool für IT-Administratoren sicherstellen möchte, dass Verbindungen mit einem Unternehmensnetzwerk über die richtigen Authentifizierungseigenschaften verfügen.

using Windows.Networking.Connectivity;

...

public class Diagnostics
{
    private async void LogToConsole(string output, string connectionProfileName)
    {
        // Implementation omitted for brevity.
    }

    public async void RunDiagnostics()
    {
        // Retrieve the ConnectionProfile.
        ConnectionProfile internetConnectionProfile =
            NetworkInformation.GetInternetConnectionProfile();
        if (internetConnectionProfile == null)
        {
            LogToConsole("Device isn't connected to a network", "");
            return;
        }

        string connectionProfileName =
            internetConnectionProfile.ProfileName;
        bool isDomainAuthenticated =
            !internetConnectionProfile.IsDomainAuthenticatedBy(DomainAuthenticationKind.None);
        bool isLdapAuthenticated =
            internetConnectionProfile.IsDomainAuthenticatedBy(DomainAuthenticationKind.Ldap);
        bool isTlsAuthenticated =
            internetConnectionProfile.IsDomainAuthenticatedBy(DomainAuthenticationKind.Tls);

        if (isDomainAuthenticated)
        {
            if (isLdapAuthenticated)
            {
                LogToConsole("Connection profile is domain-authenticated via LDAP",
                    connectionProfileName);
            }
            if (isTlsAuthenticated)
            {
                LogToConsole("Connection profile is domain-authenticated via TLS",
                    connectionProfileName);
            }

            if (!isLdapAuthenticated && !isTlsAuthenticated)
            {
                LogToConsole("Connection profile wasn't expected to be domain authenticated for any other kinds",
                    connectionProfileName);
            }
        }
        else
        {
            LogToConsole("Connection profile isn't domain-authenticated",
                connectionProfileName);
        }
    }
}

Gilt für: