public static void setIpAddress(final TProtocol in) { try { TTransport transport = in.getTransport(); TSocket tSocket = getUnderlyingSocketFromTransport(transport); if (tSocket != null) { setIpAddress(tSocket.getSocket().getInetAddress().toString()); } else { LOGGER.warn("Unknown Transport, cannot determine ipAddress"); } } catch (Exception e) { // If there has exception when get impersonator info, log the error information. LOGGER.warn("There is an error when get the client's ip address:" + e.getMessage()); } }
@Override public boolean process(TProtocol in, TProtocol out) throws TException { // set the ip and impersonator for audit log ThriftUtil.setIpAddress(in); ThriftUtil.setImpersonator(in); return super.process(in, out); } }
@Override public boolean process(TProtocol in, TProtocol out) throws TException { ThriftUtil.setIpAddress(in); ThriftUtil.setImpersonator(in); return super.process(in, out); } }
@Override public boolean process(TProtocol in, TProtocol out) throws TException { ThriftUtil.setIpAddress(in); ThriftUtil.setImpersonator(in); return super.process(in, out); } }
@BeforeClass public static void init() { conf = new Configuration(); conf.set(ServerConfig.SENTRY_SERVICE_NAME, ServerConfig.SENTRY_SERVICE_NAME_DEFAULT); ThriftUtil.setIpAddress(TEST_IP); ThriftUtil.setImpersonator(TEST_IMPERSONATOR); TEST_PRIVILEGES_MAP.put("resourceType1", "resourceName1"); TEST_PRIVILEGES_MAP.put("resourceType2", "resourceName2"); TEST_PRIVILEGES_MAP.put("resourceType3", "resourceName3"); }
@BeforeClass public static void init() { conf = new Configuration(); conf.set(ServerConfig.SENTRY_SERVICE_NAME, ServerConfig.SENTRY_SERVICE_NAME_DEFAULT); ThriftUtil.setIpAddress(TEST_IP); ThriftUtil.setImpersonator(TEST_IMPERSONATOR); }