Showing results for 
Search instead for 
Did you mean: 

$.Session.securityContext not returning scopes

0 Kudos

Hello ,

I have built an XSA Application and trying to secure the UI5 application with UAA.

I have created a xs-security.json file which has the roles and these roles are linked to UAA. The below code snippet is from mta.yaml file

  - name: UAA-service_test1
      path: xs-security.json

The userContext.xsjs is in the below code snippet and is called in the App Controller.js

/*eslint no-console: 0, no-unused-vars: 0, dot-notation: 0, no-use-before-define: 0, no-redeclare: 0*/
"use strict";
    var oConn = $.hdb.getConnection(); 
try {
 //    Initialize hana connection/context

    var oSession = $.session;
    var body = JSON.stringify($.session);
    $.response.contentType = "application/json"; 
    $.response.status = $.net.http.OK;
} catch(ex) {
//     Return error
   $.response.setBody("Failed to retrieve data");
   $.response.status = $.net.http.INTERNAL_SERVER_ERROR;

The UI5 app in the XSA cockpit is bound to UAA .I am able to see the scopes and Roles in XSA cockpit. The roles are assigned to a Role Collection and the Role collection is assigned to the user.

When userContext.xsjs is called through UI5, its not returning anything for securityContext.

$.session is retruning user and language but not security Context ..Do I need to do anything else to return scopes from securityContext?

Active Contributor
0 Kudos

in xsa, why you are still using xsjs?

0 Kudos

Hello jun.wu5 , This is an already built application. We are just trying to set up security for each of the tiles available in the MTA Application.

We are able to see the roles and scopes in the application in Cockpit. I have created a Role collection and add the roles as well and the role collection is assigned to my id. But I am not getting the $.Session.securityContext in xsjs

Active Contributor
0 Kudos

only a few lines of code, you can easily get rid of it. do it correctly with node js, not outdated xsjs.

Accepted Solutions (0)

Answers (0)