{"id":16190865,"url":"https://github.com/vobu/cds-entra-id","last_synced_at":"2025-03-19T03:30:59.856Z","repository":{"id":220176849,"uuid":"750946822","full_name":"vobu/cds-entra-id","owner":"vobu","description":"Microsoft Entra ID Authorization extension for SAP Cloud Application Programming Model","archived":false,"fork":false,"pushed_at":"2024-09-17T18:56:09.000Z","size":371,"stargazers_count":6,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-28T15:11:33.318Z","etag":null,"topics":["authz","cap","cds","entra-id","sap"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vobu.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-31T16:28:44.000Z","updated_at":"2024-06-24T13:46:39.000Z","dependencies_parsed_at":"2024-10-27T19:40:41.051Z","dependency_job_id":"9676a413-3a68-4d9e-a56d-20c683521a70","html_url":"https://github.com/vobu/cds-entra-id","commit_stats":null,"previous_names":["vobu/cds-entra-id"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vobu%2Fcds-entra-id","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vobu%2Fcds-entra-id/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vobu%2Fcds-entra-id/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vobu%2Fcds-entra-id/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vobu","download_url":"https://codeload.github.com/vobu/cds-entra-id/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243965717,"owners_count":20375920,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["authz","cap","cds","entra-id","sap"],"created_at":"2024-10-10T07:44:20.493Z","updated_at":"2025-03-19T03:30:59.605Z","avatar_url":"https://github.com/vobu.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cds-entra-id\n\nA SAP Cloud Application Programming Model (CAP) plugin to map Entra ID *authorization* to the `cds.User` scope.\n\nIt is intended as a drop-in **authorization** mapper for a CAP app running on Azure AppServices - not (!) locally. The plugin *does not support any authentication flow*, but the mapping of Entra ID artefacts to CAP roles for declarative authorization.\n\n## Requirements\n\n:exclamation: Your CAP app must be protected by [OAuth 2.0 authorization with Microsoft Entra ID](https://learn.microsoft.com/en-us/entra/architecture/auth-oauth2), configured via the `App Service` → `Settings` → `Authentication`\n\nBoth `Entra ID Groups` (https://learn.microsoft.com/en-us/entra/identity-platform/optional-claims#configure-groups-optional-claims) and `App roles` https://learn.microsoft.com/en-us/security/zero-trust/develop/configure-tokens-group-claims-app-roles  are supported to be subsequentially used for annotation in CDS files.\n\n## Installation + Configuration\n\n```shell\nnpm i --save cds-entra-id\n```\n\nThen tell your CAP app to use this plugin (see https://cap.cloud.sap/docs/node.js/cds-env#sources-for-cds-env for possible config file locations and configuration options).\n\nE.g. in `./.cdsrc.json`:\n\n```json\n{\n  \"requires\": {\n    \"auth\": {\n      \"[development]\": { // \u003c-- let's keep local dev as is\n        \"kind\": \"mocked\"\n      },\n      \"[production]\": { // \u003c-- grow as you go when deployed to Azure\n        \"impl\": \"cds-entra-id\"\n      }\n    }\n  }\n}\n```\n\nFor Debugging purposes, you can set the enviornment variable `DEBUG=cds-entra-id` as with [all CAP `DEBUG` options](https://cap.cloud.sap/docs/node.js/cds-log#debug-env-variable).\n\n## Usage\n\nAnnotate your `.cds` services as usual:\n\n```cds\nservice its {\n    @(requires: 'authenticated-user')\n    function ok() returns String;\n    @(requires: ['7b428506-466b-45b0-9cbf-4e1b20734874', 'test-app-role'])\n    function nok() returns String;\n}\n```\n\nThe function import `ok()` requires any authenticated user, no matter the role or group.\n\nHowever, `nok()` requires the logged in user \n\n- to be a member of the `Entra ID` group '7b428506-466b-45b0-9cbf-4e1b20734874' or\n- a member of the `App role` 'test-app-role'.\n\nWhy a GUID for an Entra ID group and not a regular name? Entra ID passes out group memberships only as GUIDs in order to prevent wrongful impersonation. As the note on https://learn.microsoft.com/en-us/entra/identity/hybrid/connect/how-to-connect-fed-group-claims explains: \n\n\u003e \"a group name is not unique, and display names can only be emitted for groups explicitly assigned to the application to reduce the security risks. Otherwise, any user could create a group with duplicate name and gain access in the application side.\"\n\nThe same website also states:\n\n\u003e When you're using group membership for in-application authorization, it's preferable to use the group `ObjectID` attribute. The group `ObjectID` attribute is immutable and unique in Microsoft Entra ID. It's available for all groups.\n\nAnd that's why `cds-entra-id` supports GUIDs for Entra ID group authorizations.\n\nThe `App roles` are app-specific (and not valid Entra ID-wide). They are relayed as regular names and can be used as such for CDS annotations.\n\n## Under the hood :blue_car:\n\nThe plugin parses the OAuth 2.0 claims into proper CAP User objects.\n\nAdditionally, it has no Node.js module dependencies - yay.\n\n## Contributing\n\n:computer: hack away and PR!\n\n- please use [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) so the changelog can be auto-generated. Their usage here is guarded by :dog: [husky](https://typicode.github.io/husky/).\n- please format the code w/ [Prettier](https://prettier.io). A `.prettierrc` is in the repo.\n\n## License\n\nThis work is dual-licensed under Apache 2.0 and the Derived Beer-ware 🍺 License. The official license will be Apache 2.0 but finally you can choose between one of them if you use this work.\n\nThus, when you like this stuff, buy [any (or all 😆) of the contributors](https://github.com/ui5-community/wdi5/graphs/contributors) a beer when you see them.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvobu%2Fcds-entra-id","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvobu%2Fcds-entra-id","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvobu%2Fcds-entra-id/lists"}