public void writeCredentials(DataOutputStream dos, DataInputStream dis, Properties p_credentials, boolean isNotification, DistributedMember member) throws IOException, GemFireSecurityException { HeapDataOutputStream hdos = new HeapDataOutputStream(32, Version.CURRENT_GFE); try { writeCredentials(dos, dis, p_credentials, isNotification, member, hdos); } finally { hdos.close(); } }
public void writeCredentials(DataOutputStream dos, DataInputStream dis, Properties p_credentials, boolean isNotification, DistributedMember member) throws IOException, GemFireSecurityException { HeapDataOutputStream hdos = new HeapDataOutputStream(32, Version.CURRENT); try { writeCredentials(dos, dis, p_credentials, isNotification, member, hdos); } finally { hdos.close(); } }
public String getJSON() { JsonFactory jf = new JsonFactory(); // OutputStream os = new ByteArrayOutputStream(); HeapDataOutputStream hdos = new HeapDataOutputStream(com.gemstone.gemfire.internal.Version.CURRENT); try { JsonGenerator jg = jf.createJsonGenerator(hdos, JsonEncoding.UTF8); enableDisableJSONGeneratorFeature(jg); getJSONString(jg, m_pdxInstance); jg.close(); return new String(hdos.toByteArray()); } catch (IOException e) { // TODO Auto-generated catch block throw new RuntimeException(e.getMessage()); }finally{ hdos.close(); } }
public byte[] getJSONByteArray() { JsonFactory jf = new JsonFactory(); HeapDataOutputStream hdos = new HeapDataOutputStream(com.gemstone.gemfire.internal.Version.CURRENT); try { JsonGenerator jg = jf.createJsonGenerator(hdos, JsonEncoding.UTF8); enableDisableJSONGeneratorFeature(jg); getJSONString(jg, m_pdxInstance); jg.close(); return hdos.toByteArray(); } catch (IOException e) { // TODO Auto-generated catch block throw new RuntimeException(e.getMessage()); }finally { hdos.close(); } }
private byte[] encryptId(long id, ServerConnection servConn) throws Exception { // deserialize this using handshake keys HeapDataOutputStream hdos = null; try { hdos = new HeapDataOutputStream(Version.CURRENT_GFE); hdos.writeLong(id); return ((HandShake)this.handshake).encryptBytes(hdos.toByteArray()); } finally { hdos.close(); } }
private byte[] encryptId(long id, ServerConnection servConn) throws Exception { // deserialize this using handshake keys HeapDataOutputStream hdos = null; try { hdos = new HeapDataOutputStream(Version.CURRENT); hdos.writeLong(id); return ((HandShake)this.handshake).encryptBytes(hdos.toByteArray()); } finally { hdos.close(); } }
} finally { if (hdos != null) { hdos.close();
public String getJSON() { JsonFactory jf = new JsonFactory(); // OutputStream os = new ByteArrayOutputStream(); HeapDataOutputStream hdos = new HeapDataOutputStream(com.gemstone.gemfire.internal.shared.Version.CURRENT); try { JsonGenerator jg = jf.createJsonGenerator(hdos, JsonEncoding.UTF8); enableDisableJSONGeneratorFeature(jg); getJSONString(jg, m_pdxInstance); jg.close(); return new String(hdos.toByteArray()); } catch (IOException e) { // TODO Auto-generated catch block throw new RuntimeException(e.getMessage()); }finally{ hdos.close(); } }
protected static void writeServerMember(DistributedMember member, DataOutputStream dos) throws IOException { Version v = Version.CURRENT_GFE; if (dos instanceof VersionedDataStream) { v = ((VersionedDataStream) dos).getVersion(); } HeapDataOutputStream hdos = new HeapDataOutputStream(v); DataSerializer.writeObject(member, hdos); DataSerializer.writeByteArray(hdos.toByteArray(), dos); hdos.close(); }
protected static void writeServerMember(DistributedMember member, DataOutputStream dos) throws IOException { Version v = Version.CURRENT; if (dos instanceof VersionedDataStream) { v = ((VersionedDataStream) dos).getVersion(); } HeapDataOutputStream hdos = new HeapDataOutputStream(v); DataSerializer.writeObject(member, hdos); DataSerializer.writeByteArray(hdos.toByteArray(), dos); hdos.close(); }
public byte[] getJSONByteArray() { JsonFactory jf = new JsonFactory(); HeapDataOutputStream hdos = new HeapDataOutputStream(com.gemstone.gemfire.internal.shared.Version.CURRENT); try { JsonGenerator jg = jf.createJsonGenerator(hdos, JsonEncoding.UTF8); enableDisableJSONGeneratorFeature(jg); getJSONString(jg, m_pdxInstance); jg.close(); return hdos.toByteArray(); } catch (IOException e) { // TODO Auto-generated catch block throw new RuntimeException(e.getMessage()); }finally { hdos.close(); } }
@Override protected void sendMessage(Connection cnx) throws Exception { HeapDataOutputStream hdos = new HeapDataOutputStream(Version.CURRENT_GFE); byte[] secureBytes = null; hdos.writeLong(cnx.getConnectionID()); Object userId = UserAttributes.userAttributes.get().getServerToId().get(cnx.getServer()); if (userId == null) { // This will ensure that this op is retried on another server, unless // the retryCount is exhausted. Fix for Bug 41501 throw new ServerConnectivityException( "Connection error while authenticating user"); } hdos.writeLong((Long)userId); try { secureBytes = ((ConnectionImpl)cnx).getHandShake().encryptBytes( hdos.toByteArray()); } finally { hdos.close(); } getMessage().setSecurePart(secureBytes); getMessage().send(false); }
@Override protected void sendMessage(Connection cnx) throws Exception { HeapDataOutputStream hdos = new HeapDataOutputStream(Version.CURRENT); byte[] secureBytes = null; hdos.writeLong(cnx.getConnectionID()); Object userId = UserAttributes.userAttributes.get().getServerToId().get(cnx.getServer()); if (userId == null) { // This will ensure that this op is retried on another server, unless // the retryCount is exhausted. Fix for Bug 41501 throw new ServerConnectivityException( "Connection error while authenticating user"); } hdos.writeLong((Long)userId); try { secureBytes = ((ConnectionImpl)cnx).getHandShake().encryptBytes( hdos.toByteArray()); } finally { hdos.close(); } getMessage().setSecurePart(secureBytes); getMessage().send(false); }
public AuthenticateUserOpImpl(Connection con, ExecutablePool pool) { super(pool.getLoggerI18n(), MessageType.USER_CREDENTIAL_MESSAGE, 1); byte[] credentialBytes = null; DistributedMember server = new InternalDistributedMember(con.getSocket() .getInetAddress(), con.getSocket().getPort(), false); DistributedSystem sys = InternalDistributedSystem.getConnectedInstance(); String authInitMethod = sys.getProperties().getProperty( DistributionConfig.SECURITY_CLIENT_AUTH_INIT_NAME); Properties tmpSecurityProperties = sys.getSecurityProperties(); Properties credentials = HandShake.getCredentials(authInitMethod, tmpSecurityProperties, server, false, sys.getLogWriter(), sys .getSecurityLogWriter()); getMessage().setEarlyAck(Message.MESSAGE_HAS_SECURE_PART); HeapDataOutputStream heapdos = new HeapDataOutputStream(Version.CURRENT_GFE); try { DataSerializer.writeProperties(credentials, heapdos); credentialBytes = ((ConnectionImpl)con).getHandShake() .encryptBytes(heapdos.toByteArray()); } catch (Exception e) { throw new ServerOperationException(e); } finally { heapdos.close(); } getMessage().addBytesPart(credentialBytes); }
public AuthenticateUserOpImpl(Connection con, ExecutablePool pool) { super(MessageType.USER_CREDENTIAL_MESSAGE, 1); byte[] credentialBytes = null; // TODO this is not a valid way to create a member ID DistributedMember server = new InternalDistributedMember(con.getSocket() .getInetAddress(), con.getSocket().getPort(), false); DistributedSystem sys = InternalDistributedSystem.getConnectedInstance(); String authInitMethod = sys.getProperties().getProperty( DistributionConfig.SECURITY_CLIENT_AUTH_INIT_NAME); Properties tmpSecurityProperties = sys.getSecurityProperties(); // LOG: following passes the DS API LogWriters into the security API Properties credentials = HandShake.getCredentials(authInitMethod, tmpSecurityProperties, server, false, (InternalLogWriter)sys.getLogWriter(), (InternalLogWriter)sys .getSecurityLogWriter()); getMessage().setEarlyAck(Message.MESSAGE_HAS_SECURE_PART); HeapDataOutputStream heapdos = new HeapDataOutputStream(Version.CURRENT); try { DataSerializer.writeProperties(credentials, heapdos); credentialBytes = ((ConnectionImpl)con).getHandShake() .encryptBytes(heapdos.toByteArray()); } catch (Exception e) { throw new ServerOperationException(e); } finally { heapdos.close(); } getMessage().addBytesPart(credentialBytes); }
hdos.toByteArray())); } finally { hdos.close();
hdos.toByteArray())); } finally { hdos.close();