Contains information about the network streams for a synchronization.
public interface NetworkData
All members of NetworkData interface, including all inherited members.
Name | Description |
---|---|
Returns a java.security.cert.CertPath object containing any certificates sent by the client. | |
Returns a Map object that maps header names to a List of header-values. | |
Returns the value of the last header received by the server with the supplied name. | |
Returns all the header values received by the server associated with the supplied name. | |
Determines if this synchronization is end-to-end encrypted. | |
Determines if the synchronization uses HTTP or HTTPS. | |
Determines if this synchronization uses TLS. |
This interface is useful when authenticating against another server in the enterprise that uses the client-side certificate and HTTP headers.
To enable a collection of network stream data, add collect_network_data=1 to your -x switches. This option adds additional per-sync memory overhead to store the data. When using TLS or HTTPS, the server asks the client to send a certificate during the TLS handshake, incurring a time and network cost.
You can obtain a NetworkData object by invoking the getNetworkData method of the DBConnectionContext class. When using HTTP or HTTPS, it contains the header data for the last HTTP request received by the server before the authenticate scripts are invoked.
The following example illustrates how to get a NetworkData object from the DBConnectionContext object, and output the data.
public class OrderProcessor { DBConnectionContext _cc; public OrderProcessor( DBConnectionContext cc ) { _cc = cc; } // The method used for the authenticate_user event. public void AuthUser() { NetworkData nd = _cc.getNetworkData(); if( nd != null ) { if( nd.isHTTP() ) { System.out.println( "http" ); String user_agent = nd.getHTTPHeaderValue( "user-agent" ); System.out.println( " user-agent: " + user_agent.substring( 0, user_agent.indexOf( '/' ) ) ); } else { System.out.println( "no http" ); } if( nd.isTLS() ) { System.out.println( "tls" ); CertPath certs = nd.getCertificateChain(); if( certs != null ) { System.out.println( " client-side cert:" ); int n = 1; for( Certificate c : certs.getCertificates() ) { System.out.println( " cert " + n++ ); X509Certificate c509 = (X509Certificate) c; System.out.println( " Subject: " + c509.getSubjectX500Principal().getName() ); System.out.println( " Issuer: " + c509.getIssuerX500Principal().getName() ); } } else { System.out.println( " no client cert" ); } } else { System.out.println( "no tls" ); } if( nd.isEndToEndEncrypted() ) { System.out.println( "e2ee" ); } else { System.out.println( "no e2ee" ); } } else { System.out.println( "NULL networkdata" ); } } } |
getCertificateChain method
getHTTPHeaders method
getHTTPHeaderValue method
getHTTPHeaderValues method
isEndToEndEncrypted method
isHTTP method
isTLS method
Discuss this page in DocCommentXchange.
|
Copyright © 2012, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.1 |