public static boolean interactiveValidation( final Project project, final SVNURL url, final String realm, final String kind) { final SvnConfiguration17 configuration = SvnConfiguration17.getInstance(project); final SvnAuthenticationManager passiveManager = configuration.getInteractiveManager(SvnVcs17.getInstance(project)); return validationImpl(project, url, configuration, passiveManager, true, realm, kind, true); }
private static boolean validationImpl( final Project project, final SVNURL url, final SvnConfiguration17 configuration, final SvnAuthenticationManager manager, final boolean checkWrite, final String realm, final String kind, boolean interactive) { SvnInteractiveAuthenticationProvider.clearCallState(); try { new SVNWCClient(manager, configuration.getOptions(project)) .doInfo(url, SVNRevision.UNDEFINED, SVNRevision.HEAD); } catch (SVNAuthenticationException e) { log(e); return false; } catch (SVNCancelException e) { log(e); // auth canceled return false; } catch (SVNException e) { if (e.getErrorMessage().getErrorCode().isAuthentication()) { log(e); return false; } LOG.info("some other exc", e); if (interactive) { VcsBalloonProblemNotifier.showOverChangesView( project, "Authentication failed: " + e.getMessage(), MessageType.ERROR); } return false; /// !!!! any exception means user should be notified that authorization failed } if (!checkWrite) { return true; } /*if (passive) { return SvnInteractiveAuthenticationProvider.wasCalled(); }*/ if (SvnInteractiveAuthenticationProvider.wasCalled() && SvnInteractiveAuthenticationProvider.wasCancelled()) return false; if (SvnInteractiveAuthenticationProvider.wasCalled()) return true; final SvnVcs17 svnVcs = SvnVcs17.getInstance(project); final SvnInteractiveAuthenticationProvider provider = new SvnInteractiveAuthenticationProvider(svnVcs, manager); final SVNAuthentication svnAuthentication = provider.requestClientAuthentication(kind, url, realm, null, null, true); if (svnAuthentication != null) { configuration.acknowledge(kind, realm, svnAuthentication); try { configuration .getAuthenticationManager(svnVcs) .acknowledgeAuthentication(true, kind, realm, null, svnAuthentication); } catch (SVNException e) { LOG.info(e); } return true; } return false; }