Example #1
0
        /// <summary>
        /// Handles the End event of the Application control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void Application_End(object sender, EventArgs e)
        {
            try
            {
                if (RealmConfig.IsJoinedToRealm())
                {
                    //var deviceIdentity = ApplicationSignInManager.LoginAsDevice();

                    //var auditHelper = new GlobalAuditHelper(new AmiCredentials(this.User, deviceIdentity.AccessToken), this.Context);

                    //auditHelper.AuditApplicationStop(OutcomeIndicator.Success);
                }
            }
            catch (Exception exception)
            {
                Trace.TraceError("****************************************************");
                Trace.TraceError($"Unable to send application stop audit: {exception}");
                Trace.TraceError("****************************************************");
            }

            Trace.TraceInformation("Application stopped");
        }
Example #2
0
        /// <summary>
        /// Handles the EndRequest event of the Application control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void Application_EndRequest(object sender, EventArgs e)
        {
            try
            {
                if (!RealmConfig.IsJoinedToRealm())
                {
                    return;
                }

                // if the response status code is not a client level error code, we don't want to attempt to audit the access
                if (this.Response.StatusCode != 401 && this.Response.StatusCode != 403 && this.Response.StatusCode != 404)
                {
                    return;
                }

                var deviceIdentity = ApplicationSignInManager.LoginAsDevice();

                //var auditHelper = new GlobalAuditHelper(new AmiCredentials(this.User, deviceIdentity.AccessToken), this.Context);

                //switch (this.Response.StatusCode)
                //{
                //	case 401:
                //		if (this.Request.Headers["Authorization"] != null)
                //			auditHelper.AuditUnauthorizedAccess();
                //		break;
                //	case 403:
                //		auditHelper.AuditForbiddenAccess();
                //		break;
                //	case 404:
                //		auditHelper.AuditResourceNotFoundAccess();
                //		break;
                //}
            }
            catch (Exception exception)
            {
                Trace.TraceError($"Unable to audit application end request: {exception}");
            }
        }
Example #3
0
        /// <summary>
        /// Called when the application starts.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void Application_Start(object sender, EventArgs e)
        {
            OpenIZAdminEngineContext.Initialize();

            AreaRegistration.RegisterAllAreas();

            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            // realm initialization
            RealmConfig.Initialize();

            if (!Directory.Exists(this.Server.MapPath("~/Manuals")))
            {
                Directory.CreateDirectory(this.Server.MapPath("~/Manuals"));
            }

            if (RealmConfig.IsJoinedToRealm())
            {
                try
                {
                    //var deviceIdentity = ApplicationSignInManager.LoginAsDevice();

                    //var auditHelper = new GlobalAuditHelper(new AmiCredentials(this.User, deviceIdentity.AccessToken), this.Context);

                    //auditHelper.AuditApplicationStart(OutcomeIndicator.Success);
                }
                catch (Exception exception)
                {
                    Trace.TraceError("****************************************************");
                    Trace.TraceError($"Unable to send application start audit: {exception}");
                    Trace.TraceError("****************************************************");
                }
            }

            Trace.TraceInformation("Application started");
        }