public ServiceSecurityAuditBehavior() { this.auditLogLocation = ServiceSecurityAuditBehavior.defaultAuditLogLocation; this.suppressAuditFailure = ServiceSecurityAuditBehavior.defaultSuppressAuditFailure; this.serviceAuthorizationAuditLevel = ServiceSecurityAuditBehavior.defaultServiceAuthorizationAuditLevel; this.messageAuthenticationAuditLevel = ServiceSecurityAuditBehavior.defaultMessageAuthenticationAuditLevel; }
internal SecurityProtocolFactory(SecurityProtocolFactory factory) : this() { if (factory == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("factory"); } _actAsInitiator = factory._actAsInitiator; _addTimestamp = factory._addTimestamp; _detectReplays = factory._detectReplays; _incomingAlgorithmSuite = factory._incomingAlgorithmSuite; _maxCachedNonces = factory._maxCachedNonces; _maxClockSkew = factory._maxClockSkew; _outgoingAlgorithmSuite = factory._outgoingAlgorithmSuite; _replayWindow = factory._replayWindow; _channelSupportingTokenAuthenticatorSpecification = new Collection <SupportingTokenAuthenticatorSpecification>(new List <SupportingTokenAuthenticatorSpecification>(factory._channelSupportingTokenAuthenticatorSpecification)); _scopedSupportingTokenAuthenticatorSpecification = new Dictionary <string, ICollection <SupportingTokenAuthenticatorSpecification> >(factory._scopedSupportingTokenAuthenticatorSpecification); _standardsManager = factory._standardsManager; _timestampValidityDuration = factory._timestampValidityDuration; _auditLogLocation = factory._auditLogLocation; _suppressAuditFailure = factory._suppressAuditFailure; _serviceAuthorizationAuditLevel = factory._serviceAuthorizationAuditLevel; _messageAuthenticationAuditLevel = factory._messageAuthenticationAuditLevel; if (factory._securityBindingElement != null) { _securityBindingElement = (SecurityBindingElement)factory._securityBindingElement.Clone(); } _securityTokenManager = factory._securityTokenManager; _privacyNoticeUri = factory._privacyNoticeUri; _privacyNoticeVersion = factory._privacyNoticeVersion; _extendedProtectionPolicy = factory._extendedProtectionPolicy; _nonceCache = factory._nonceCache; }
ServiceSecurityAuditBehavior(ServiceSecurityAuditBehavior behavior) { this.auditLogLocation = behavior.auditLogLocation; this.suppressAuditFailure = behavior.suppressAuditFailure; this.serviceAuthorizationAuditLevel = behavior.serviceAuthorizationAuditLevel; this.messageAuthenticationAuditLevel = behavior.messageAuthenticationAuditLevel; }
public static void Validate(AuditLogLocation value) { if (!IsDefined(value)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidEnumArgumentException("value", (int)value, typeof(AuditLogLocation))); } }
public ServiceSecurityAuditBehavior() { this.auditLogLocation = ServiceSecurityAuditBehavior.defaultAuditLogLocation; this.suppressAuditFailure = ServiceSecurityAuditBehavior.defaultSuppressAuditFailure; this.serviceAuthorizationAuditLevel = ServiceSecurityAuditBehavior.defaultServiceAuthorizationAuditLevel; this.messageAuthenticationAuditLevel = ServiceSecurityAuditBehavior.defaultMessageAuthenticationAuditLevel; }
ServiceSecurityAuditBehavior(ServiceSecurityAuditBehavior behavior) { this.auditLogLocation = behavior.auditLogLocation; this.suppressAuditFailure = behavior.suppressAuditFailure; this.serviceAuthorizationAuditLevel = behavior.serviceAuthorizationAuditLevel; this.messageAuthenticationAuditLevel = behavior.messageAuthenticationAuditLevel; }
public static void Validate(AuditLogLocation value) { if (!IsDefined(value)) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidEnumArgumentException("value", (int) value, typeof(AuditLogLocation))); } }
public static bool IsDefined(AuditLogLocation auditLogLocation) { if (auditLogLocation == AuditLogLocation.Security && !SecurityAuditHelper.IsSecurityAuditSupported) throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new PlatformNotSupportedException(SR.GetString(SR.SecurityAuditPlatformNotSupported))); return auditLogLocation == AuditLogLocation.Default || auditLogLocation == AuditLogLocation.Application || auditLogLocation == AuditLogLocation.Security; }
public static bool IsDefined(AuditLogLocation auditLogLocation) { if (auditLogLocation == AuditLogLocation.Security && !SecurityAuditHelper.IsSecurityAuditSupported) throw ExceptionHelper.PlatformNotSupported(SR.SecurityAuditPlatformNotSupported); return auditLogLocation == AuditLogLocation.Default || auditLogLocation == AuditLogLocation.Application || auditLogLocation == AuditLogLocation.Security; }
public static bool IsDefined(AuditLogLocation auditLogLocation) { if (auditLogLocation == AuditLogLocation.Security && !SecurityAuditHelper.IsSecurityAuditSupported) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new PlatformNotSupportedException(SR.GetString(SR.SecurityAuditPlatformNotSupported))); } return(auditLogLocation == AuditLogLocation.Default || auditLogLocation == AuditLogLocation.Application || auditLogLocation == AuditLogLocation.Security); }
public static bool IsDefined(AuditLogLocation auditLogLocation) { if (auditLogLocation == AuditLogLocation.Security && !SecurityAuditHelper.IsSecurityAuditSupported) { throw ExceptionHelper.PlatformNotSupported(SR.SecurityAuditPlatformNotSupported); } return(auditLogLocation == AuditLogLocation.Default || auditLogLocation == AuditLogLocation.Application || auditLogLocation == AuditLogLocation.Security); }
public static bool IsDefined(AuditLogLocation auditLogLocation) { if ((auditLogLocation == AuditLogLocation.Security) && !SecurityAuditHelper.IsSecurityAuditSupported) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new PlatformNotSupportedException(System.ServiceModel.SR.GetString("SecurityAuditPlatformNotSupported"))); } if ((auditLogLocation != AuditLogLocation.Default) && (auditLogLocation != AuditLogLocation.Application)) { return (auditLogLocation == AuditLogLocation.Security); } return true; }
public static bool IsDefined(AuditLogLocation auditLogLocation) { if ((auditLogLocation == AuditLogLocation.Security) && !SecurityAuditHelper.IsSecurityAuditSupported) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new PlatformNotSupportedException(System.ServiceModel.SR.GetString("SecurityAuditPlatformNotSupported"))); } if ((auditLogLocation != AuditLogLocation.Default) && (auditLogLocation != AuditLogLocation.Application)) { return(auditLogLocation == AuditLogLocation.Security); } return(true); }
private SecurityImpersonationBehavior(DispatchRuntime dispatch) { this.principalPermissionMode = dispatch.PrincipalPermissionMode; this.impersonateCallerForAllOperations = dispatch.ImpersonateCallerForAllOperations; this.auditLevel = dispatch.MessageAuthenticationAuditLevel; this.auditLogLocation = dispatch.SecurityAuditLogLocation; this.suppressAuditFailure = dispatch.SuppressAuditFailure; if (dispatch.IsRoleProviderSet) { this.ApplyRoleProvider(dispatch); } this.domainNameMap = new Dictionary<string, string>(5, StringComparer.OrdinalIgnoreCase); }
private SecurityImpersonationBehavior(DispatchRuntime dispatch) { this.principalPermissionMode = dispatch.PrincipalPermissionMode; this.impersonateCallerForAllOperations = dispatch.ImpersonateCallerForAllOperations; this.auditLevel = dispatch.MessageAuthenticationAuditLevel; this.auditLogLocation = dispatch.SecurityAuditLogLocation; this.suppressAuditFailure = dispatch.SuppressAuditFailure; if (dispatch.IsRoleProviderSet) { this.ApplyRoleProvider(dispatch); } this.domainNameMap = new Dictionary <string, string>(5, StringComparer.OrdinalIgnoreCase); }
private DispatchRuntime(SharedRuntimeState shared) { this.shared = shared; this.operations = new OperationCollection(this); this.inputSessionShutdownHandlers = this.NewBehaviorCollection <IInputSessionShutdown>(); this.messageInspectors = this.NewBehaviorCollection <IDispatchMessageInspector>(); this.instanceContextInitializers = this.NewBehaviorCollection <IInstanceContextInitializer>(); this.synchronizationContext = ThreadBehavior.GetCurrentSynchronizationContext(); this.automaticInputSessionShutdown = true; this.principalPermissionMode = System.ServiceModel.Description.PrincipalPermissionMode.UseWindowsGroups; this.securityAuditLogLocation = AuditLogLocation.Default; this.suppressAuditFailure = true; this.serviceAuthorizationAuditLevel = AuditLevel.None; this.messageAuthenticationAuditLevel = AuditLevel.None; this.unhandled = new DispatchOperation(this, "*", "*", "*"); this.unhandled.InternalFormatter = MessageOperationFormatter.Instance; this.unhandled.InternalInvoker = new UnhandledActionInvoker(this); }
public static void WriteTransportAuthenticationSuccessEvent(AuditLogLocation auditLogLocation, bool suppressAuditFailure, Message message, Uri serviceUri, string clientIdentity) { try { if (auditLogLocation == AuditLogLocation.Default) { auditLogLocation = IsSecurityAuditSupported ? AuditLogLocation.Security : AuditLogLocation.Application; } string activityId = GetActivityId(); if (auditLogLocation == AuditLogLocation.Application) { WriteEventToApplicationLog(new EventInstance(0x40060007L, 2, EventLogEntryType.Information), new object[] { serviceUri.AbsoluteUri, clientIdentity, activityId }); } else { if (auditLogLocation != AuditLogLocation.Security) { throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("auditLogLocation", System.ServiceModel.SR.GetString("SecurityAuditPlatformNotSupported"))); } WriteAuditEvent(1, 0x40060007, new string[] { serviceUri.AbsoluteUri, clientIdentity, activityId }); } if (System.ServiceModel.DiagnosticUtility.ShouldTraceVerbose) { TraceUtility.TraceEvent(TraceEventType.Verbose, 0x70053, System.ServiceModel.SR.GetString("TraceCodeSecurityAuditWrittenSuccess"), new SecurityAuditTraceRecord(auditLogLocation, "TransportAuthenticationSuccess"), null, null, message); } } catch (Exception exception) { if (Fx.IsFatal(exception)) { throw; } if (System.ServiceModel.DiagnosticUtility.ShouldTraceWarning) { TraceUtility.TraceEvent(TraceEventType.Warning, 0x70054, System.ServiceModel.SR.GetString("TraceCodeSecurityAuditWrittenFailure"), new SecurityAuditTraceRecord(auditLogLocation, "TransportAuthenticationSuccess"), null, exception, message); } if (!suppressAuditFailure) { throw; } } }
public static void WriteImpersonationFailureEvent(AuditLogLocation auditLogLocation, bool suppressAuditFailure, string operationName, string clientIdentity, Exception exception) { try { if (auditLogLocation == AuditLogLocation.Default) { auditLogLocation = IsSecurityAuditSupported ? AuditLogLocation.Security : AuditLogLocation.Application; } string activityId = GetActivityId(); if (auditLogLocation == AuditLogLocation.Application) { WriteEventToApplicationLog(new EventInstance(0xc006000aL, 2, EventLogEntryType.Error), new object[] { operationName, clientIdentity, activityId, ExceptionToString(exception) }); } else { if (auditLogLocation != AuditLogLocation.Security) { throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("auditLogLocation", System.ServiceModel.SR.GetString("SecurityAuditPlatformNotSupported"))); } WriteAuditEvent(0, 0xc006000a, new string[] { operationName, clientIdentity, activityId, ExceptionToString(exception) }); } if (System.ServiceModel.DiagnosticUtility.ShouldTraceVerbose) { TraceUtility.TraceEvent(TraceEventType.Verbose, 0x70053, System.ServiceModel.SR.GetString("TraceCodeSecurityAuditWrittenSuccess"), new SecurityAuditTraceRecord(auditLogLocation, "ImpersonationFailure"), null, null); } } catch (Exception exception2) { if (Fx.IsFatal(exception2)) { throw; } if (System.ServiceModel.DiagnosticUtility.ShouldTraceWarning) { TraceUtility.TraceEvent(TraceEventType.Warning, 0x70054, System.ServiceModel.SR.GetString("TraceCodeSecurityAuditWrittenFailure"), new SecurityAuditTraceRecord(auditLogLocation, "ImpersonationFailure"), null, exception2); } if (!suppressAuditFailure) { throw; } } }
DispatchRuntime(SharedRuntimeState shared) { this.shared = shared; this.operations = new OperationCollection(this); this.inputSessionShutdownHandlers = this.NewBehaviorCollection <IInputSessionShutdown>(); this.messageInspectors = this.NewBehaviorCollection <IDispatchMessageInspector>(); this.instanceContextInitializers = this.NewBehaviorCollection <IInstanceContextInitializer>(); this.synchronizationContext = ThreadBehavior.GetCurrentSynchronizationContext(); this.automaticInputSessionShutdown = true; this.principalPermissionMode = ServiceAuthorizationBehavior.DefaultPrincipalPermissionMode; this.securityAuditLogLocation = ServiceSecurityAuditBehavior.defaultAuditLogLocation; this.suppressAuditFailure = ServiceSecurityAuditBehavior.defaultSuppressAuditFailure; this.serviceAuthorizationAuditLevel = ServiceSecurityAuditBehavior.defaultServiceAuthorizationAuditLevel; this.messageAuthenticationAuditLevel = ServiceSecurityAuditBehavior.defaultMessageAuthenticationAuditLevel; this.unhandled = new DispatchOperation(this, "*", MessageHeaders.WildcardAction, MessageHeaders.WildcardAction); this.unhandled.InternalFormatter = MessageOperationFormatter.Instance; this.unhandled.InternalInvoker = new UnhandledActionInvoker(this); }
public static void WriteTransportAuthenticationSuccessEvent(AuditLogLocation auditLogLocation, bool suppressAuditFailure, Message message, Uri serviceUri, string clientIdentity) { try { if (auditLogLocation == AuditLogLocation.Default) { auditLogLocation = IsSecurityAuditSupported ? AuditLogLocation.Security : AuditLogLocation.Application; } string activityId = GetActivityId(); if (auditLogLocation == AuditLogLocation.Application) { WriteEventToApplicationLog(new EventInstance(0x40060007L, 2, EventLogEntryType.Information), new object[] { serviceUri.AbsoluteUri, clientIdentity, activityId }); } else { if (auditLogLocation != AuditLogLocation.Security) { throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("auditLogLocation", System.ServiceModel.SR.GetString("SecurityAuditPlatformNotSupported"))); } WriteAuditEvent(1, 0x40060007, new string[] { serviceUri.AbsoluteUri, clientIdentity, activityId }); } if (System.ServiceModel.DiagnosticUtility.ShouldTraceVerbose) { TraceUtility.TraceEvent(TraceEventType.Verbose, 0x70053, System.ServiceModel.SR.GetString("TraceCodeSecurityAuditWrittenSuccess"), new SecurityAuditTraceRecord(auditLogLocation, "TransportAuthenticationSuccess"), null, null, message); } } catch (Exception exception) { if (Fx.IsFatal(exception)) { throw; } if (System.ServiceModel.DiagnosticUtility.ShouldTraceWarning) { TraceUtility.TraceEvent(TraceEventType.Warning, 0x70054, System.ServiceModel.SR.GetString("TraceCodeSecurityAuditWrittenFailure"), new SecurityAuditTraceRecord(auditLogLocation, "TransportAuthenticationSuccess"), null, exception, message); } if (!suppressAuditFailure) { throw; } } }
internal SecurityAuditTraceRecord(AuditLogLocation auditLogLocation, string auditType) { this.auditLogLocation = auditLogLocation; this.auditType = auditType; }
public static void WriteImpersonationFailureEvent(AuditLogLocation auditLogLocation, bool suppressAuditFailure, string operationName, string clientIdentity, Exception exception) { try { if (auditLogLocation == AuditLogLocation.Default) { auditLogLocation = IsSecurityAuditSupported ? AuditLogLocation.Security : AuditLogLocation.Application; } string activityId = GetActivityId(); if (auditLogLocation == AuditLogLocation.Application) { WriteEventToApplicationLog(new EventInstance(0xc006000aL, 2, EventLogEntryType.Error), new object[] { operationName, clientIdentity, activityId, ExceptionToString(exception) }); } else { if (auditLogLocation != AuditLogLocation.Security) { throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("auditLogLocation", System.ServiceModel.SR.GetString("SecurityAuditPlatformNotSupported"))); } WriteAuditEvent(0, 0xc006000a, new string[] { operationName, clientIdentity, activityId, ExceptionToString(exception) }); } if (System.ServiceModel.DiagnosticUtility.ShouldTraceVerbose) { TraceUtility.TraceEvent(TraceEventType.Verbose, 0x70053, System.ServiceModel.SR.GetString("TraceCodeSecurityAuditWrittenSuccess"), new SecurityAuditTraceRecord(auditLogLocation, "ImpersonationFailure"), null, null); } } catch (Exception exception2) { if (Fx.IsFatal(exception2)) { throw; } if (System.ServiceModel.DiagnosticUtility.ShouldTraceWarning) { TraceUtility.TraceEvent(TraceEventType.Warning, 0x70054, System.ServiceModel.SR.GetString("TraceCodeSecurityAuditWrittenFailure"), new SecurityAuditTraceRecord(auditLogLocation, "ImpersonationFailure"), null, exception2); } if (!suppressAuditFailure) { throw; } } }
internal SecurityAuditTraceRecord(AuditLogLocation auditLogLocation, string auditType) { this.auditLogLocation = auditLogLocation; this.auditType = auditType; }