When a client attempts to connect to a host (like a relay server), this connection is authenticated with a basic authentication challenge.To verify if the server certificate is trusted or not, the application registers a listener object with the OData SDK. If the server certificate is trusted, the connection is successful. If the server certificate is not trusted, it is rejected and the connection fails.
public static void setODPCertificateChallengeListener(IODPCertificateChallengeListener oListener) throws MessagingClientException;
Public class ODPCertificateListener implements IODPCertificateChallengeListener { // callback method for certificate verification @Override public boolean isServerTrusted(ODPCertInfo[] certCredentials) { Log.i("MDP","Do you trust the server for credentials:"+certCredentials.toString()); //display these credentials for the server return true; // return true or false depending on userinput from the UI } }
ODPCertificateListener odpCertificateListener = new ODPCertificateListener(); LiteMessagingClient.getInstance().setODPCertificateChallengeListener(odpCertificateListener);