@Override public void passwordInvalid(@NotNull ServerErrorEvent.ServerConfigErrorEvent<AuthenticationFailedException> e) { getAppStateFor(e.getConfig()).ifPresent(s -> s.badLogin = true); }
@Override public void passwordUnnecessary(@NotNull ServerErrorEvent.ServerConfigErrorEvent<AuthenticationFailedException> e) { getAppStateFor(e.getConfig()).ifPresent(s -> { s.badLogin = false; s.passwordUnnecessary = true; }); } });
@Override public void sessionExpired(@NotNull ServerErrorEvent.ServerConfigErrorEvent<AuthenticationFailedException> e) { getAppStateFor(e.getConfig()).ifPresent(s -> { s.badLogin = false; s.needsLogin = true; }); }
@Override public void passwordInvalid(@NotNull ServerErrorEvent.ServerConfigErrorEvent<AuthenticationFailedException> e) { if (shouldHandleProblem(e.getConfig(), FailureType.PASSWORD_INVALID)) { if (!e.getConfig().usesStoredPassword()) { LOG.info("Show a user notification, and use hyperlink to ask for password for " + e.getConfig()); UserMessage.showNotification(null, UserMessage.ERROR, P4Bundle.message("login.password.error", e.getName().getDisplayName()), NotificationType.ERROR, (notification, hyperlinkEvent) -> { forgetLoginProblem(e.getConfig()); ApplicationPasswordRegistry.getInstance() .askForNewPassword(null, e.getConfig()); }, () -> { forgetLoginProblem(e.getConfig()); LOG.info("Not handling password invalid for " + e.getConfig());
@Override public void passwordUnnecessary(@NotNull ServerErrorEvent.ServerConfigErrorEvent<AuthenticationFailedException> e) { // Inform the user about the unnecessary password. if (shouldHandleProblem(e.getConfig(), FailureType.PASSWORD_UNNECESSARY)) { UserMessage.showNotification(null, UserMessage.WARNING, P4Bundle.message("connection.password.unnecessary.details", e.getName().getDisplayName()), P4Bundle.message("connection.password.unnecessary.title"), NotificationType.INFORMATION); // Update the password to remove the stored password. ApplicationPasswordRegistry.getInstance().remove(e.getConfig()); } else { LOG.info("Not handling password uncessary issue for " + e.getConfig()); } } });
@Override public void singleSignOnFailed(@NotNull ServerErrorEvent.ServerConfigErrorEvent<AuthenticationFailedException> e) { LOG.info("Processing single sign on failure: " + e.getError().getMessage()); if (shouldHandleProblem(e.getConfig(), FailureType.SSO)) { // No explicit action to take UserMessage.showNotification(null, UserMessage.ERROR, P4Bundle.message("error.loginsso.exec-failed", e.getConfig().getLoginSso(), e.getError().getLocalizedMessage()), P4Bundle.message("error.loginsso.exec-failed.title"), NotificationType.ERROR); // TODO once the Single Sign On can take an argument, let this prompt for the argument. } else { LOG.info("Not handling SSO problem for " + e.getConfig()); } }
@Override public void singleSignOnFailed(@NotNull ServerErrorEvent.ServerConfigErrorEvent<AuthenticationFailedException> e) { getAppStateFor(e.getConfig()).ifPresent(s -> s.badLogin = true); }
@Override public void onLoginFailure(@NotNull ServerErrorEvent.ServerConfigErrorEvent<AuthenticationFailedException> e) { ProjectConfigRegistry.this.onLoginError(e.getConfig()); } });
@Override public void couldNotWrite(@NotNull ServerErrorEvent.ServerConfigErrorEvent<FileSaveException> event) { simpleError( P4Bundle.message("user-error.could-not-write.message", event.getConfig().getServerName(), event.getError().getLocalizedMessage()), P4Bundle.message("user-error.could-not-write.title")); LOG.warn(event.getError()); }
@Override public void sessionExpired(@NotNull ServerErrorEvent.ServerConfigErrorEvent<AuthenticationFailedException> e) { // Force a log-in. If this fails, another message will be handled. if (shouldHandleProblem(e.getConfig(), FailureType.SESSION_EXPIRED)) { LOG.info("Session expired. Performing another login."); P4ServerComponent.perform(findBestProject(), e.getConfig(), new LoginAction()); } else { LOG.info("Not handling session expired error for " + e.getConfig()); } }