private void DumpEntries(ITimeTable timeTable, bool toAuditTrail, AuditLevel level, IProperty property)
        {
            if (!timeTable.Contains(property))
            {
                return;
            }

            String message = String.Format(CultureInfo.InvariantCulture, "Entries for property {0}", property.Name);

            if (toAuditTrail)
            {
                m_MyCmDevice.AuditMessage(level, message);
            }
            else
            {
                Debug.WriteLine(message);
            }

            for (Int32 index = 0; index < timeTable.Size; index++)
            {
                ITimeTableEntry entry = timeTable.Entry(index);
                if (entry.Property == property)
                {
                    message = String.Format(CultureInfo.InvariantCulture, "Time: {0} Value: {1}", RetentionToString(entry.Time), entry.Value);
                    if (toAuditTrail)
                    {
                        m_MyCmDevice.AuditMessage(level, message);
                    }
                    else
                    {
                        Debug.WriteLine(message);
                    }
                }
            }
        }
 public ServiceSecurityAuditBehavior()
 {
     this.auditLogLocation = System.ServiceModel.AuditLogLocation.Default;
     this.suppressAuditFailure = true;
     this.serviceAuthorizationAuditLevel = AuditLevel.None;
     this.messageAuthenticationAuditLevel = AuditLevel.None;
 }
 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");
     }
     this.actAsInitiator         = factory.actAsInitiator;
     this.addTimestamp           = factory.addTimestamp;
     this.detectReplays          = factory.detectReplays;
     this.incomingAlgorithmSuite = factory.incomingAlgorithmSuite;
     this.maxCachedNonces        = factory.maxCachedNonces;
     this.maxClockSkew           = factory.maxClockSkew;
     this.outgoingAlgorithmSuite = factory.outgoingAlgorithmSuite;
     this.replayWindow           = factory.replayWindow;
     this.channelSupportingTokenAuthenticatorSpecification = new Collection <SupportingTokenAuthenticatorSpecification>(new List <SupportingTokenAuthenticatorSpecification>(factory.channelSupportingTokenAuthenticatorSpecification));
     this.scopedSupportingTokenAuthenticatorSpecification  = new Dictionary <string, ICollection <SupportingTokenAuthenticatorSpecification> >(factory.scopedSupportingTokenAuthenticatorSpecification);
     this.standardsManager                = factory.standardsManager;
     this.timestampValidityDuration       = factory.timestampValidityDuration;
     this.auditLogLocation                = factory.auditLogLocation;
     this.suppressAuditFailure            = factory.suppressAuditFailure;
     this.serviceAuthorizationAuditLevel  = factory.serviceAuthorizationAuditLevel;
     this.messageAuthenticationAuditLevel = factory.messageAuthenticationAuditLevel;
     if (factory.securityBindingElement != null)
     {
         this.securityBindingElement = (System.ServiceModel.Channels.SecurityBindingElement)factory.securityBindingElement.Clone();
     }
     this.securityTokenManager     = factory.securityTokenManager;
     this.privacyNoticeUri         = factory.privacyNoticeUri;
     this.privacyNoticeVersion     = factory.privacyNoticeVersion;
     this.endpointFilterTable      = factory.endpointFilterTable;
     this.extendedProtectionPolicy = factory.extendedProtectionPolicy;
 }
 public static void Validate(AuditLevel value)
 {
     if (!IsDefined(value))
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidEnumArgumentException("value", (int)value, typeof(AuditLevel)));
     }
 }
示例#6
0
        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;
        }
示例#7
0
 public static bool IsDefined(AuditLevel auditLevel)
 {
     return auditLevel == AuditLevel.None
         || auditLevel == AuditLevel.Success
         || auditLevel == AuditLevel.Failure
         || auditLevel == AuditLevel.SuccessOrFailure;
 }
 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(AuditLevel value)
 {
     if (!IsDefined(value))
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidEnumArgumentException("value", (int) value, typeof(AuditLevel)));
     }
 }
示例#11
0
 public ServiceSecurityAuditBehavior()
 {
     this.auditLogLocation                = System.ServiceModel.AuditLogLocation.Default;
     this.suppressAuditFailure            = true;
     this.serviceAuthorizationAuditLevel  = AuditLevel.None;
     this.messageAuthenticationAuditLevel = AuditLevel.None;
 }
 private void WriteAuditEvent(AuditLevel auditLevel, X509Certificate2 certificate, WindowsSidIdentity wsid, Exception exception)
 {
     try
     {
         string clientIdentity = string.Empty;
         if (certificate != null)
         {
             clientIdentity = System.ServiceModel.Security.SecurityUtils.GetCertificateId(certificate);
         }
         else if (wsid != null)
         {
             clientIdentity = System.ServiceModel.Security.SecurityUtils.GetIdentityName(wsid);
         }
         if (auditLevel == AuditLevel.Success)
         {
             SecurityAuditHelper.WriteTransportAuthenticationSuccessEvent(base.AuditBehavior.AuditLogLocation, base.AuditBehavior.SuppressAuditFailure, null, this.Uri, clientIdentity);
         }
         else
         {
             SecurityAuditHelper.WriteTransportAuthenticationFailureEvent(base.AuditBehavior.AuditLogLocation, base.AuditBehavior.SuppressAuditFailure, null, this.Uri, clientIdentity, exception);
         }
     }
     catch (Exception exception2)
     {
         if (Fx.IsFatal(exception2) || (auditLevel == AuditLevel.Success))
         {
             throw;
         }
         DiagnosticUtility.ExceptionUtility.TraceHandledException(exception2, TraceEventType.Error);
     }
 }
示例#13
0
 public static bool IsDefined(AuditLevel auditLevel)
 {
     return(auditLevel == AuditLevel.None ||
            auditLevel == AuditLevel.Success ||
            auditLevel == AuditLevel.Failure ||
            auditLevel == AuditLevel.SuccessOrFailure);
 }
 ServiceSecurityAuditBehavior(ServiceSecurityAuditBehavior behavior)
 {
     this.auditLogLocation                = behavior.auditLogLocation;
     this.suppressAuditFailure            = behavior.suppressAuditFailure;
     this.serviceAuthorizationAuditLevel  = behavior.serviceAuthorizationAuditLevel;
     this.messageAuthenticationAuditLevel = behavior.messageAuthenticationAuditLevel;
 }
示例#15
0
 private AuditLog CreateAuditLog(string message, AuditLevel level)
 {
     return(new()
     {
         Message = message,
         Level = level
     });
 }
 public static bool IsDefined(AuditLevel auditLevel)
 {
     if (((auditLevel != AuditLevel.None) && (auditLevel != AuditLevel.Success)) && (auditLevel != AuditLevel.Failure))
     {
         return(auditLevel == AuditLevel.SuccessOrFailure);
     }
     return(true);
 }
 public static bool IsDefined(AuditLevel auditLevel)
 {
     if (((auditLevel != AuditLevel.None) && (auditLevel != AuditLevel.Success)) && (auditLevel != AuditLevel.Failure))
     {
         return (auditLevel == AuditLevel.SuccessOrFailure);
     }
     return true;
 }
示例#18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:System.Object"/> class.
 /// </summary>
 public AuditItem(AuditLevel level, FileSystemTask context, AuditEvent eventId, string message)
 {
     Timestamp = SystemTime.Now();
     Level     = level;
     Context   = context;
     EventId   = eventId;
     Message   = message;
 }
示例#19
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:System.Object"/> class.
 /// </summary>
 public AuditItem(AuditLevel level, FileSystemTask context, AuditEvent eventId, string message)
 {
   Timestamp = SystemTime.Now();
   Level = level;
   Context = context;
   EventId = eventId;
   Message = message;
 }
示例#20
0
 public void AuditMessage(AuditLevel level, string text, string callerMethodName = null)
 {
     if (string.IsNullOrEmpty(callerMethodName))
     {
         callerMethodName = CallerMethodName;
     }
     m_Device.AuditMessage(level, text);
     Log.WriteLine(Id, level, text, callerMethodName);
 }
示例#21
0
 public AuditInterceptor(IOperationInvoker oldInvoker)
     : base(oldInvoker)
 {
     auditLogger = LogConfiguration.NLogFactoryInstance.GetLogger("Audit");
     if (!Enum.TryParse(ConfigurationManager.AppSettings["Log.Audit.Level"], out auditLevel))
     {
         auditLevel = AuditLevel.Info;
     }
 }
        public override void CopyFrom(ServiceModelExtensionElement from)
        {
            base.CopyFrom(from);
            ServiceSecurityAuditElement source = (ServiceSecurityAuditElement)from;
#pragma warning suppress 56506 //[....]; base.CopyFrom() checks for 'from' being null
            this.AuditLogLocation = source.AuditLogLocation;
            this.SuppressAuditFailure = source.SuppressAuditFailure;
            this.ServiceAuthorizationAuditLevel = source.ServiceAuthorizationAuditLevel;
            this.MessageAuthenticationAuditLevel = source.MessageAuthenticationAuditLevel;
        }
示例#23
0
        public void audit(AuditLevel auditLevel, String message)
        {
            DbCommand cmd = _weidb.GetStoredProcCommand("Wei_AddAudit");

            _weidb.AddInParameter(cmd, "@requestid", DbType.Int32, null);
            _weidb.AddInParameter(cmd, "@auditLevel", DbType.Int32, auditLevel);
            _weidb.AddInParameter(cmd, "@message", DbType.String, message);

            _weidb.ExecuteScalar(cmd);
        }
示例#24
0
        public void Test1()
        {
            using (var context = ApplicationDbContext.UseMySql())
            {
                var root = new AuditRoot {
                    LimitQuantity = 20
                };
                context.AuditRoots.Add(root);
                context.SaveChanges();

                var level1 = new AuditLevel {
                    Root = root.Id
                };
                var level2 = new AuditLevel {
                    Root = root.Id
                };
                context.AuditLevels.AddRange(level1, level2);
                context.SaveChanges();

                var value11 = new AuditValue {
                    Level = level1.Id, Quantity = 5
                };
                var value12 = new AuditValue {
                    Level = level1.Id, Quantity = 5
                };
                var value21 = new AuditValue {
                    Level = level2.Id, Quantity = 4
                };
                var value22 = new AuditValue {
                    Level = level2.Id, Quantity = 6
                };
                context.AuditValues.AddRange(value11, value12, value21, value22);
                context.SaveChanges();

                Assert.Equal(20, root.TotalQuantity);

                value11.Quantity = 8;
                context.AuditValues.Remove(value12);
                context.AuditValues.Add(new AuditValue {
                    Level = level1.Id, Quantity = 8
                });
                context.AuditLevels.Remove(level2);
                context.AuditValues.Remove(value21);
                context.SaveChanges();

                Assert.Equal(16, root.TotalQuantity);
            }

            using (var context = ApplicationDbContext.UseMySql())
            {
                var root = context.AuditRoots.First();
                context.AuditRoots.Remove(root);
                context.SaveChanges();
            }
        }
        public override void CopyFrom(ServiceModelExtensionElement from)
        {
            base.CopyFrom(from);
            ServiceSecurityAuditElement source = (ServiceSecurityAuditElement)from;

#pragma warning suppress 56506 //Microsoft; base.CopyFrom() checks for 'from' being null
            this.AuditLogLocation                = source.AuditLogLocation;
            this.SuppressAuditFailure            = source.SuppressAuditFailure;
            this.ServiceAuthorizationAuditLevel  = source.ServiceAuthorizationAuditLevel;
            this.MessageAuthenticationAuditLevel = source.MessageAuthenticationAuditLevel;
        }
示例#26
0
 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);
 }
示例#28
0
 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);
 }
示例#29
0
        public static void AuditException(IAuditor auditor, Exception exception, AuditLevel level, FileSystemTask context, AuditEvent eventId, string message)
        {
            if (!auditor.IsAuditEnabled(level, context))
            {
                return;
            }

            VfsException vfsException = exception as VfsException;

            if (vfsException != null)
            {
                //don't create duplicate or unneccessary entries
                if (vfsException.IsAudited || vfsException.SuppressAuditing)
                {
                    return;
                }
            }

            if (String.IsNullOrEmpty(message))
            {
                message = exception.ToString();
            }
            else
            {
                message = String.Format("{0}\n\n{1}", message, exception);
            }

#if !SILVERLIGHT
            if (exception.StackTrace == null)
            {
                //add stack trace, if not available yet
                message = String.Format("{0}\n{1}", message, Environment.StackTrace);
            }
#endif

            //submit incident
            auditor.Audit(level, context, eventId, message);

            //set audition flag
            if (vfsException != null)
            {
                vfsException.IsAudited = true;
            }
        }
示例#30
0
        public void audit(int requestId, AuditLevel auditLevel, String message)
        {
            if (auditLevel == AuditLevel.Debug)
            {
                LogUtil.logDebug("RequestId:" + requestId + ". " + message);
            }
            else if (auditLevel == AuditLevel.Info)
            {
                LogUtil.logInfo("RequestId:" + requestId + ". " + message);
            }

            DbCommand cmd = _weidb.GetStoredProcCommand("Wei_AddAudit");

            _weidb.AddInParameter(cmd, "@requestid", DbType.Int32, requestId);
            _weidb.AddInParameter(cmd, "@auditLevel", DbType.Int32, auditLevel);
            _weidb.AddInParameter(cmd, "@message", DbType.String, message);

            _weidb.ExecuteScalar(cmd);
        }
示例#31
0
        public void AuditMessage(AuditLevel level, string text, string callerMethodName = null)
        {
            if (string.IsNullOrEmpty(callerMethodName))
            {
                callerMethodName = CallerMethodName;
            }

            if (m_Demo != null)
            {
                m_Demo.AuditMessage(level, text, callerMethodName);
            }
            else
            {
                if (m_DDK != null)
                {
                    m_DDK.AuditMessage(level, text);
                }
                Log.WriteLine(Id, level, text, callerMethodName);
            }
        }
 protected void WriteAuditEvent(AuditLevel auditLevel, string primaryIdentity, Exception exception)
 {
     try
     {
         if (auditLevel == AuditLevel.Success)
         {
             SecurityAuditHelper.WriteTransportAuthenticationSuccessEvent(base.AuditBehavior.AuditLogLocation, base.AuditBehavior.SuppressAuditFailure, null, this.Uri, primaryIdentity);
         }
         else
         {
             SecurityAuditHelper.WriteTransportAuthenticationFailureEvent(base.AuditBehavior.AuditLogLocation, base.AuditBehavior.SuppressAuditFailure, null, this.Uri, primaryIdentity, exception);
         }
     }
     catch (Exception exception2)
     {
         if (Fx.IsFatal(exception2) || (auditLevel == AuditLevel.Success))
         {
             throw;
         }
         DiagnosticUtility.ExceptionUtility.TraceHandledException(exception2, TraceEventType.Error);
     }
 }
示例#33
0
        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);
        }
示例#34
0
 /// <summary>
 /// Audits a given incident.
 /// </summary>
 /// <param name="level">Indicates the severity of an audited incident.</param>
 /// <param name="context">Defines the context of the audited operation on the file system.</param>
 /// <param name="eventId">An identifier that indicates the incident.</param>
 /// <param name="message">An optional message that provides background information.</param>
 public void Audit(AuditLevel level, FileSystemTask context, AuditEvent eventId, string message)
 {
 }
示例#35
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:System.Object"/> class.
 /// </summary>
 public AuditItem(AuditLevel level,  FileSystemTask context, AuditEvent eventId)
   : this(level, context, eventId, String.Empty)
 {
 }
        private void DumpTimeTable(ITimeTable timeTable, string header, bool toAuditTrail, AuditLevel level)
        {
            StringBuilder sb = new StringBuilder(header);

            if (timeTable.StartTime.HundredthSeconds != RetentionTime.InvalidValue)
            {
                sb.AppendFormat(CultureInfo.InvariantCulture, " StartTime: {0}", RetentionToString(timeTable.StartTime));
            }
            if (timeTable.EndTime.HundredthSeconds != RetentionTime.InvalidValue)
            {
                sb.AppendFormat(CultureInfo.InvariantCulture, " EndTime: {0}", RetentionToString(timeTable.EndTime));
            }

            if (toAuditTrail)
            {
                m_MyCmDevice.AuditMessage(level, sb.ToString());
            }
            else
            {
                Debug.WriteLine(sb.ToString());
            }

            DumpEntries(timeTable, toAuditTrail, level, m_FlowHandler.FlowNominalProperty);
            DumpEntries(timeTable, toAuditTrail, level, m_FlowHandler.ComponentProperties[1]);
        }
 private void WriteAuditEvent(StreamSecurityUpgradeAcceptor securityUpgradeAcceptor, AuditLevel auditLevel, Exception exception)
 {
     if (((this.transportSettings.AuditBehavior.MessageAuthenticationAuditLevel & auditLevel) == auditLevel) && (securityUpgradeAcceptor != null))
     {
         string clientIdentity = string.Empty;
         SecurityMessageProperty remoteSecurity = securityUpgradeAcceptor.GetRemoteSecurity();
         if (remoteSecurity != null)
         {
             clientIdentity = GetIdentityNameFromContext(remoteSecurity);
         }
         ServiceSecurityAuditBehavior auditBehavior = this.transportSettings.AuditBehavior;
         if (auditLevel == AuditLevel.Success)
         {
             SecurityAuditHelper.WriteTransportAuthenticationSuccessEvent(auditBehavior.AuditLogLocation, auditBehavior.SuppressAuditFailure, null, this.Via, clientIdentity);
         }
         else
         {
             SecurityAuditHelper.WriteTransportAuthenticationFailureEvent(auditBehavior.AuditLogLocation, auditBehavior.SuppressAuditFailure, null, this.Via, clientIdentity, exception);
         }
     }
 }
        // ACCOUNT TIMELINE
        public async Task <AccountTimeline> GetAccountTimeline(Guid accountId, RequestOptions inputOptions, AuditLevel auditLevel = DefaultAuditLevel)
        {
            var uri = Configuration.ACCOUNTS_PATH + "/" + accountId + "/" + Configuration.TIMELINE;

            var queryParams = new MultiMap <string>().Create(inputOptions.QueryParams);

            queryParams.Add(Configuration.QUERY_AUDIT, auditLevel.ToString());
            var requestOptions = inputOptions.Extend().WithQueryParams(queryParams).Build();

            return(await _client.Get <AccountTimeline>(uri, requestOptions));
        }
        public async Task <Accounts> GetAccounts(long offset, long limit, RequestOptions inputOptions, AuditLevel auditLevel = AuditLevel.NONE)
        {
            var uri = Configuration.ACCOUNTS_PATH + "/" + Configuration.PAGINATION;

            var queryParams = new MultiMap <string>().Create(inputOptions.QueryParams);

            queryParams.Add(Configuration.QUERY_SEARCH_OFFSET, offset.ToString());
            queryParams.Add(Configuration.QUERY_SEARCH_LIMIT, limit.ToString());
            queryParams.Add(Configuration.QUERY_AUDIT, auditLevel.ToString());

            var requestOptions = inputOptions.Extend().WithQueryParams(queryParams).Build();

            return(await _client.Get <Accounts>(uri, requestOptions));
        }
示例#40
0
 /// <summary>
 /// Audits a given incident.
 /// </summary>
 /// <param name="level">Indicates the severity of an audited incident.</param>
 /// <param name="context">Defines the context of the audited operation on the file system.</param>
 /// <param name="eventId">An identifier that indicates the incident.</param>
 /// <param name="message">An optional message that provides background information.</param>
 public void Audit(AuditLevel level, FileSystemTask context, AuditEvent eventId, string message)
 {
   Audit(new AuditItem(level, context, eventId, message));
 }
示例#41
0
 /// <summary>
 /// Whether auditing is being performed for incidents of
 /// a given <see cref="AuditLevel"/> and context.
 /// </summary>
 /// <param name="level">The severity of the audited incident.</param>
 /// <param name="context">The currently performed file system operation
 /// that delivers the context of the audited incident.</param>
 /// <returns>True if messages for the level and area are being actively
 /// audited. If this method returns false, <see cref="IAuditor.Audit"/> is
 /// not supposed to be invoked with an <see cref="AuditItem"/>
 /// that matches this level and area.</returns>
 public bool IsAuditEnabled(AuditLevel level, FileSystemTask context)
 {
   return true;
 }
 private void WriteAuditEvent(StreamSecurityUpgradeAcceptor securityUpgradeAcceptor, AuditLevel auditLevel, Exception exception)
 {
 }
示例#43
0
 /// <summary>
 /// Audits a given incident.
 /// </summary>
 /// <param name="level">Indicates the severity of an audited incident.</param>
 /// <param name="context">Defines the context of the audited operation on the file system.</param>
 /// <param name="eventId">An identifier that indicates the incident.</param>
 /// <param name="message">An optional message that provides background information.</param>
 public void Audit(AuditLevel level, FileSystemTask context, AuditEvent eventId, string message)
 {
     Audit(new AuditItem(level, context, eventId, message));
 }
示例#44
0
 /// <summary>
 /// Whether auditing is being performed for incidents of
 /// a given <see cref="AuditLevel"/> and context.
 /// </summary>
 /// <param name="level">The severity of the audited incident.</param>
 /// <param name="context">The currently performed file system operation
 /// that delivers the context of the audited incident.</param>
 /// <returns>True if messages for the level and area are being actively
 /// audited. If this method returns false, <see cref="IAuditor.Audit"/> is
 /// not supposed to be invoked with an <see cref="AuditItem"/>
 /// that matches this level and area.</returns>
 public bool IsAuditEnabled(AuditLevel level, FileSystemTask context)
 {
     return(true);
 }