private void authenticateIfRequired(Connection conn) { cancelCriterion.checkCancelInProgress(null); if (!pool.isUsedByGateway() && !pool.getMultiuserAuthentication()) { ServerLocation server = conn.getServer(); if (server.getRequiresCredentials()) { if (server.getUserId() == -1) { Long uniqueID = (Long) AuthenticateUserOp.executeOn(conn, pool); server.setUserId(uniqueID); if (logger.isDebugEnabled()) { logger.debug("CFI.authenticateIfRequired() Completed authentication on {}", conn); } } } } }
endpoint.getLocation().setUserId(-1);
private Object executeWithPossibleReAuthentication(Connection conn, Op op) throws Exception { try { return conn.execute(op); } catch (ServerConnectivityException sce) { Throwable cause = sce.getCause(); if ((cause instanceof AuthenticationRequiredException && "User authorization attributes not found.".equals(cause.getMessage())) || sce.getMessage().contains("Connection error while authenticating user")) { // (ashetkar) Need a cleaner way of doing above check. // 2nd exception-message above is from AbstractOp.sendMessage() PoolImpl pool = (PoolImpl) PoolManagerImpl.getPMI().find(this.endpointManager.getPoolName()); if (!pool.getMultiuserAuthentication()) { Connection connImpl = this.connectionManager.getConnection(conn); conn.getServer().setUserId((Long) AuthenticateUserOp.executeOn(connImpl, this)); return conn.execute(op); } else { UserAttributes ua = UserAttributes.userAttributes.get(); if (ua != null) { authenticateMultiuser(pool, conn, ua); } return conn.execute(op); } } else { throw sce; } } }
conn.getServer().setUserId((Long) AuthenticateUserOp.executeOn(connImpl, this.pool)); if (logger.isDebugEnabled()) { logger.debug(