@Override public Service create(Session session) throws IOException { return new AsyncUserAuthService(session); } }
@Override public ServerSession getSession() { return getServerSession(); }
private boolean asyncAuth(int cmd, Buffer buffer, Exception e) { if (e instanceof AsyncAuth) { async = (AsyncAuth) e; async.setListener(authenticated -> { async = null; try { if (authenticated) { handleAuthenticationSuccess(cmd, buffer); } else { handleAuthenticationFailure(cmd, buffer); } } catch (Exception e1) { // HANDLE THIS BETTER e1.printStackTrace(); } }); return true; } else { return false; } }
@Override public void process(int cmd, Buffer buffer) throws Exception { Boolean authed = Boolean.FALSE; ServerSession session = getServerSession(); } catch (Exception e) { if (asyncAuth(cmd, buffer, e)) { return; authed = currentAuth.next(buffer); } catch (Exception e) { if (asyncAuth(cmd, buffer, e)) { return; handleAuthenticationInProgress(cmd, buffer); } else if (authed.booleanValue()) { handleAuthenticationSuccess(cmd, buffer); } else { handleAuthenticationFailure(cmd, buffer);
@Override public void process(int cmd, Buffer buffer) throws Exception { Boolean authed = Boolean.FALSE; ServerSession session = getServerSession(); } catch (Exception e) { if (asyncAuth(cmd, buffer, e)) { return; authed = currentAuth.next(buffer); } catch (Exception e) { if (asyncAuth(cmd, buffer, e)) { return; handleAuthenticationInProgress(cmd, buffer); } else if (authed.booleanValue()) { handleAuthenticationSuccess(cmd, buffer); } else { handleAuthenticationFailure(cmd, buffer);
@Override public ServerSession getSession() { return getServerSession(); }
private boolean asyncAuth(int cmd, Buffer buffer, Exception e) { if (e instanceof AsyncAuth) { async = (AsyncAuth) e; async.setListener(authenticated -> { async = null; try { if (authenticated) { handleAuthenticationSuccess(cmd, buffer); } else { handleAuthenticationFailure(cmd, buffer); } } catch (Exception e1) { // HANDLE THIS BETTER e1.printStackTrace(); } }); return true; } else { return false; } }
@Override public Service create(Session session) throws IOException { return new AsyncUserAuthService(session); } }
protected void handleAuthenticationInProgress(int cmd, Buffer buffer) throws Exception { String username = (currentAuth == null) ? null : currentAuth.getUsername(); if (log.isDebugEnabled()) { log.debug("handleAuthenticationInProgress({}@{}) {}", username, getServerSession(), SshConstants.getCommandMessageName(cmd)); } }
protected void handleAuthenticationInProgress(int cmd, Buffer buffer) throws Exception { String username = (currentAuth == null) ? null : currentAuth.getUsername(); if (log.isDebugEnabled()) { log.debug("handleAuthenticationInProgress({}@{}) {}", username, getServerSession(), SshConstants.getCommandMessageName(cmd)); } }
protected void handleAuthenticationFailure(int cmd, Buffer buffer) throws Exception { String username = (currentAuth == null) ? null : currentAuth.getUsername(); ServerSession session = getServerSession(); if (log.isDebugEnabled()) { log.debug("handleAuthenticationFailure({}@{}) {}",
protected void handleAuthenticationFailure(int cmd, Buffer buffer) throws Exception { String username = (currentAuth == null) ? null : currentAuth.getUsername(); ServerSession session = getServerSession(); if (log.isDebugEnabled()) { log.debug("handleAuthenticationFailure({}@{}) {}",
protected void handleAuthenticationSuccess(int cmd, Buffer buffer) throws Exception { String username = ValidateUtils.checkNotNull(currentAuth, "No current auth").getUsername(); ServerSession session = getServerSession(); if (log.isDebugEnabled()) { log.debug("handleAuthenticationSuccess({}@{}) {}",
protected void handleAuthenticationSuccess(int cmd, Buffer buffer) throws Exception { String username = ValidateUtils.checkNotNull(currentAuth, "No current auth").getUsername(); ServerSession session = getServerSession(); if (log.isDebugEnabled()) { log.debug("handleAuthenticationSuccess({}@{}) {}",