Fiori Custom Launchpad for HANA XS with Session Management (login and logout)
- Having HANA XS Engine. ( As Fiori Launchpad plugin not available need for custom Launchpad type app required)
- Single entry point was not available for all user or all same role based apps (Landing Page for role based user)
- Provide group of tiles on basis of user role.
- Getting details of logged in user.
- Session management was difficult (Options for Login and Logout).
Below is my way to Design Custom Launchpad and solve my problems.
- Designed UI like Launchpad using unified Shell and other components.
- Managed user role on backend using custom table and on basis of user role group of tiles are available on custom Launchpad.
- Most important session management done by CSRF token (Debugged HANA XS session and applied same).
UI Design for Custom Launchpad:
Steps to design Custom Launchpad like UI
- Index.html (same as standard one)
- Main View (Main.view.xml)
- View design using Unified Shell (sap.ui.unified.shell)
- Provide Home Icon, User Icon with Username, Logoff Icon, Center Text and Notification Icon (for centralized notification for user if required).
- Component.js page specify only root view.
- Without routing with only root view.
Application view with Shell only:
- For Routing use SAP Standard routing file :
- Specify routing in component.js and initiate routing
- Specify target control “idAppControl”.
- For simple application specify targetAggregation “curtainContent” and hide master view .( hide curtainPaneContent)
- And for Split application use both curtainContent and curtainPaneContent. For Master Details targerAggregation will be curtainPaneContent and for Item details targetAggregation will be curtainContent.
- Specify tile group in Home.view.xml (on basis of user role tiles will be displayed)
- Getting list of tile by calling XSJS services on initialization of Home view.
- This view is not Master & Item view (not a split app) so hide master view.
- So view will be displayed in full page.
- setShowCurtainPane(false) used to hide master view.
- Page will be like
- Now when you click tile Leave App it will route to Leave app view as below
- Routing will be same as did for home page.
Session Management (Get Logged on User, Login and Logout):
- For Fiori Standard Login Page specify Authentication method in .XSaccess file in Launch pad package.
- So when you access Launchpad it will direct to Fiori Launch pad
- So when you specify correct credential it will direct to Custom Launchpad (or Landing Page).
- When we login at the time in backend unique CSRF token is generated and all session management is done using same CSRF token.
- Now getting logged in User details
- Using CSRF Token we can get logged in User details as shown below.
- When we call get username it will first get current CSRF token and using that CSRF token it is getting logged in user name. as shown in below Debugging :
- Get Username from calling getUSername and bind it with Custom Launchpad user section.
- In Custom Launchpad package .XSaccess authentication method is specified so in between if you try to access any view and if session is not started or session is destroyed it will direct to Fiori standard login page.
- Logout or terminate session :
- By pressing on logout icon from Launchpad it will call logout function.
- And logout function will get current CSRF Token and terminate session.
- As shown in below debugging :
- And again it will direct to Fiori standard login Page.
Getting group of Tiles on Basis User role:
- After getting name of user get role of user and on basis of that display group of tiles on Launchpad.
- In my case I created custom table and role based apps is specified.
- So at time of initialization I get group of tiles from custom tables using XSJS service and bind with tile container.
- And also give specific package privilege to user on depending their role.
- Like as shown in below.
- And if user do not have assigned privilege to Launchpad or try to direct access to not assigned app it will direct below page.
I hope this will helpful. 🙂
Will update code on github soon.
Happy Coding .. 🙂 Have a nice day (y)