cancel
Showing results for 
Search instead for 
Did you mean: 

$.Session.securityContext not returning scopes

former_member337435
Participant
0 Kudos
578

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
    type: com.sap.xs.uaa
    parameters:
      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.setBody(body);
    $.response.status = $.net.http.OK;
    oConn.close();
} 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?

Accepted Solutions (0)

Answers (0)