Enabling End-to-End User Authentication Propagation for Web Services

Enabling user authentication propagation for web services that are exposed via SOAP protocol using Custom Processor.

Context

You can now enable end-to-end user authentication propagation for web services that are exposed via SOAP protocol as OData services. To achieve this, add the custom code in the custom processor as given in the procedure below.
Prerequisite
For SSO with SSO2 and X.509 authentication type, you must encrypt the communication channel between the back-end and SAP Mobile Platform Server for security reasons before configuring a security profile. This is achieved by uploading SSO certificate of the back-end system in the SAP Mobile Platform Server and vice versa. See Using SSL Between SAP Mobile Platform Server and the Back End in Start of the navigation path SAP Mobile Platform 3.0 Next navigation step  SAP Mobile Platform Server Next navigation step  Administrator Next navigation step  Security Administration Next navigation step  Application Security Next navigation step  Authentication for User Logins  Next navigation step  Using SSL to Secure HTTPS Channel Communications in SAP Mobile PlatformEnd of the navigation path

Procedure

  1. While registering a web service in the API Toolkit for SAP Mobile Platform, enter the custom code in the Custom Processor for the selected web service to enable user authentication propagation. See Step 1 in Enabling Web Services as OData Services. The authentication credentials required are available in the headers that can be obtained as shown in the sample code. Set the credential values in headers as shown in the example custom script to ensure proper propagation of the user credentials to the SOAP service provider.
    An example JavaScript for basic authentication type
    function processRequestData(message) {
           importPackage(com.sap.gateway.ip.core.customdev.util);
           importPackage(java.util);
           importPackage(com.sap.gateway.core.ip.component.commons);
           importPackage(com.sap.gateway.ip.core.customdev.logging);
           importPackage(org.apache.olingo.odata2.api.processor);
    
           var headers = message.getHeaders();
           var context = headers.get("ODataContext");
           var request = context.getParameter("~httpRequestObject");
           var Auth = request.getHeader("Authorization");
           
           if(Auth!=null)
           message.setHeader("Authorization",Auth);
    
           return message;
    }
    
    An example JavaScript for SSO2 authentication type. Here, SSO2 authentication is enabled for an SAP back-end using MYSAPSSO2 token.
    function processRequestData(message) {
    
           importPackage(com.sap.gateway.ip.core.customdev.logging);
           importPackage(com.sap.gateway.ip.core.customdev.util);
           importPackage(org.apache.olingo.odata2.api.processor);
    
           var headers = message.getHeaders();
           var context = headers.get("ODataContext");
           var request = context.getParameter("~httpRequestObject");
           var MYSAPSSO2 = request.getAttribute("MYSAPSSO2");
           
           if(MYSAPSSO2!=null)
           message.setHeader("mysapsso2",MYSAPSSO2);
           
           
           return message;
    }
    
    If you have configured the security profile to use SSO with end user X.509 certificate, the parameter provided below should be set to true in the custom code to ensure that the request is processed in the context of the end user. If the parameter is not set to true, then the request is processed in the context of the technical user.
    message.setHeader("SET_SSL_CLIENT_CERT", "true");
  2. Generate and deploy the content bundle. See Step 1 in Enabling Web Services as OData Services
  3. Configure a security profile:
    1. (Applicable only for SSO2 and basic authentication) Configure a security profile with HTTP/HTTPS Authentication as the authentication provider from the Management Cockpit. Provide the URL of the back-end system where the web service is hosted. For SSO2, provide the MYSAPSSO2 token in case of SAP back-end system. See Creating and Configuring Security Profiles in Start of the navigation path SAP Mobile Platform 3.0 Next navigation step  SAP Mobile Platform Server Next navigation step  Administrator Next navigation step  Application Administrator Next navigation step  Managing and Monitoring Applications Next navigation step  Managing Security Profiles Next navigation step  Creating and Configuring Security ProfilesEnd of the navigation path
    2. (Applicable only for SSO with X.509 certificate) Configure a security profile with X.509 User Certificate as the authentication provider from the Management Cockpit. See Creating and Configuring Security Profiles in Start of the navigation path SAP Mobile Platform 3.0 Next navigation step  SAP Mobile Platform Server Next navigation step  Administrator Next navigation step  Application Administrator Next navigation step  Managing and Monitoring Applications Next navigation step  Managing Security Profiles Next navigation step  Creating and Configuring Security ProfilesEnd of the navigation path