Friday, November 16, 2018

Beware: SAP Gateway services can default not be Cross-Domain / CORS accessed

In our business context we have non-SAP web applications that invoke SAP Gateway services to retrieve business data. This week I was involved in a rewrite of such application (the need for rewrite being that another consumed data source, namely a SharePoint List, was moved to a new destination, from on-premise SharePoint 2010 to Office 365 SharePoint Online). While testing the updated application codebase, I noticed that I unexpected run into data retrieval issues with getting the SAP data; on code that I did not even touch. After some investigation, the cause appeared to be a Cross Domain issue: the consumed SAP Gateway services are deployed on another domain as the application (whether run local via Node.js, or on the target webserver). The problem was known to application owner, and pragmatic solution to use the application only from Internet Explorer (IE); as that includes an option to disable the Cross Domain check. Mind you, I initially did my testing via Chrome and Edge; both browsers do not support to skip the Cross Domain check in their default usage behavior.
Having a developer and solution-aware mindset, I then thought to fix the application itself to enable Cross Domain data access. All browser support this via CORS. Change in the JavaScript codebase should be simple, call the service requests with Cross-Domain awareness: see Using CORS. However, even with this code change the application (or rather the browser) failed to retrieve the data from the SAP Gateway services. With developers tools I inspected the network traffic, and identified the problem. The PreFlight request issued by the browser for non-simple CORS data requests, are responded by the SAP Gateway application with HTTP 401.
This is not compliant with the CORS specification: Preflight requests must not include the user credentials. See the W3C Cross-Origin Resource Sharing specification, preflight request
All modern browsers obey to the CORS specification, and do intentionally not include Authorization in the Preflight OPTIONS request. SAP NetWeaver should respond with sending the CORS response, and next the succeeding actual http request (with GET, POST, PUT, or DELETE method) will include Authorization information: this is the call that actually goes into the SAP backend to access the stored business data.
The SAP Gateway specific cause is written in post How to Enable CORS on SAP NetWeaver Platform:
...why is the Preflight Request failing? The issue lies in how a Preflight Request is constructed. According to the CORS specification, the Preflight Request must NOT carry any user credential. As most applications on NetWeaver require user authentication, the Preflight Request will get an “HTTP 401 Unauthorized” error message, thus failing the request.
The post also describes an approach to resolve it directly on SAP Netweaver level, via combination of SICF configuration and ICM rewrite rules. Another approach can be to utilize a reverse proxy in the network infrastructure, and let that handle the CORS handling in front of the SAP NetWeaver destination.

Sunday, March 26, 2017

SharePoint integration endpoints for a SAPUI5 based PeopleFinder

SAPUI5 is a suitable framework to build responsive-design UIs that renders to the available screen estate of diverse device types: smartphone, tablet, and desktop. It is therefore a fit to deliver an alternative UI to SharePoint's PeopleFinder functionality, in case the out-of-the-box SharePoint UI (that is, with potentially the rendering still made company specific via customized Search Display Templates) for whatever reason does not qualify as sufficient fit. The basic requirement of a SAPUI5 mobile application is that it can consume data and functionality via OData REST services. The SharePoint platform supports such an architecture via the standard SharePoint REST services:
The integration surface for a peoplefinder functionality comprises 3 main elements:
  1. To interactive present people suggestions to user while typing in characters of the people name ==> Get names list of matched users on search input
  2. Get detailed list of matched users on search input
  3. Get details for selected user
1. Get names list of matched users on search input

Best:
SharePoint end-point 
https://<SharePoint root-url>/_api/search/query?querytext='preferredname:Jones*'''&selectproperties='PreferredName'&sourceid='B09A7990-05EA-4AF9-81EF-EDFAB16C4E31'&rowlimit=10

Alternative is to search in User Information List:
SharePoint end-point 
https://<SharePoint root-url>/_vti_bin/listdata.svc/UserInformationList?$filter=((ContentType eq 'Person') and (substringof('Jones',LastName)))&$orderby=Name

but this has some disadvantages:
  • Incomplete qua users: user is only added to UserInformationList on first visit to SharePoint site; users not visited yet, are not included
  • Overcomplete: UserInformationList is never cleaned up, former colleagues remain in the list
  • Incomplete qua search: UserInformation does not contain a full name field
2. Get detailed list of matched users on search input

Search in full content / all crawled people data fields:
SharePoint end-point https://
<SharePoint root-url>/_api/search/query?querytext='Mobile*'&selectproperties='FirstName,LastName'&sourceid='B09A7990-05EA-4AF9-81EF-EDFAB16C4E31'&rowlimit=10

Search in identified property-field(s) only:
SharePoint end-point https://
<SharePoint root-url>/_api/search/query?querytext='department:Mobile*'&selectproperties='FirstName,LastName'&sourceid='B09A7990-05EA-4AF9-81EF-EDFAB16C4E31'&rowlimit=10
3. Get details for selected user

Get all public properties:
SharePoint end-point https://
<SharePoint root-url>/_api/SP.UserProfiles.PeopleManager/GetPropertiesFor(accountName=@v)?@v='<uname of user>'

Get one single identified user profile property only:
SharePoint end-point 
https://<SharePoint root-url>/_api/SP.UserProfiles.PeopleManager/GetUserProfilePropertyFor(accountName=@v,propertyName='AboutMe')?@v='<uname of user>'

Thursday, December 22, 2016

Reverse Proxy must not decode Fiori URLs

‘Double Encoding’ issue with Fiori Urls in case of Apache-based Reverse Proxy

The typical infra architecture of an on premisse Fiori deployment includes a reverse proxy that enables access to the Fiori Apps from the internet. A responsibility of the reverse proxy is to forward the received external uri address to the protected internal Fiori resource. The generic pattern here is that the domain part of the external url is mapped to the internal url, and the remainder of the external url is concattenated to the internal url. Some / most reverse proxy products handle encoded special characters in the remainder part, well special, by decoding them before forwarding. However, (a.o.) for Fiori URLs this behaviour is undesired. The encoded characters must be forwarded as is, so that the web dispatcher on Gateway FES can decode them and process the correct decoded uri.
Clarification of the effect due 'double encoding' of Fiori URL:
  1. Browser requests "https://<external-DNS>/sap/opu/odata/UI2/PAGE_BUILDER_PERS/PageSets('%2FUI2%2FFiori2LaunchpadHome')?$expand=Pages/PageChipInstances/Chip/ChipBags/ChipProperties,Pages/PageChipInstances/RemoteCatalog,Pages/PageChipInstances/ChipInstanceBags/ChipInstanceProperties,AssignedPages,DefaultPage&sap-cache-id=...";
  2. SAP Gateway FES returns http error 404;
  3. Error logged on the SAP NetWeaver node is that "http://<SAP web dispatcher / Gateway FES>:8000/sap/opu/odata/UI2/PAGE_BUILDER_PERS/PageSets('%252FUI2%252FFiori2LaunchpadHome')?$expand=Pages/PageChipInstances/Chip/ChipBags/ChipProperties,Pages/PageChipInstances/RemoteCatalog,Pages/PageChipInstances/ChipInstanceBags/ChipInstanceProperties,AssignedPages,DefaultPage&sap-cache-id=..." is an invalid URI

Tuesday, November 1, 2016

Qualities of SAP Fior Apps

Few months ago, SAP published document "Qualities of SAP Fiori Apps (July 2016)". This document is aimed at customers and partners and defines the qualities to be met by a SAP Fiori app. It covers design, implementation and technical criteria to be met beyond the SAP product standards. Thus a handy resource to utilize for reference and guidance. However, as result of SAP's recent changes on SCN, the link became a deadlink and can current not be successful viewed via SAP locations. As I downloaded the document before, I make it available here in awaiting for SAP to structural recover their document link on SCN and/or HANA EA Explorer.

Friday, September 30, 2016

Why is Fiori adoption lagging behind?

Yesterday I attended a meeting of the Dutch SAP User Group (VNSG) on the topic ‘Customer Fiori Experiences’. As usual, the audience was mostly consultants/developers of SAP consultancies, and only a few actual end-customer attending. After interesting sessions on the state of Fiori (a.o. on SAP Fiori Cloud Edition), the meeting ended with a roundtable to share experiences. And in particular to discuss and answer on the topic how-to increase Fiori adoption in the market. According to latest numbers, (only) 10% of SAP customers world-wide are active with Fiori, and significant subset of them merely with 1 or 2 first Fiori Apps. Note, in The Netherlands the number is higher, as we’re very technology-savvy and typically run ahead of the rest of the world on adoption of new technologies.
There was large consensus in the group that the minimal actual Fiori implementations is for a major part still due unfamiliarity. Not so much by business and end-users, but by majority of SAP developers for which the step to Fiori / UI5 is [too] big, and they prefer to just stick within their comfort zone. Although there might be truth in this, I personally think the more important causes are others.
The most important is that for SAP customers there must be a tangible business case to switch to Fiori. It is not sufficient, even irrelevant for SAP organizations to switch to new technology and products just because SAP is now delivering it (and promoting it as the next great thing). Even though standard Fiori Apps do not have a license cost (anymore), there is still investment costs involved to transition from current application formats (e.g. GUI transactions, Portal application, WebDynpro) to Fiori as new UI and interaction concept. The investment costs are within preparing the IT landscape infra (introduce NetWeaver Gateway, and Fiori Front-End Server), deploying Fiori Apps plus the required underlying Gateway OData services in the SAP landscape, align with and convince Enterprise Architecture plus (IT) security that Fiori is a future-proof and secure/safe approach, educating end-users. And typically the standard Fiori Apps are not addressing the core of the specific organization, and custom Fiori Apps + Gateway OData services must be developed. And there is again the business case: if there is an existing application that still does the job, even with outdated, stone-aged layout and user-experience, there is little business motivation to invest in improving that for the internal employees. So what is needed then? In my experience and opinion, the precondition to introduce + land Fiori usage within any organization is that there is a concrete trigger – business or IT (savings). This can be that an existing SAP application (standard or custom) no longer suffices and requires to be redesigned and rebuild – and thereby introduces the opportunity to take new UI and mobility requirements into account. Or because there is a new business demand, and again in the current days with ‘mobility-first’ this must be included from beginning of. A third trigger is Application Lifecycle Management, which forces organizations to upgrade their landscape to recent NetWeaver version. Also this can be good moment to reconsider for (some) applications to migrate them into a modern UI experience.
Note, what does not help the market growth of Fiori is the SAP image: stable and robust functional platform, that you do not have to (should even) touch much. SAP could therefore also take a rewarding approach: make it tangible benificial for SAP customers to introduce Fiori => introduce new functional capabilities only via/as Fiori. Actual SAP is following this approach, with 'Fiori-tizing' S/4 HANA.

Wednesday, September 21, 2016

Resources for considering Fiori Launchpad deployment options

With the introduction in March this year of SAP Fiori Cloud Edition, SAP now supports upto 5 different deployment options for Fiori Launchpad:
  1. ABAP Front-end Server
  2. SAP Enterprise Portal, as of NW 7.31 SP12 and NW 7.4 SP7
  3. HANA Cloud Platform (HCP)
  4. SAP Fiori Cloud Edition
  5. SAP HANA Server
Which of these options is a/the best fit for an organization is largely influenced by the situation and roadmap of that specific organization. Some useful resources to aid in this deployment decision-making:
Use them at your own convenience...

Friday, June 3, 2016

SAP Web IDE cloud connectivity issues

This blog is earlier published on SAP Community Network Blogs

SAP Web IDE cloud connectivity requires project folder direct below the root node “Workspace”

In the HANA Cloud Platform cockpit I’ve setup a connection to the demo Gateway system. Next, in SAP Web IDE I’ve created a new App folder. As I prefer a manageable overview of all Apps (to be) developed in Web IDE, I created that App Folder in a subfolder beneath the Workplace folder:
This decision however gives problems within Web IDE wrt setting up the cloud connectivity.

Issue 1: neo-app.json generation is not available

Pragmatic workaround for this was to generate it via a test-App folder directly beneath Workplace, and copy + paste that file in MyApp folder. Problem resolved.

Issue 2: The destination is runtime resolved to incorrect address

Testing the MyApp in Web IDE, data is not displayed in UI. Via F12 notify that the connection to connect to the demo system is not correct resolved, and returns a 503:
For a quick test I duplicated MyApp to be directly below Workplace folder, and without making any code or configuration change, ran it from here. And now the connection is resolved, and the App displays the data from Gateway demo system:
I compared the urls generated from Web IDE to the service destination in the 2 situation. The only difference is in the 'webidetesting' part. Apparently there is some "magic" in Web IDE that reserves a dispatching url in HCP for service destinations, and that 'magic' is dependent on the project folder located direct below 'workplace'.
I considered as workaround to modify the 2nd level project in manifest.json and have it use the absolute connecting url to service:
However, that setup runs into a cross-domain issue, and is thus neither working:
The only resolution for this is to comply to the 'implicit rule' of Web IDE, and place the project folder thus direct below root node "Workplace". With the drawback that you loose the option to structure and classify your projects / Apps folders, and all need to be administrated at the same level as sibling nodes. I would rather be able to make in Web IDE visual groups of project / Apps folders per customer and / or functionality, e.g. for HR, Finance, Marketing. Perhaps we will see this functionality in a next version of Web IDE?

Thursday, May 12, 2016

First thoughts on Native Enterprise Fiori iOS Apps

On May 5, SAP and Apple announced a partnership to deliver native iOS Apps that will connect into SAP business suites:
My personal first response on this news was astonishment and non-understanding. Since 3 years SAP is full promoting SAP Fiori build through SAPUI5 (or openUI5) web-technology as THE future-proof way to build user-friendly SAP Apps. SAP applies itself in all new and updated product developments, as SAP HANA Analytics Apps, NetWeaver Business Client, SAP Enterprise Portal. SAP made and evidently applies the decision to go full-stream for web-based UI in favor of the platform-specific native product developments (of which SAP tried several variants, most notable through the Sybase Unwired Platform). And now all of a sudden, SAP appears to return on this decision and [also] to put full steam on platform-native development. Starting now with first Apple/iOS, and already communicated plans to follow later with Android.
I expressed my surprise and concerns on a SAP post in which Steve Lucas communicated on the SAP-Apple partnership. His responses gave me more insights in the why of this renewed native-attention, and the positioning towards web-based. Not to say that I in all agree.
Steve in particular replied with statement ‘There’s a big different between “semi” native and native’. On this I disagree, regarding the qualification ‘big’. I do acknowledge that for interactive consumer Apps this may still (and likely remains to) hold, as those may need the local computer power and platform-local capabilities. Games are a good example that really benefit from direct access to the local resources and computing power. But I personally doubt that platform-native capabilities add considerable extra value for business / enterprise Apps.
As a true architect, I made a Pro/Contra enlistment for Fiori-native and Fiori Web-based:
Fiori-native

ProAbility to use device-local capabilities (e.g. geolocation, camera, local storage)
 Rich UI
 Consistent UI for the specific device-platform
 Optimal local performance (power)
 Fast graphics
 Push-notification supported
 Possible to run / continue in background
 Data-integration possible with other local Apps
 
ConNeed to build + support per device-platform
 Mobile-Only
 Version-upgrades must be explicit brought to each individual end-user device
 Requires SAP HCP
 
Fiori web-based (SAPUI5/openUI5)

ProOne version usable on all device-platforms
 Mobile-First / Mobile + non-Mobile
 Easy deployment: Version upgrades only on central webapplication level, transparent to end-user devices
 Via Fiori Client or Kapsel: possible to act as semi-native App, direct user-launchable from the device
 Via SAPUI5 and other frameworks (jQuery), possible to use device-local capabilities (GPS, Camera)
 
ConFunctionality limited to common denominator across the platforms
 UI is not on-par with the device-specific experience (e.g. Fiori UI differs considerable from iOS native UI)
 Push-notification is complex (and requires Fiori Client or Kapsel [Hybrid App]
 Local file storage not available (although from security perspective, this is not per se a disadvantage for business / enterprise Apps. Dependent on the business App, it may be prohibited to locally store sensitive / business-critical data)
 Not possible to run in background
 Less performant due browser javascript engine + interpreted rendering
Based on these (and more) pros/contras, individual companies/architects can decide whether to go for web-based SAP Fiori or platform-native Fiori. Noticable especially is the HCP dependency in case of Fiori-native. Implication is that companies that are no subscriber [yet] of SAP HCP, cannot go the Fiori-native path. But they can expose their on-premisse SAP Business Suite(s) via web-based/SAPUI5 Fiori Apps.

Saturday, April 30, 2016

My openSAP Fiori submission flagged as extraordinary by peer reviewer

Over the last couple of months I participated in the openSAP ‘Build Your Own SAP Fiori App in the Cloud – 2016 Edition’ on-line training. Reason to participate was to increase my practical knowledge on Fiori development, now that we intend to rebuild our business portal utilizing Fiori Launchpad and UI-technology. Although I already have practical SAP Fiori + Gateway experience in my role of solution architect for an App build for a large Dutch bank – this App even won the Bronze SAP Quality Award 2015 in the category ‘Innovation’ -, I wanted to renew my knowledge with the latest SAPUI5 technology state and also the tools that SAP now delivers. The tools encompass the full spectra, from design [SAP Splash and BUILD], to development [SAP Web IDE]
The structure of the openSAP training is first lectures explaining about the why and concepts of Fiori, Design Thinking approach applied for custom Fiori development, and how-to design and develop a custom Fiori App. A central element of the training is, as the title already states, to design and develop an own Fiori App. Applying the Design Thinking approach, and the tools that SAP provides. The first assignment was to design the App, both functional as visual specification – preferable via SAP BUILD. And the final assignment was to develop it as a real functioning Fiori App, build with SAPUI5 framework within SAP Web IDE.
The App I came up with is ‘ProcessMonitor’. Basically it serves as a headlights dashboard to watch the (non)progress of business processes that you have a stake in. Typical these are the processes that you’ve started, and await on their completion.
Design - mockups

Develop - App
A nice element of the course is mutual peer-reviewing. Each participant is requested to review at minimal the submissions of 5 of your peer participants. And it also implies that your own submitted work will be reviewed by at minimal 5 of your co—participants. I was pleasant surprised to hear that my Develop Challenge submission was flagged as extraordinary by one of my peer reviewers. Acknowledgement and recognition by your peers is one of the best there is…
And the App can be further extended on. A next useful functional addition to the App is the ability to monitor the (non)progress of projects in which you are not yourself direct involved, but still have a stake or even merely are interested in it’s completion. The idea here is that you can request a list of running processes – naturally complying to business authorization rules, you thus only can see the processes that you given your business role are allowed to see. And select from the list the process(es) that you want to ‘follow’. An example would be to 'follow' the progress of a budget approval process in your company that concerns a project you like to participate in.

Wednesday, April 27, 2016

Architectural decision path to rebuild our business portal foundation

As stated in previous post, current our business portal foundation is based on SAP Enterprise Portal 7.01. The direct trigger to consider a rebuild is that SAP has announced that support on EP 7.01 ends per end of 2017, and even no extended maintenance will be offered (source: SAP Note 1648480 - Maintenance for SAP Business Suite 7 Software). But another motivation is perhaps even more important: enable our end-users to seamless access and use the business portal foundation and the business applications exposed in/via it.

What is a business portal: Architectural Views

Business Architecture

  • Host of functional portals
  • Launchpad to access business applications
  • Structured collaboration with external counterparts (suppliers and customers)
  • “Business card” of the company’s identity and IT maturity level to internal employees and external partner organizations

IT Architecture

  • Presentation layer
  • Identity and Access Management
  • Reverse Proxy
  • Authorization / Roles Management
  • Single Sign-On to ASML business applications
  • Content + Knowledge Management
  • Application hosting

Ambition for renewed Portal foundation

We aim for a user-centric environment, Responsive Design, mobile-ready, seamless end-user operation, personalizable, role-based, performant, secure, company branding. And appealing to use…These are all aspects that SAP aims to address with the Fiori offering, and via SAP Fiori Launchpad as gateway entrance. But SAP is not alone in there, other portal platform vendors aim to support the same.

Portal platform (re)selection

The decision to rebuild our company portal foundation also beholds a good moment to re-evaluate the portal platform selection. It will again be a decision that lasts for years, thus justified to spend time to the portal platform and vendor selection.

The outcome of the selection traject is that we stick with SAP as vendor for our portal foundation. The main decision drivers for (re)selecting SAP as portal platform are:

  • This is predominantly Application Lifecycle Management, like for like
  • Gartner positioned SAP as a leader in it’s 2015 Magic Quadrant for Horizontal Portalson completeness of vision for Portal and UX (via Fiori) offering
  • The weighing of the 6 Portal Platform Leaders on the main company priorities results in SAP qualified as Nr 1 for our portal foundation
  • A large set of the exposed business applications are current build as ‘Portal-Embedded’ applications: they make use of and are dependent on SAP Portal capabilities, e.g. Enterprise Portal Knowledge Management
  • A large set of the exposed business applications are SAP backend based. Exposing via a SAP technology-based portal results in better integration plumping: authentication, Single Sign-On, end-2-end auditing.
  • SAP and it’s partners (will) deliver standard SAP Fiori Apps to operate SAP Business Suites (Finance, HR, Sales, Manufacturing, Supply Chain, …). Examples applicable for Supplier context:
    • WBS Element BOM
    • Quality Notification
    • Report Quality Issue
    • Open Orders – Total Orders By Status
    • Process Order
    • Track Shipments

Portal foundation rebuild strategy

  1. Application Lifecycle Management to SAP EP 7.5:
    • Remain supported by SAP
    • Remain in-control of the full Portal landscape
  2. Innovation via Fiori Launchpad:
    • User Experience: Prepare and enable for new UI concepts
    • Functionality: Prepare and enable for new service concepts

Sunday, February 14, 2016

Exploring scenarios for upgrade of SAP Portal based application

In our company we’ve set up multiple end-user business applications on the same physical SAP Enterprise Portal landscape. Due diverse reasons, our Portal landscape is still on version 7.01 and getting outdated. From Application Life Management responsibility we’re now looking into upgrade of our Portal landscape. However, as everyone involved in SAP architecture and usability is very much aware, SAP has not stood still the last years, and as result the landscape to select from has been severely broadened. We can upgrade our SAP Portal landscape to the newest version 7.5. Or we can decide to introduce Fiori Launchpad as new entry point for our logical applications. Another solution option is the NetWeaver Business Client. Or the HANA Cloud Portal. And then there are all kinds of mixture scenarios thinkable. Amongst the decision criteria for the diverse scenarios are off course money and effort/time. But the most important is the usability of the new solution. And another is to careful watch what direction SAP is heading, to avoid that we go into a direction that SAP will not be committed to in [a] near future.
Current I’m defining the architecture plan for the new solution. In this plan I outline the diverse scenarios, and weight each of them on pros and cons for our situation. To form more feeling by what SAP is doing, we attended 2 workshops: one arranged by SAP specific for our company, and another setup by VNSG (the Dutch SAP User Group) for multiple invited companies. Especially in the last it was clear that we’re not alone in/on our quest: multiple organizations (among remarkable a lot of Universities) are struggling on what step(s) to take next on [SAP] portal area.
In the coming months I will regular post updates on first our decision path, followed by the progress of the eventual implementation(s).

Friday, October 2, 2015

Aspects and challenges encountered mobilizing a SAP business process

This blog is earlier published on SAP Community Network Blogs
Last year I was the integration/solution architect to expose a custom SAP business process as mobile App. In this posting I want to enumerate the major aspects and challenges we encountered. And with success, the App is in productive use, and the end-result recently won the SAP Quality Award 2015.

Aspects and challenges

SAP business system is a closed system
This actually encompasses 2 different aspects. For one, the functionality of the SAP system is locked internal in the SAP system with SAP proprietary technology and data formats, not exposed nor fit for alternative UI channels. And second, the SAP system is isolated from the evil outside in the company-internal infra.

Users demand a pleasant ‘form-factor’
Users are fed up with the arcane UI, and want a user-experience that feels good. This means it must look good, and moreover that it must have a pleasant behavior that supports the user in doing the work effective and efficient.

The mobile ‘form-factor’ must enable multiple devices and screens
Most noticable is that users expect an App to be usable from tablets and smartphones. And second is that for tablets, but in particular for smartphones, multiple different device formats and OS platforms are in use.

Unknown makes unloved
Since decades the SAP business systems are the stable base on which the organizations rely. Any change to this status quo inhibits the risk of disruption. And then also all that mobile technology and aspects introduces new knowledge. It is human response to be very careful, perhaps even scared, to all that new stuff.

The unknown outside is evil
IT security is not an easy, or even thankful job. They are held responsible in case of issues, and taken for granted otherwise.
When functionality is exposed via additional channels, also the security vulnerability increases. It is only rightful that security is very cautious, and demands proofing that the changes do not result in unacceptable security and thus business risks.

Secure and reliable authentication from App into SAP
Like all business systems, SAP internal processing is permission-based. What one is allowed to do depends on authentication (who you are) and authorization (what your allowed to do). In mobilizing the business process, the authentication part is primary delegated to the App, while the authorization part remains in the business system.
Typical the App-identity is different from the SAP identity, and a credential-mapping is required (Single Sign-On).

Performance
Although performance is also an aspect of the pleasant app-experience, the importance of this topic for user acceptance on itself warrants dedicated focus. Business-users are just as intolerant against bad-performing business-apps as they are in the personal context against non-performing consumer-apps. Also note that a major motivation for mobilizing SAP business process is to facilitate shorter time to handle, and a performant ui-experience is in that sense an absolute requirement.

What if…
...in <x> time insights or business situation has changed, and the delivered App is no longer sufficient? Such uncertainty about future developments (business and technology) is often misused as excuse to halt, and make no changes. And users are withheld from improvements in operation of the daily business actions that can be delivered to them today.

Infra aspects highlighted
1. Interoperability
Connectivity from App to the SAP business system
Expose the SAP proprietary data and functionality for outside consumption in the App
Data mapping of SAP proprietary data model in a standards-based, and optimized dataformat
Integration endpoints
2. Identity Management / IAM
Authentication (SSO across diverse authentication administrations)
Permission management

3. Security
Data loss ( through Device loss)
Data integrity (inspection, to prevent via encryption)
Unmanaged devices / BYOD
User and Device onboarding

4. Performance
Network throughput + latency
Scalability
Availability

5. Auditing / Audit Trails
Logging
Health monitoring

Architectural decisions

  1. Deliver the App as a web-app; and rely on platform browsers to make sure the App runs on the multiple devices
  2. Deploy as PhoneGap hybrid App that can directly be started from the device (relieving the user of need to retype the url in browser)
  3. Expose the required functionality to outside as an API, with endpoints that are invoced via integration and data standards.
  4. Use Gateway as middleware to deliver the service API: develop + runtime
  5. Use SAPUI5 as html/javascript platform to deliver Responsive Design UI, and in look&feel that users are getting more familiarized with via the expanding SAP Fiori apps
  6. Architect the App as loosely-connected UI-part and Processing part. This allows to exchange the UI-part for another UI-format when the situation has changed, while the processing part can be reused.
  7. Architect the service API for an optimized integration surface. Avoid excessive call behavior of the App into the service API resulting in network latency, and design ‘chatty’ interface methods instead of data-minimized service methods.
  8. We did NOT utilize SAP Mobile Platform, but hook into mobile platform that is already in use. Providing device onboarding, reverse proxy, transfer security.
  9. Rely on proven SAP-technology of Java Authentication Server + LogonModule to convert customer-internal credential into SAP Logon Ticket (MYSAPSSO2, used in the SAP system).

Project approach

  1. UI-design the ‘mobile experience’: build mock-ups together with stakeholders to quickly arrive at an App-experience that will truly help the business users.
  2. Take the initial unknowledgable at the customer side on the tour to teach the new mobile concepts, and as such take away their uncertainties and anxiety that are due the unknown
  3. Team up with SAP as supplier, and convince IT stakeholders at the customer on the support level of standard software (Gateway, SAPUI5). Call in on well-known SAP expertise (Andre Fischer, Holger Bruchelt) for solid advice and/or crosschecking.

Monday, October 27, 2014

The SAP Mobile Integration playing field

SAP NetWeaver Gateway, SAP Mobile Platform, SAP API Management, Integration Gateway: the SAP Mobile Integration playing field includes multiple players. What are their roles, and can they play well together?

SAP Mobile Integration technologies and products

The role of SAP NetWeaver Gateway is exposing SAP ABAP-based Business Suites for consumption by alternative UI-channels, SAP and non-SAP. Including mobile apps, a.o. the SAP Fiori Apps.
SAP delivers also SAP Mobile Platform as a standard product. SMP 3.0 includes an internal component Integration Gateway. This is something different than NetWeaver Gateway, although it’s role is comparable: expose data and functionality for external consumption. Starting SMP 3.0 service pack 4, SAP positions SMP also as “Fiori-compatible”. Elements of this are SAP Fiori Client and Kapsel SDK within the SMP portfolio.
Early October, SAP in addition launched the new product SAP API Management. With this product, organization can manage and govern their service provisioning and usage by consuming organisations and Apps. Also this product thus has its rol in the mobile integration landscape.

How do these products play along?

SAP itself acknowledges that the pure existence of these 3 products, which seem to functionally overlap, likely will result in market confusion. To mitigate that effect, Joav Bally wrote an excellent article to clarify on higher level the difference in role positioning. Instead of repeating him, I simple refer to his post: Uniform Provisioning and Consumption of SAP (and non-SAP) Data. Another good information source is the post ‘There is a Gateway for that …’ by Mustafa Saglam.
Inspired by the insights I gained via these 2 blogs, I sketched a conceptual architecture diagram in which the 3 SAP integration products/technologies are positioned in the architecture layers.

Tuesday, September 2, 2014

HowTo diagnose root cause of Gateway authentication issues

Gateway supports multiple authentication methods to enable Single Sign-On: Basic Authentication, SAML 2.0, X.509 Certificates, SAP Logon Tickets, OAuth. Correct operation of SSO between a Gateway services consumer (e.g. SAP Fiori, SharePoint App, …) and Gateway requires that the consumer and the Gateway system have established an identity trust relationship. This typically (except for basic authentication, but I do not consider that as a viable enterprise-ready SSO option) requires configuration on consumer and Gateway side.
What to do in case the service consumer does not succeed in successfully sign-in on Gateway? How to find out what is the root cause, when you have configuration settings on both the consumer and on the Gateway side? Well, it appears that the NetWeaver stack provides a convenient diagnose tool for this:
https://<hostname>:<port>/sap/bc/webdynpro/sap/sec_diag_tool.
.
Make sure to activate this service in SICF, open the service in a browser, start a recording session, and repeat from consumer side the attempt to single sign-on. Next stop the recording, and inspect the trace file. In case of security related exception, you're likely to find useful information logged in that trace file.

Friday, August 15, 2014

Gateway protection against Cross-Site Request Forgery attacks

Gateway REST services open up the SAP landscape for consumption and operation from clients outside that trusted SAP landscape, including those evil browsers. Evil as we all know, the web cannot be trusted. A critical aspect in the Gateway architecture is therefore to mitigate the impact of web-based security attacks.

Cross-Site Request Forgery (CSRF)

One of the most exploited security vulnerabilities on the web is cross-site request forgery. The essence of a CSRF attack is that a malicious site misleads a trusting site in believing that a transactional request comes with approval of the user. The working of a CSRF attack is as follows: 1) after the user has set up an authenticated session with an application site, 2) the user while still within this authenticated browser session visits a malicious site, and 3) the malicious site tricks the user in sending requests to the application site that are actually constructed by the malicious site. Misleading the trusting site that the request comes with approval from the authenticated and authorized user, while in fact it originates from a malicious site. Hence the name cross-site request forgery.
The success of CSRF attacks depends on 3 factors:
  1. The ability to load malicious javascript code within the authenticated browser session.
  2. The ability to misuse the user authentication to the application site. In most browser/webapplications scenarios the user’s authentication state is maintained in cookies after successful authentication – required to preserve the authenticated state. If the malicious site can lure the user into sending a malicious request from the authenticated browser session, that request will automatically include all cookies including the authentication state. And thus be authorized to the trusting site without the user being aware nor approved the request.
  3. The predictability of the transaction request, so that the malicious site is able to automatically construct a request that will be serviced by the trusting site.
The first factor is common exploited by social engineering. The user is somehow seduced to load javascript code from the malicious site into the current browser session, without the user even be aware. Typical example is to send an email to user with hidden javascript code, and when the user opens it a request is send to malicious site. The protection against this risk are a combination of tooling – mail filters; and educating the users – do not just open any received mail. Although the quality of both security measures increases (yes, users are also more and more aware of the risks on the web), this protection is certainly yet not 100% foolproof.
Note that this factor is only present if the consumption of the webservices is via a browser. In case of a native application, and also in case of an embedded browser in native App (e.g. Fiori Client, Cordova), the user cannot visit others sites and have its client context become infected / compromised.
The second factor is inherent present in all browsers. Without it, each request send from browser would first need to go through the authentication protocol with the remote webapplication, involving browser redirects, identity stores. And in case of username/password browser logon, the user would have to reenter his/her credentials over and over again. Thus: preserving the authentication state after initial authentication is needed to avoid the processing and elapse time for the authentication protocol handling, and to prevent unhappy users. User-friendliness and security are often in contradiction.

Protection against CSRF attacks: CSRF Token

CSRF protection focusses on the 3rd factor: make sure the request cannot be (automically) predicted and thus constructed. Introduce CSRF Token protection.
The essence of CSRF Token protection is that the token is a secret key that is only known to the authenticated browser session and the trusting site, and that the authenticated browser session must include in each modifying request to the trusting site in order to convince the trusting site that the request is coming with consent from the user.
CSRF token protection is utilized on modern webapplication platforms, including SAP ICF, Microsoft IIS, …

CSRF protection applied in Gateway

SAP Gateway applies the following protocol to protect against CSRF:
  1. The user opens in browser a session with the Gateway based webapplication, and must first authenticate. This can be via any of the authentication methods: username/password, integrated Windows Authentication, X.509, SAML2, OAuth. After successful authentication, the browser has established an authenticated user-session with this trusting web application.
  2. The webapplication code loaded in the browser (HTML5, JavaScript) invokes HTTP GET requests to the Gateway REST services to retrieve data. The GET request can only be used to retrieve data, not to request a modifying transaction on a Gateway service.
  3. In case the client application wants to execute a transaction via Gateway REST service, it must invoke this via a POST, PUT or DELETE request. To ensure to the trusting Gateway REST service that the transaction request indeed originates from the user through the client application, the request must be signed with a CSRF-Token as secret key only known by the client application context and the Gateway webapplication.
  4. The CSRF-Token must be requested by the client application from the Gateway webservice. This can only be done via a non-modifying HTTP GET request. If the client application needs the CSRF Token for subsequent transactional request(s), it must include header variable X-CSRF-Token with value ‘FETCH’ in a non-modifying HTTP Get request send to the Gateway service. As all browsers enforce same-origin policy, the browser will only send HTTP GET requests issued from resource/code loaded in the browser that has the same origin/domain as the Gateway REST service. When code loaded via another (cross) site tries to send the HTTP GET request, the browser will refuse to send it.
  5. Gateway webservice only serves request to return X-CSRF-Token for non-modifying HTTP GET Request. It is not possible to retrieve the X-CSRF-Token via a modifying HTTP PUT/POST/DELETE action. Reason is that these requests are not subject to same-origin policy, and thus can be issued from code loaded from another domain (note: the essence of JSONP crossdomain handling).
  6. When Gateway receives a non-modifing GET Request with header variable ‘X-CSRF-Token’ equal to ‘FETCH’, it random generates a new token and returns the generated value to the requesting client in the response: via header variable and cookie. As result of same-origin browser policy, cookies can only be read by javascript code originating from the same domain. Malicious code loaded from another domain cannot read the cookie nor header variable. Also the random generated value cannot reasonable be guessed by the malicious code.
  7. The client application reads the CSRF Token from the HTTP GET Response, and includes the value as header parameter X-CSRF-Token in modifying HTTP requests to Gateway webservice. As the token value is also returned in GET ‘FETCH’ response via cookie, the value will also be included as cookie variable in each subsequent request from the client application in the current browser session.
  8. When Gateway receives a modifying request, SAP ICF runtime inspects the request on presence of X-CSRF-Token in both request header as in cookie. If present in both, it next compares the 2 values. Only if present and equal, the modifying request is guaranteed to come from the client application context, and is granted for execution by the Gateway REST service.

Proofing of Gateway CSRF protection

As stated above, a CSRF attack depends on the ability for malicious site to automatically construct a malicious request, that next the user is somehow lured into sending to the trusting site, and that is well-crafted to mislead the trusting site that the request is with the approval of the authenticated user.
The URL, including REST action is typically static; and could reasonable be ‘guessed’. And as same-origin only applies to HTTP GET request, it is also possible to send PUT/POST/DELETE requests that originate from the malicious site. But in order to have SAP ICF and thus Gateway trust and next execute such a transactional request, the request must be signed with the CSRF-Token as secret key in request header + cookie. The browser automatically includes all the cookies in the request. But the request header is not automatically reused/added by the browser, and the malicious code must therefore explicly set it in the XmlHttpRequest. However the CSRF Token value can only be retrieved and read by JavaScript code that originates from the same domain as the Gateway webservice. Not from JavaScript code that originates from another, external domain. Therefore the malicious code cannot reasonable construct a complete transaction request that includes the proper value of CSRF Token in both request header and client cookie. And Gateway is enabled to detect the malicious request as not being legitimate.

Monday, August 4, 2014

The 5 elemental Gateway Principles

Inspiration: OData and SAP NetWeaver Gateway, SAP Press
SAP developed NetWeaver Gateway as additional middleware technology with the prime goal to increase the reach of SAP Business Applications. The positioning is to enable the development of new types of user-friendly front-ends as new channels for consuming and operating SAP data and functions. Lightweight-consumption Apps.
Gateway provides an open, standards-based (REST, OData), and centralized services-interface [gateway] to the SAP business applications, aimed and optimized for service-consumption through interactive UI-applications. The architectural guiding input for Gateway comes from 2 different perspectives: UI (end-user) and infrastructure (reach, costs).
In the Gateway architecture 5 elemental principles are applied, to achieve openess of SAP business applications also to non-ABAP developers:
  1. Openness
    Gateway services must be open for consumption from any device and any technology platform
  2. Timelessness
    Gateway must support opening up of any SAP business suite version, for which it is reasonable to expect to still be in use by end-organizations
  3. Easy of consumption
    Any front-end developer must be able to utilize Gateway services to consume SAP data, no need for internal SAP knowledge
  4. User focus
    Gateway must support the development of modern, interactive UI-applications
  5. Division of work
    Gateway development must support work in parallel by backend developer for service provisioning, and front-end / Apps developer for the service consumption.
For a deeper understanding and appreciation of the Gateway architecture and it's guiding architecture, I highly recommend the SAP Press book "OData and SAP NetWeaver Gateway".

Thursday, July 31, 2014

Enumeration of Gateway licensing

Last a colleague asked me about the license model of Gateway usage. As this was not the first time I got such request, and a clear answer is hard to find online, I decided to base a blog on the answer I provided my colleague. So I at least myself have a source to refer to in future requests... Mind you that I do not guarantee the answer to be future proof, as SAP already once changed the Gateway license model.
In very short, Gateway licensing is as follows:
  1. Usage of Gateway to consume SAP data and functionality via Gateway Services (preferable REST, but SOAP although not SAP-recommended still supported), requires that the end-user has a Gateway User license.
  2. If end-user is already a SAP business suite user, this now also includes the right to consume SAP data and functionality through Gateway services. This has actually changed from the initial Gateway license model. In the beginning you were required to purchase the Gateway User license on top of already paid business suite usage. SAP later recognized this as double-charging it's customer-base, and corrected this.
  3. For new users, e.g. so-called casual users that have never 'seen' the SAP GUI and have no intention to ever use that, you need to purchase the Gateway User perpetual licence. Current list-price is 1,350 USD per user.
  4. In case the new user is using Gateway indirect in context of another SAP product, e.g. Duet Enterprise or SAP Mobile, SAP provides the Gateway User License for Productivity Apps (GULPA). This license is restricted to using Gateway as part of the Duet Enterprise runtime flow or SAP Mobile product. List-price of this is set at USD 375.00, to my knowledge divided in 250 USD for Gateway usage, and 130 USD for Duet Enterprise.
  5. In case of a volatile and continuous changing user-base with anonymous users, a typical example is that of webshop customers, SAP provides a transaction-based licence model: Gateway Consumer Access License. You purchase a 'bundle' of service calls that you are allowed to invoke and consume in a calendar year. Current stock price of a bundle of 75.000 service calls is USD 450.00.

Sunday, March 9, 2014

GWPAM Rapid Deployment Service on SAP-Microsoft Unite site

Earlier I reported about our involvement in the new SAP product for direct availability of SAP data into Microsoft Office clients: SAP NetWeaver Gateway Productivity Accelerator for Microsoft, short GWPAM.
Based on the knowledge and experience that we have gained early on in applying GWPAM, we have worked out a Rapid Deployment Service for GWPAM. This RDS solution is recognized by the SAP Gateway product team, and published on the SAP-Microsoft Unite Partner Connection site.
In the Rapid Deployment Service, we combine our proven approach for successful implementation of SAP-Microsoft integration scenarios with GWPAM product knowledge. Central concepts in our approach are user-centric focus, UI-design via (preferable) clickable prototypes, integration architecture, and technical expertise with the Microsoft and SAP application platforms. Check out in case you're interested in easily bring SAP data into Microsoft based front-ends.

Saturday, February 1, 2014

On close edge with SAP Gateway product development team

The SAP Fiori suite receives welcome confirmation from end-organisations. The concept of smaller productivity Apps for dedicated business scenarios, with a modern and user-friendly UI, is largely applauded in the SAP users market. The first wave started with 25 standard Apps targeting mainly at HCM and a bit of SRM, and SAP is continuously expanding on this suite to include more scenario's.
However, SAP alone cannot deliver Apps for all scenario's that may be relevant for individual organizations. The strategy is to augment the standard SAP Fiori suite with custom-build Apps. The end-users benefit as all the productivity Apps that a Fiori customer has installed (SAP standard + custom augmentations), have the same and familiar look&feel.
I've started on such a project to build a custom SAP Fiori-like App for Invoice Approvals, a step within the process running as a SAP workflow in the backend. The customer first consulted SAP to inquire whether such an App would be on the radar as standard Fiori App. Answer is no, and SAP's advice to customer was to hire us to build it custom for them.
The customer is (rightfully) very keen on security. One of their concerns is that the confidential invoice data may not remain behind on the device.
We do not use local data storage within the Invoice Approval App. But browsers could cache received data responses. To prevent that, I want to alter the response with 'No-Cache' directions:
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Type: application/json; charset=utf-8
Expires: -1
When I could not find explanation how-to include the 'No-Cache' directions in the response of a Gateway REST service, I decided to consult a direct contact within the Gateway development team: the notorious Andre Fischer :-) The response on my request for help is a perfect example of the close collaboration of the Gateway development team with partners [playing] in the field. Not only did I receive an useful response within half an hour (!!). It turned out that Andre also on-the-spot created a page on SCN to share my question + his answer to benefit the larger Gateway development audience: How to Avoid Caching of Confidential Data.

Wednesday, November 6, 2013

Tip: Resolve from ‘Choose key from allowed namespace’ at Maintain Workflow Filter Settings

Part of the enablement of Gateway Workflow (and also of Duet Enterprise workflow, as it is a first-class subscriber of Gateway workflow), is to specify the workflow filter settings. When entering new entries in the OSP reports, the system may return the message ‘Choose the key from the allowed namespace’, with the Parameter ‘TASK’ value identified as faulty.
Strange as the value ‘TASK’ is selected from the optionlist of allowed values (others are: ALERTCAT, DELTA, and WORKFLOW_STEP). It occurred in our landscape, and I could not find anyway to avoid nor correct the indicated input error.
However, as it turns out this message is only a warning. You can ignore it to have your submitted entry successfully be added to the filter customization. Just click on the ‘Enter’ icon, and next ‘Save’.