From 4279fad152aa40925f5e21b3402156474ea8f7f0 Mon Sep 17 00:00:00 2001 From: Yimin-Jin Date: Tue, 14 Jan 2025 10:36:41 +0800 Subject: [PATCH] fix: fix aad.manifest for da templates --- .../aad.manifest.json.tpl | 91 ++++++++++--------- .../aad.manifest.json.tpl | 2 +- 2 files changed, 51 insertions(+), 42 deletions(-) diff --git a/templates/js/api-plugin-from-scratch-oauth/aad.manifest.json.tpl b/templates/js/api-plugin-from-scratch-oauth/aad.manifest.json.tpl index 240c4327ab..16399369cf 100644 --- a/templates/js/api-plugin-from-scratch-oauth/aad.manifest.json.tpl +++ b/templates/js/api-plugin-from-scratch-oauth/aad.manifest.json.tpl @@ -1,9 +1,43 @@ { "id": "${{AAD_APP_OBJECT_ID}}", "appId": "${{AAD_APP_CLIENT_ID}}", - "name": "{{appName}}-aad", - "accessTokenAcceptedVersion": 2, + "displayName": "{{appName}}-aad", + "identifierUris": [ +{{#MicrosoftEntra}} + "api://${{OPENAPI_SERVER_DOMAIN}}/${{AAD_APP_CLIENT_ID}}", + "${{AADAUTHCODE_APPLICATION_ID_URI}}" +{{/MicrosoftEntra}} +{{^MicrosoftEntra}} + "api://${{AAD_APP_CLIENT_ID}}" +{{/MicrosoftEntra}} + ], "signInAudience": "AzureADMyOrg", + "api": { + "requestedAccessTokenVersion": 2, + "oauth2PermissionScopes": [ + { + "adminConsentDescription": "Allows Copilot to read repair records on your behalf.", + "adminConsentDisplayName": "Read repairs", + "id": "${{AAD_APP_ACCESS_AS_USER_PERMISSION_ID}}", + "isEnabled": true, + "type": "User", + "userConsentDescription": "Allows Copilot to read repair records.", + "userConsentDisplayName": "Read repairs", + "value": "repairs_read" + } + ], +{{#MicrosoftEntra}} + "preAuthorizedApplications": [ + { + "appId": "ab3be6b7-f5df-413d-ac2d-abf1e3fd9c0b", + "delegatedPermissionIds": [ + "${{AAD_APP_ACCESS_AS_USER_PERMISSION_ID}}" + ] + } + ] +{{/MicrosoftEntra}} + }, + "info": {}, "optionalClaims": { "idToken": [], "accessToken": [ @@ -16,46 +50,21 @@ ], "saml2Token": [] }, - "oauth2Permissions": [ - { - "adminConsentDescription": "Allows Copilot to read repair records on your behalf.", - "adminConsentDisplayName": "Read repairs", - "id": "${{AAD_APP_ACCESS_AS_USER_PERMISSION_ID}}", - "isEnabled": true, - "type": "User", - "userConsentDescription": "Allows Copilot to read repair records.", - "userConsentDisplayName": "Read repairs", - "value": "repairs_read" - } - ], -{{#MicrosoftEntra}} - "preAuthorizedApplications": [ - { - "appId": "ab3be6b7-f5df-413d-ac2d-abf1e3fd9c0b", - "permissionIds": [ - "${{AAD_APP_ACCESS_AS_USER_PERMISSION_ID}}" - ] - } - ], -{{/MicrosoftEntra}} - "replyUrlsWithType": [ - { -{{#MicrosoftEntra}} - "url": "https://teams.microsoft.com/api/platform/v1.0/oAuthConsentRedirect", -{{/MicrosoftEntra}} -{{^MicrosoftEntra}} - "url": "https://teams.microsoft.com/api/platform/v1.0/oAuthRedirect", -{{/MicrosoftEntra}} - "type": "Web" - } - ], - "identifierUris": [ + "publicClient": { + "redirectUris": [] + }, + "web": { + "redirectUris": [ {{#MicrosoftEntra}} - "api://${{OPENAPI_SERVER_DOMAIN}}/${{AAD_APP_CLIENT_ID}}", - "${{AADAUTHCODE_APPLICATION_ID_URI}}" + "https://teams.microsoft.com/api/platform/v1.0/oAuthConsentRedirect" {{/MicrosoftEntra}} {{^MicrosoftEntra}} - "api://${{AAD_APP_CLIENT_ID}}" + "https://teams.microsoft.com/api/platform/v1.0/oAuthRedirect" {{/MicrosoftEntra}} - ] -} \ No newline at end of file + ], + "implicitGrantSettings": {} + }, + "spa": { + "redirectUris": [] + } +} diff --git a/templates/ts/api-plugin-from-scratch-oauth/aad.manifest.json.tpl b/templates/ts/api-plugin-from-scratch-oauth/aad.manifest.json.tpl index d210bbeceb..16399369cf 100644 --- a/templates/ts/api-plugin-from-scratch-oauth/aad.manifest.json.tpl +++ b/templates/ts/api-plugin-from-scratch-oauth/aad.manifest.json.tpl @@ -34,7 +34,7 @@ "${{AAD_APP_ACCESS_AS_USER_PERMISSION_ID}}" ] } - ], + ] {{/MicrosoftEntra}} }, "info": {},