Esempio n. 1
0
        public static void SignOut(SessionInfo session)
        {
            FormsAuthentication.SignOut();

            if (session != null)
            {
                try
                {
                    ForceOtherPagesToLogout(session);

                    using (LoginService service = new LoginService())
                    {
                        service.Logout(session.Credentials.SessionToken.Id);
                    }
                }
                catch (NotSupportedException)
                {
                    //ignore this.
                }
                catch (Exception e)
                {
                    Platform.Log(LogLevel.Warn, e, "Failed to log user out.");
                }

                UserAuthenticationAuditHelper audit = new UserAuthenticationAuditHelper(
                    ServerPlatform.AuditSource,
                    EventIdentificationContentsEventOutcomeIndicator.Success,
                    UserAuthenticationEventType.Logout);
                audit.AddUserParticipant(new AuditPersonActiveParticipant(
                                             session.Credentials.UserName,
                                             null,
                                             session.Credentials.DisplayName));
                ServerPlatform.LogAuditMessage(audit);
            }
        }
Esempio n. 2
0
        protected void LoginClicked(object sender, EventArgs e)
        {
            if (SessionManager.Current != null)
            {
                // already logged in. Maybe from different page
                HttpContext.Current.Response.Redirect(FormsAuthentication.GetRedirectUrl(SessionManager.Current.Credentials.UserName, false), true);
            }

            try
            {
                SessionManager.InitializeSession(UserName.Text, Password.Text);

                UserAuthenticationAuditHelper audit = new UserAuthenticationAuditHelper(ServerPlatform.AuditSource,
                                                                                        EventIdentificationContentsEventOutcomeIndicator.Success, UserAuthenticationEventType.Login);
                audit.AddUserParticipant(new AuditPersonActiveParticipant(UserName.Text, null, SessionManager.Current.Credentials.DisplayName));
                ServerPlatform.LogAuditMessage(audit);
            }
            catch (PasswordExpiredException)
            {
                Platform.Log(LogLevel.Info, "Password for {0} has expired. Requesting new password.", UserName.Text);
                PasswordExpiredDialog.Show(UserName.Text, Password.Text);

                UserAuthenticationAuditHelper audit = new UserAuthenticationAuditHelper(ServerPlatform.AuditSource,
                                                                                        EventIdentificationContentsEventOutcomeIndicator.Success, UserAuthenticationEventType.Login);
                audit.AddUserParticipant(new AuditPersonActiveParticipant(UserName.Text, null, null));
                ServerPlatform.LogAuditMessage(audit);
            }
            catch (UserAccessDeniedException ex)
            {
                Platform.Log(LogLevel.Error, ex, ex.Message);
                ShowError(ErrorMessages.UserAccessDenied);
                UserName.Focus();

                UserAuthenticationAuditHelper audit = new UserAuthenticationAuditHelper(ServerPlatform.AuditSource,
                                                                                        EventIdentificationContentsEventOutcomeIndicator.SeriousFailureActionTerminated, UserAuthenticationEventType.Login);
                audit.AddUserParticipant(new AuditPersonActiveParticipant(UserName.Text, null, null));
                ServerPlatform.LogAuditMessage(audit);
            }
            catch (CommunicationException ex)
            {
                Platform.Log(LogLevel.Error, ex, "Unable to contact A/A server");
                ShowError(ErrorMessages.CannotContactEnterpriseServer);

                UserAuthenticationAuditHelper audit = new UserAuthenticationAuditHelper(ServerPlatform.AuditSource,
                                                                                        EventIdentificationContentsEventOutcomeIndicator.MajorFailureActionMadeUnavailable, UserAuthenticationEventType.Login);
                audit.AddUserParticipant(new AuditPersonActiveParticipant(UserName.Text, null, null));
                ServerPlatform.LogAuditMessage(audit);
            }
            catch (Exception ex)
            {
                Platform.Log(LogLevel.Error, ex, "Login error:");
                ShowError(ex.Message);

                UserAuthenticationAuditHelper audit = new UserAuthenticationAuditHelper(ServerPlatform.AuditSource,
                                                                                        EventIdentificationContentsEventOutcomeIndicator.MajorFailureActionMadeUnavailable, UserAuthenticationEventType.Login);
                audit.AddUserParticipant(new AuditPersonActiveParticipant(UserName.Text, null, null));
                ServerPlatform.LogAuditMessage(audit);
            }
        }
Esempio n. 3
0
        public static void AuditLogout(string userName, string displayName, string sessionId)
        {
            var audit = new UserAuthenticationAuditHelper(_auditSource,
                                                          EventIdentificationContentsEventOutcomeIndicator.Success, UserAuthenticationEventType.Logout);

            audit.AddUserParticipant(new AuditPersonActiveParticipant(userName, null, displayName));
            LogAuditMessage(audit, userName, sessionId);
        }
Esempio n. 4
0
        public static void AuditFailure(string userId)
        {
            var audit = new UserAuthenticationAuditHelper(_auditSource,
                                                          EventIdentificationContentsEventOutcomeIndicator.SeriousFailureActionTerminated, UserAuthenticationEventType.Login);

            audit.AddUserParticipant(new AuditPersonActiveParticipant(userId, null, null));
            LogAuditMessage(audit, userId);
        }
Esempio n. 5
0
        public void UserAuthenticationAuditTest()
        {
            UserAuthenticationAuditHelper helper =
                new UserAuthenticationAuditHelper(
                    new DicomAuditSource("testApp", "Site", AuditSourceTypeCodeEnum.ApplicationServerProcessTierInMultiTierSystem),
                    EventIdentificationTypeEventOutcomeIndicator.Success, UserAuthenticationEventType.Login);

            helper.AddNode(new AuditProcessActiveParticipant("serverAe"));
            helper.AddUserParticipant(new AuditPersonActiveParticipant("testUser", "test@test", "Test Name"));

            string output = helper.Serialize(true);

            Assert.IsNotEmpty(output);

            string failure;
            bool   result = helper.Verify(out failure);

            Assert.IsTrue(result, failure);
        }
Esempio n. 6
0
        public void UserAuthenticationAuditTest()
        {
            UserAuthenticationAuditHelper helper =
                new UserAuthenticationAuditHelper(
                    new DicomAuditSource("testApp", "Site", AuditSourceTypeCodeEnum.ApplicationServerProcessTierInMultiTierSystem),
                    EventIdentificationContentsEventOutcomeIndicator.Success, UserAuthenticationEventType.Login);

            helper.AddNode(new AuditProcessActiveParticipant("serverAe"));
            helper.AddUserParticipant(new AuditPersonActiveParticipant("testUser", "test@test", "Test Name"));

            string output = helper.Serialize(true);

            Assert.IsNotEmpty(output);

            Assert.Ignore("Skipping schema validation due to schema bug #9455");
            Exception exception;

            if (!helper.Verify(out exception))
            {
                throw exception;
            }
        }
Esempio n. 7
0
		public void UserAuthenticationAuditTest()
		{
			UserAuthenticationAuditHelper helper =
				new UserAuthenticationAuditHelper(
					new DicomAuditSource("testApp", "Site", AuditSourceTypeCodeEnum.ApplicationServerProcessTierInMultiTierSystem),
					EventIdentificationTypeEventOutcomeIndicator.Success,UserAuthenticationEventType.Login);
			helper.AddNode(new AuditProcessActiveParticipant("serverAe"));
			helper.AddUserParticipant(new AuditPersonActiveParticipant("testUser", "test@test", "Test Name"));

			string output = helper.Serialize(true);

			Assert.IsNotEmpty(output);

			string failure;
			bool result = helper.Verify(out failure);

			Assert.IsTrue(result, failure);
		}
Esempio n. 8
0
		public void UserAuthenticationAuditTest()
		{
			UserAuthenticationAuditHelper helper =
				new UserAuthenticationAuditHelper(
					new DicomAuditSource("testApp", "Site", AuditSourceTypeCodeEnum.ApplicationServerProcessTierInMultiTierSystem),
					EventIdentificationContentsEventOutcomeIndicator.Success,UserAuthenticationEventType.Login);
			helper.AddNode(new AuditProcessActiveParticipant("serverAe"));
			helper.AddUserParticipant(new AuditPersonActiveParticipant("testUser", "test@test", "Test Name"));

			string output = helper.Serialize(true);

			Assert.IsNotEmpty(output);

			Assert.Ignore("Skipping schema validation due to schema bug #9455");
			Exception exception;
			if (!helper.Verify(out exception))
				throw exception;
		}