if(재능이 없으면 시간으로 극복하라){return 성공;}

SAP BTP - XSUAA를 설치하여 인증하기

프로젝트에서 아래 명령어 실행

cds add xsuaa  --for production

package.json에 xsuaa 추가됨 image

기존의 app내에 xs-security.json 파일이 생기고 기존에 만들었던 역할은 범위(scope)에 대해서는 설정하지 못하기 때문에 xsuaa의 xs-security.json 파일을 이용하여 scope를 설정하는 것이다.

기존에 만들었던 권한 설정

using { sap.ui.riskmanagement as my } from '../db/schema';

@path: 'service/risk'
service RiskService {
  entity Risks @(restrict : [
            {
                grant : [ 'READ' ],
                to : [ 'RiskViewer' ]
            },
            {
                grant : [ '*' ],
                to : [ 'RiskManager' ]
            }
    ]) as projection on my.Risks;
    annotate Risks with @odata.draft.enabled;
  entity Mitigations @(restrict : [
            {
                grant : [ 'READ' ],
                to : [ 'RiskViewer' ]
            },
            {
                grant : [ '*' ],
                to : [ 'RiskManager' ]
            }
    ])as projection on my.Mitigations;
    annotate Mitigations with @odata.draft.enabled;
}