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);
if (!pool.getMultiuserAuthentication()) { Connection connImpl = this.connectionManager.getConnection(conn); conn.getServer().setUserId( (Long)AuthenticateUserOp.executeOn(connImpl, this)); return conn.execute(op);
conn.getServer().setUserId( (Long)AuthenticateUserOp.executeOn(connImpl, this.pool)); if (logger.isDebugEnabled()) {
private Object executeWithPossibleReAuthentication(Connection conn, Op op) throws Exception { try { return conn.execute(op); } catch (ServerConnectivityException sce) { Throwable cause = sce.getCause(); // if it is GFEConnector case, assume that for the first time failure the cause is auth attribute // failure & rexecute if ((cause instanceof AuthenticationRequiredException && "User authorization attributes not found.".equals(cause .getMessage())) || GemFireCacheImpl.getExisting().isSnappyConnectorCache()) { 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; } } }
endpoint.getLocation().setUserId(-1);
conn.getServer().setUserId( (Long)AuthenticateUserOp.executeOn(connImpl, this.pool)); if (this.logger.fineEnabled()) {
private void authenticateIfRequired(Connection conn) { PoolImpl pool = (PoolImpl)PoolManagerImpl.getPMI().find( this.endpointManager.getPoolName()); if (pool == null) { throw new PoolCancelledException( LocalizedStrings.ConnectionFactoryImpl_POOL_0_IS_NOT_AVAILABLE .toString(new Object[] { this.endpointManager.getPoolName() })); } if (!pool.isUsedByGateway() && !pool.getMultiuserAuthentication()) { if (conn.getServer().getRequiresCredentials()) { if (conn.getServer().getUserId() == -1) { Long uniqueID = (Long)AuthenticateUserOp.executeOn(conn, pool); conn.getServer().setUserId(uniqueID); if (logger.fineEnabled()) { logger.fine("CFI.authenticateIfRequired() Completed authentication on " + conn); } } } } }