[SAP HANA Academy] Live3: Web Services Authorization
[Update: April 5th, 2016 – The Live3 on HCP tutorial series was created using the SAP HANA Cloud Platform free developer trial landscape in January 2015. The HCP landscape has significantly evolved over the past year. Therefore one may encounter many issues while following along with the series using the most recent version of the free developer trail edition of HCP.]
Continuing the Live3 on HCP series the SAP HANA Academy’s Philip Mugglestone details how to configure the authorizations for the web services aspect of the Live3 application. Philip will define application privileges and user roles. Check out Philip’s video below.
(0:20 – 5:05) Adding and Configuring the .xsprivileges and user.hadrole File
Picking up from the previous video Philip first removes the index.html file from the live3 project in the SAP Web-based Development Workbench. Next he opens the services folder from the Live3 code repository on GitHub and select the user.hdbrole and the .xsprivileges files. Then he drags and drops the files into the Multi-File Drop Zone on the SAP HANA Web-based Development Workbench. This will automatically install and run the files on the server.
The .xsprivileges file gives the privilege to run the application called execute. The user.hdbrole file creates a role that has access to tables and views. The code has failed as currently it’s just boiler plate code with a template account and schema name. So insert your personal trial account name in both places and paste in your schema name into the two marked lines in the code. Hitting the save button will save the role.
(5:05 – 9:30) – Setting the Proper Authorization for the HDB Role
Next Philip makes sure that the .xsaccess file specifies that the user has the proper role before they can use the application. Drag and drop the .xsaccess file into SAP HANA Web-based Development Workbench and then hit f5 to re-execute. Now the .xsaccess file will have a comment instructing you to paste in your trial name. After pasting and save the file now the authentication method will be form based. However, in the HCP developer trail edition the authentication will be done automatically.
Now we will use another specific HCP stored procedure to authorize a user to this HDB role. Open the 06 setupAuthorizations.sql file from the scripts GitHub folder and paste the lines of code into a new SQL console in Eclipse. Make sure you add your p trial account number before executing the call in your SAP HANA system to successfully grant the role.
Follow along with the Live3 on HCP course here.
SAP HANA Academy over 900 free tutorial videos on using SAP HANA and SAP HANA Cloud Platform.