{"id":16163354,"url":"https://github.com/gregorwolf/cap-azure-ad-b2c","last_synced_at":"2025-03-18T22:31:19.162Z","repository":{"id":37928029,"uuid":"253264996","full_name":"gregorwolf/cap-azure-ad-b2c","owner":"gregorwolf","description":"Authenticate to a CAP service using Azure AD B2C","archived":false,"fork":false,"pushed_at":"2025-03-13T06:39:30.000Z","size":1180,"stargazers_count":8,"open_issues_count":8,"forks_count":7,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-13T07:36:17.410Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gregorwolf.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":["gregorwolf"],"patreon":null,"open_collective":null,"ko_fi":"gregorwolf","tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2020-04-05T15:17:59.000Z","updated_at":"2025-03-13T06:39:34.000Z","dependencies_parsed_at":"2023-12-24T16:19:47.876Z","dependency_job_id":"c552e55c-c030-4b9a-9110-dc6d32aee779","html_url":"https://github.com/gregorwolf/cap-azure-ad-b2c","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregorwolf%2Fcap-azure-ad-b2c","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregorwolf%2Fcap-azure-ad-b2c/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregorwolf%2Fcap-azure-ad-b2c/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregorwolf%2Fcap-azure-ad-b2c/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gregorwolf","download_url":"https://codeload.github.com/gregorwolf/cap-azure-ad-b2c/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243950962,"owners_count":20373663,"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":[],"created_at":"2024-10-10T02:35:20.767Z","updated_at":"2025-03-18T22:31:18.710Z","avatar_url":"https://github.com/gregorwolf.png","language":"JavaScript","funding_links":["https://github.com/sponsors/gregorwolf","https://ko-fi.com/gregorwolf"],"categories":[],"sub_categories":[],"readme":"# Authenticate to a CAP service using Azure AD B2C\n\nThis example application demonstrates how to authenticate to a SAP Cloud Application Programming Model service using Azure AD B2C. The client UI is based on the example app [Single-Page Application built on MSAL.js with Azure AD B2C](https://github.com/Azure-Samples/active-directory-b2c-javascript-msal-singlepageapp).\n\nYou want to give it a try please store the following content in the file _default-env.json_ the root folder of this project. The B2C tenant used here is the sample tenant provided by Microsoft which is used also for their examples. As this file might include sensitive data it's not included in the git repository.\n\n```json\n{\n  \"VCAP_SERVICES\": {\n    \"xsuaa\": [\n      {\n        \"name\": \"cap-azure-ad-b2c-uaa\",\n        \"label\": \"azure-ad\",\n        \"tags\": [\"azure-ad\"],\n        \"plan\": \"space\",\n        \"credentials\": {\n          \"identityMetadata\": \"https://fabrikamb2c.b2clogin.com/fabrikamb2c.onmicrosoft.com/B2C_1_SUSI/v2.0/.well-known/openid-configuration/\",\n          \"clientID\": \"e760cab2-b9a1-4c0d-86fb-ff7084abd902\",\n          \"policyName\": \"B2C_1_SUSI\",\n          \"isB2C\": true,\n          \"validateIssuer\": true,\n          \"loggingLevel\": \"warn\",\n          \"loggingNoPII\": true,\n          \"passReqToCallback\": false\n        }\n      }\n    ]\n  },\n  \"destinations\": []\n}\n```\n\nThe configuration in app/index.html matches this settings.\n\nFor the first start you can run:\n\n```bash\nnpm run setup\n```\n\nto install the dependencies, build, deploy and start the app. It them will be reachable at http://localhost:6420/. The next time you want to start simply run:\n\n```bash\nnpm run start:local\n```\n\n# Authenticate to a CAP service using Entra ID\n\nConfig of _default-env.json_:\n\n```json\n{\n  \"VCAP_SERVICES\": {\n    \"xsuaa\": [\n      {\n        \"name\": \"cap-entra-id-csw\",\n        \"label\": \"azure-ad\",\n        \"tags\": [\"azure-ad\"],\n        \"plan\": \"space\",\n        \"credentials\": {\n          \"identityMetadata\": \"https://login.microsoftonline.com/common/v2.0/.well-known/openid-configuration\",\n          \"clientID\": \"\u003cyour-client-id\u003e\",\n          \"clientSecret\": \"\u003cyour-client-secret\u003e\",\n          \"audience\": \"\u003cyour-audience\u003e\",\n          \"issuer\": \"https://sts.windows.net/\u003cyour-tenant-id\u003e/\",\n          \"isB2C\": false,\n          \"validateIssuer\": true,\n          \"loggingLevel\": \"warn\",\n          \"loggingNoPII\": false,\n          \"passReqToCallback\": false\n        }\n      }\n    ]\n  },\n  \"destinations\": []\n}\n```\n\nConfig of _app/config.js_:\n\n```JavaScript\n// CSWEntraID\nconst azureADconfig = {\n  clientId: \"\u003cyour-client-id\u003e\",\n  authority:\n    \"https://login.microsoftonline.com/\u003cyour-tenant-id\u003e\",\n};\n```\n\n## Deploy to Kyma\n\nDownload the kubeconfig from your Kyma instance via the menu behind the account Icon in the upper right corner. Save it in _~/.kube/kubeconfig-kyma.yml_. Then run:\n\n`export KUBECONFIG=~/.kube/kubeconfig-kyma.yml`\n\nPlease note that the token in the kubeconfig is [only valid for 8 hours](https://kyma-project.io/docs/components/security#details-iam-kubeconfig-service). So you might have to redo the download whenever you want to run the commands again.\n\nTo keep this project separate from your other deployments I would suggest to create a namespace:\n\n```bash\nkubectl create namespace cap-azure-ad-b2c\n```\n\nDeploy the configuration:\n\n```bash\nkubectl -n cap-azure-ad-b2c apply -f kyma/deployment.yaml\n```\n\nUpdate the container:\n\n```bash\nkubectl -n cap-azure-ad-b2c rollout restart deployment/cap-azure-ad-b2c\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregorwolf%2Fcap-azure-ad-b2c","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgregorwolf%2Fcap-azure-ad-b2c","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregorwolf%2Fcap-azure-ad-b2c/lists"}