AuthProxy namespace

The AuthProxy plugin provides the ability to make HTTPS requests with mutual authentication.



            


The regular XMLHttpRequest does not
support mutual authentication.  The AuthProxy plugin allows you to specify a certificate to include in an HTTPS request
to identify the client to the server.  This allows the server to verify the identity of the client.  An example of where you
might need mutual authenticaion is the onboarding process to register with an application, or, to access an
OData producer. This occurs mostly in Business to Business (B2B) applications. This is different from most business to
consumer (B2C) web sites where it is only the server that authenticates itself to the client with a certificate.


            


            Adding and Removing the AuthProxy Plugin
            


The AuthProxy plugin is added and removed using the
Cordova CLI.


            


To add the AuthProxy plugin to your project, use the following command:


cordova plugin add <path to directory containing Kapsel plugins>\authproxy


            


To remove the AuthProxy plugin from your project, use the following command:


cordova plugin rm com.sap.mp.cordova.plugins.authproxy

Classes

Name Description
sap.AuthProxy.CertificateFromFile Create certificate source description object for a certificate from a keystore file.
sap.AuthProxy.CertificateFromLogonManager Create a certificate source description object for certificates from logon manager.
sap.AuthProxy.CertificateFromStore Create a certificate source description object for certificates from the system keystore.

Members

Name Description
ERR_CERTIFICATE_ALIAS_NOT_FOUND Constant indicating the certificate with the given alias could not be found.
ERR_CERTIFICATE_FILE_NOT_EXIST Constant indicating the certificate file could not be found.
ERR_CERTIFICATE_INVALID_FILE_FORMAT Constant indicating incorrect certificate file format.
ERR_CLIENT_CERTIFICATE_VALIDATION Constant indicating the provided certificate failed validation on the server side.
ERR_DOMAIN_WHITELIST_REJECTION Constant indicating cordova domain whitelist rejection error while sending request to server.
ERR_FILE_CERTIFICATE_SOURCE_UNSUPPORTED Constant indicating the certificate from file is not supported on the current platform.
ERR_GET_CERTIFICATE_FAILED Constant indicating failure in getting the certificate.
ERR_HTTP_TIMEOUT Constant indicating timeout error while connecting to the server.
ERR_INVALID_PARAMETER_VALUE Constant indicating the operation failed due to an invalid parameter (for example, a string was passed where a number was required).
ERR_LOGON_MANAGER_CERTIFICATE_METHOD_NOT_AVAILABLE Constant indicating the logon manager certifciate method is not available.
ERR_LOGON_MANAGER_CORE_NOT_AVAILABLE Constant indicating the logon manager core library is not available.
ERR_MISSING_PARAMETER Constant indicating the operation failed because of a missing parameter.
ERR_NO_SUCH_ACTION Constant indicating there is no such Cordova action for the current service.
ERR_SERVER_CERTIFICATE_VALIDATION Constant indicating the server certificate failed validation on the client side.
ERR_SERVER_REQUEST_FAILED Constant indicating the server request failed.
ERR_SYSTEM_CERTIFICATE_SOURCE_UNSUPPORTED Constant indicating the certificate from the system keystore is not supported on the current platform.
ERR_UNKNOWN Constant indicating the operation failed with unknown error.

Methods

Name Description
deleteCertificateFromStore( successCB, [errorCB], certificateKey ) Delete a cached certificate from the keychain.
generateODataHttpClient() Generates an OData client that uses the AuthProxy plugin to make requests.
get( url, header, successCB, errorCB, [user], [password], [timeout], [certSource] ) Send an HTTP(S) GET request to a remote server.
sendRequest( method, url, header, requestBody, successCB, errorCB, [user], [password], [timeout], [certSource] ) Send an HTTP(S) request to a remote server.

Type Definitions

Name Description
deleteCertificateSuccessCallback Callback function that is invoked upon successfully deleting a certificate from the store.
errorCallback( errorObject ) Callback function that is invoked in case of an error.
successCallback( serverResponse ) Callback function that is invoked upon a response from the server.

Source

authproxy.js, line 27.