How to make a public portal with external SAPUI5 applications
In this post we’re going to see the SAP Cloud Platform Portal service. It’s commonly know because of his use as intern corporative Portal for employees, but in this case we’re going to use it as extern Portal, having in addition extern UI5 applications.
What you should know before starting:
This is a good solution if your portal does not need any kind of users registration. If you are working with a trial account you can find some problems joining these two factors as it is a free product and it may not have some aspects covered.
As we only want to show the idea we’re going to use a template portal to do the demonstration, but you can do it over your own portal.
We’re going to use NEO environment but Cloud Foundry could be used as well.
If you’re not familiar with this or it’s your first portal you can take a look at these tutorials:
- NEO Environment: https://developers.sap.com/mission.cp-portal-get-started.html
- Cloud Foundry Environment: https://developers.sap.com/tutorials/cp-portal-cloud-foundry-getting-started.html
STEP 1: MAKING YOUR PORTAL PUBLIC
You’ll need to open a private session window on your browser or just open another browser where your SAP account isn’t logged in. Just try the URL of your published Portal in the browser. This way we’ll see if our page is visible for other users.
If we try it right now, this is what will happen:
The page is not public yet, so SAP asks us to log in (with an account with permission) to see the content.
The first thing we need to do is to enter in the Portal editing mode → content management → catalogs.
Here we’re going to create a new catalog called Guests (for example).
In the second option (applications) we have to click the plus sign and select the name of our portal from the list.
In the third and last option we have to assign the role ‘Anonymous’ to our new catalog.
If we publish again our Portal we will see that now it’s public. (Remember to check it in a browser where you are not logged in)
STEP 2: MAKING YOUR APP PUBLIC
Now we have our SAP Portal public and everyone can see it, but what if we have an app linked to it? Could we see it if we weren’t logged in? And more important thing, does it make sense to have an anonym app in SAPUI5? Well, clearly not in a typical corporative Portal where the employees are the ones that need to have access to, but it can happen that we need to deal with public Portals where we need to link maybe a contact form, or to show some interactive graphics, some kind of events schedule,… which everyone has access to.
Let’s show how to do that.
When we develop an app it’s independent of our Portal, we’ve to specify the authentication method and the correspondent role. So you need to add the app to our new catalog as well.
This may look enough, but if we try to access to our app, this is the result:
A pop-up warning us about something going wrong with our app. That’s because we need to specify the authentication method mentioned before.
Go to your app code, select the ‘NEO-app.json’ file and add the following sentence:
Don’t forget to deploy your app to SCP in order to update the Portal version of your app. After that everyone can access your app.
And that’s all. Now we have our public Portal located in SAP Cloud Platform with SAPUI5 anonym applications as well.
In other post we will see how to link the portal to a corporate domain, a couple of options to send mail notifications and how to use the SCP Hana service as backend architecture.