ServiceSecurityAuditBehavior Klas

Definitie

Hiermee geeft u het controlegedrag van beveiligingsgebeurtenissen op. Over het algemeen bestaan de beveiligingsevenementen uit verificatie-gebeurtenissen, zoals transport, bericht of onderhandelen over verificatie en autorisatie-gebeurtenis. Zie ServiceAuthorizationManager voor meer informatie.

public ref class ServiceSecurityAuditBehavior sealed : System::ServiceModel::Description::IServiceBehavior
public sealed class ServiceSecurityAuditBehavior : System.ServiceModel.Description.IServiceBehavior
type ServiceSecurityAuditBehavior = class
    interface IServiceBehavior
Public NotInheritable Class ServiceSecurityAuditBehavior
Implements IServiceBehavior
Overname
ServiceSecurityAuditBehavior
Implementeringen

Voorbeelden

Met de volgende code maakt u een exemplaar van de ServiceHost klasse en voegt u een nieuw ServiceSecurityAuditBehavior exemplaar toe aan de verzameling gedrag.

public static void Main()
{
    // Get base address from appsettings in configuration.
    Uri baseAddress = new Uri(ConfigurationManager.
        AppSettings["baseAddress"]);

    // Create a ServiceHost for the CalculatorService type
    // and provide the base address.
    using (ServiceHost serviceHost = new
        ServiceHost(typeof(CalculatorService), baseAddress))
    {
        // Create a new auditing behavior and set the log location.
        ServiceSecurityAuditBehavior newAudit =
            new ServiceSecurityAuditBehavior();
        newAudit.AuditLogLocation =
            AuditLogLocation.Application;
        newAudit.MessageAuthenticationAuditLevel =
            AuditLevel.SuccessOrFailure;
        newAudit.ServiceAuthorizationAuditLevel =
            AuditLevel.SuccessOrFailure;
        newAudit.SuppressAuditFailure = false;
        // Remove the old behavior and add the new.
        serviceHost.Description.
            Behaviors.Remove<ServiceSecurityAuditBehavior>();
        serviceHost.Description.Behaviors.Add(newAudit);
        // Open the ServiceHostBase to create listeners
        // and start listening for messages.
        serviceHost.Open();

        // The service can now be accessed.
        Console.WriteLine("The service is ready.");
        Console.WriteLine("Press <ENTER> to terminate service.");
        Console.WriteLine();
        Console.ReadLine();

        // Close the ServiceHostBase to shutdown the service.
        serviceHost.Close();
    }
}
Public Shared Sub Main() 
    ' Get base address from appsettings in configuration.
    Dim baseAddress As New Uri(ConfigurationManager.AppSettings("baseAddress"))
    
    ' Create a ServiceHost for the CalculatorService type 
    ' and provide the base address.
    Dim serviceHost As New ServiceHost(GetType(CalculatorService), baseAddress)
    Try
        ' Create a new auditing behavior and set the log location.
        Dim newAudit As New ServiceSecurityAuditBehavior()
        newAudit.AuditLogLocation = AuditLogLocation.Application
        newAudit.MessageAuthenticationAuditLevel = _
            AuditLevel.SuccessOrFailure
        newAudit.ServiceAuthorizationAuditLevel = _
            AuditLevel.SuccessOrFailure
        newAudit.SuppressAuditFailure = False
        ' Remove the old behavior and add the new.
        serviceHost.Description.Behaviors.Remove(Of ServiceSecurityAuditBehavior)
        serviceHost.Description.Behaviors.Add(newAudit)
        ' Open the ServiceHostBase to create listeners 
        ' and start listening for messages.
        serviceHost.Open()
        
        ' The service can now be accessed.
        Console.WriteLine("The service is ready.")
        Console.WriteLine("Press <ENTER> to terminate service.")
        Console.WriteLine()
        Console.ReadLine()
        
        ' Close the ServiceHostBase to shutdown the service.
        serviceHost.Close()
    Finally
    End Try

End Sub

Opmerkingen

De klasse ServiceSecurityAuditBehavior wordt gebruikt om verificatiegebeurtenissen van Windows Communication Foundation (WCF) te controleren. Wanneer controle is ingeschakeld, kunnen geslaagde of mislukte verificatiepogingen (of beide) worden gecontroleerd. De gebeurtenissen worden geschreven naar een van de drie gebeurtenislogboeken: toepassing, beveiliging of het standaardlogboek voor de versie van het besturingssysteem. De gebeurtenislogboeken kunnen allemaal worden weergegeven met behulp van de Windows-logboeken.

Gebruik deze klasse om op te geven naar welk gebeurtenislogboek wordt geschreven, evenals soorten verificatie-gebeurtenissen die moeten worden geschreven. U kunt ook opgeven of controlefouten moeten worden onderdrukt door de SuppressAuditFailure eigenschap in te false stellen op (de standaardinstelling).true

Zie Controle voor meer informatie over het controleren van beveiligingsevenementen voor WCF-toepassingen.

Gebruik de< serviceSecurityAudit> om het controlegedrag in de configuratie op te geven.

Constructors

Name Description
ServiceSecurityAuditBehavior()

Initialiseert een nieuw exemplaar van de ServiceSecurityAuditBehavior klasse.

Eigenschappen

Name Description
AuditLogLocation

Hiermee haalt u de locatie op waar beveiligde gebeurtenislogboeken worden geschreven.

MessageAuthenticationAuditLevel

Hiermee haalt u het type verificatiegebeurtenissen op of stelt u deze in om te controleren op berichtniveau.

ServiceAuthorizationAuditLevel

Hiermee haalt u het type autorisatiegebeurtenissen op of stelt u deze in om te controleren op serviceniveau.

SuppressAuditFailure

Hiermee wordt een waarde opgehaald of ingesteld die aangeeft of het niet controleren van invloed is op de toepassing.

Methoden

Name Description
Equals(Object)

Bepaalt of het opgegeven object gelijk is aan het huidige object.

(Overgenomen van Object)
GetHashCode()

Fungeert als de standaardhashfunctie.

(Overgenomen van Object)
GetType()

Hiermee haalt u de Type huidige instantie op.

(Overgenomen van Object)
MemberwiseClone()

Hiermee maakt u een ondiepe kopie van de huidige Object.

(Overgenomen van Object)
ToString()

Retourneert een tekenreeks die het huidige object vertegenwoordigt.

(Overgenomen van Object)

Expliciete interface-implementaties

Name Description
IServiceBehavior.AddBindingParameters(ServiceDescription, ServiceHostBase, Collection<ServiceEndpoint>, BindingParameterCollection)

Geeft aangepaste gegevens door aan bindingselementen ter ondersteuning van de contractuitvoering.

IServiceBehavior.ApplyDispatchBehavior(ServiceDescription, ServiceHostBase)

Biedt de mogelijkheid om runtime-eigenschapswaarden te wijzigen of aangepaste extensieobjecten in te voegen, zoals fouthandlers, bericht- of parameter interceptors, beveiligingsextensies en andere aangepaste extensieobjecten.

IServiceBehavior.Validate(ServiceDescription, ServiceHostBase)

Niet geïmplementeerd.

Van toepassing op