Skip to content

Commit

Permalink
Merge branch 'dev' into yiqingzhao/activate
Browse files Browse the repository at this point in the history
  • Loading branch information
yiqing-zhao committed Jun 19, 2024
2 parents c4bd30e + ec004ad commit 033463d
Show file tree
Hide file tree
Showing 11 changed files with 67 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -281,10 +281,6 @@ export const inputsToTemplateName: Map<{ [key: string]: any }, TemplateNames> =
{ [QuestionNames.Capabilities]: CapabilityOptions.aiAssistantBot().id },
TemplateNames.AIAssistantBot,
],
[
{ [QuestionNames.Capabilities]: CapabilityOptions.copilotPluginNewApi().id },
TemplateNames.ApiPluginFromScratch,
],
[
{
[QuestionNames.Capabilities]: CapabilityOptions.m365SearchMe().id,
Expand Down Expand Up @@ -355,4 +351,26 @@ export const inputsToTemplateName: Map<{ [key: string]: any }, TemplateNames> =
},
TemplateNames.CustomCopilotAssistantAssistantsApi,
],
// Copilot Plugin
[
{
[QuestionNames.Capabilities]: CapabilityOptions.copilotPluginNewApi().id,
[QuestionNames.ApiAuth]: ApiAuthOptions.none().id,
},
TemplateNames.ApiPluginFromScratch,
],
[
{
[QuestionNames.Capabilities]: CapabilityOptions.copilotPluginNewApi().id,
[QuestionNames.ApiAuth]: ApiAuthOptions.apiKey().id,
},
TemplateNames.ApiPluginFromScratchBearer,
],
[
{
[QuestionNames.Capabilities]: CapabilityOptions.copilotPluginNewApi().id,
[QuestionNames.ApiAuth]: ApiAuthOptions.oauth().id,
},
TemplateNames.ApiPluginFromScratchOAuth,
],
]);
Original file line number Diff line number Diff line change
Expand Up @@ -934,6 +934,42 @@ const V3Version = MetadataV3.projectVersion;
const res = await coordinator.create(v3ctx, inputs);
assert.isTrue(res.isOk());
});

it("create API Plugin with api-key auth (feature flag enabled)", async () => {
const v3ctx = createContext();
v3ctx.userInteraction = new MockedUserInteraction();

const inputs: Inputs = {
platform: Platform.VSCode,
folder: ".",
[QuestionNames.ProjectType]: ProjectTypeOptions.copilotPlugin().id,
[QuestionNames.Capabilities]: CapabilityOptions.copilotPluginNewApi().id,
[QuestionNames.ApiAuth]: ApiAuthOptions.apiKey().id,
[QuestionNames.ProgrammingLanguage]: "javascript",
[QuestionNames.AppName]: randomAppName(),
[QuestionNames.Scratch]: ScratchOptions.yes().id,
};
const res = await coordinator.create(v3ctx, inputs);
assert.isTrue(res.isOk());
});

it("create API Plugin with OAuth (feature flag enabled)", async () => {
const v3ctx = createContext();
v3ctx.userInteraction = new MockedUserInteraction();

const inputs: Inputs = {
platform: Platform.VSCode,
folder: ".",
[QuestionNames.ProjectType]: ProjectTypeOptions.copilotPlugin().id,
[QuestionNames.Capabilities]: CapabilityOptions.copilotPluginNewApi().id,
[QuestionNames.ApiAuth]: ApiAuthOptions.oauth().id,
[QuestionNames.ProgrammingLanguage]: "javascript",
[QuestionNames.AppName]: randomAppName(),
[QuestionNames.Scratch]: ScratchOptions.yes().id,
};
const res = await coordinator.create(v3ctx, inputs);
assert.isTrue(res.isOk());
});
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@
}
],
"identifierUris": [
"api://${{OPENAPI_SERVER_DOMAIN}}/${{AAD_APP_CLIENT_ID}}"
"api://${{AAD_APP_CLIENT_ID}}"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ components:
authorizationUrl: https://login.microsoftonline.com/${{AAD_APP_TENANT_ID}}/oauth2/v2.0/authorize
tokenUrl: https://login.microsoftonline.com/${{AAD_APP_TENANT_ID}}/oauth2/v2.0/token
scopes:
repairs_read: Read repair records
api://${{AAD_APP_CLIENT_ID}}/repairs_read: Read repair records

paths:
/repairs:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ resource functionApp 'Microsoft.Web/sites@2021-02-01' = {
}
var apiEndpoint = 'https://${functionApp.properties.defaultHostName}'
var oauthAuthority = uri(aadAppOauthAuthorityHost, aadAppTenantId)
var aadApplicationIdUri = 'api://${functionApp.properties.defaultHostName}/${aadAppClientId}'
var aadApplicationIdUri = 'api://${aadAppClientId}'

// Configure Azure Functions to use Azure AD for authentication.
resource authSettings 'Microsoft.Web/sites/config@2021-02-01' = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@
}
],
"identifierUris": [
"api://${{OPENAPI_SERVER_DOMAIN}}/${{AAD_APP_CLIENT_ID}}"
"api://${{AAD_APP_CLIENT_ID}}"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ components:
authorizationUrl: https://login.microsoftonline.com/${{AAD_APP_TENANT_ID}}/oauth2/v2.0/authorize
tokenUrl: https://login.microsoftonline.com/${{AAD_APP_TENANT_ID}}/oauth2/v2.0/token
scopes:
repairs_read: Read repair records
api://${{AAD_APP_CLIENT_ID}}/repairs_read: Read repair records
paths:
/repairs:
get:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ resource functionApp 'Microsoft.Web/sites@2021-02-01' = {
}
var apiEndpoint = 'https://${functionApp.properties.defaultHostName}'
var oauthAuthority = uri(aadAppOauthAuthorityHost, aadAppTenantId)
var aadApplicationIdUri = 'api://${functionApp.properties.defaultHostName}/${aadAppClientId}'
var aadApplicationIdUri = 'api://${aadAppClientId}'

// Configure Azure Functions to use Azure AD for authentication.
resource authSettings 'Microsoft.Web/sites/config@2021-02-01' = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@
}
],
"identifierUris": [
"api://${{OPENAPI_SERVER_DOMAIN}}/${{AAD_APP_CLIENT_ID}}"
"api://${{AAD_APP_CLIENT_ID}}"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ components:
authorizationUrl: https://login.microsoftonline.com/${{AAD_APP_TENANT_ID}}/oauth2/v2.0/authorize
tokenUrl: https://login.microsoftonline.com/${{AAD_APP_TENANT_ID}}/oauth2/v2.0/token
scopes:
repairs_read: Read repair records
api://${{AAD_APP_CLIENT_ID}}/repairs_read: Read repair records
paths:
/repairs:
get:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ resource functionApp 'Microsoft.Web/sites@2021-02-01' = {
}
var apiEndpoint = 'https://${functionApp.properties.defaultHostName}'
var oauthAuthority = uri(aadAppOauthAuthorityHost, aadAppTenantId)
var aadApplicationIdUri = 'api://${functionApp.properties.defaultHostName}/${aadAppClientId}'
var aadApplicationIdUri = 'api://${aadAppClientId}'

// Configure Azure Functions to use Azure AD for authentication.
resource authSettings 'Microsoft.Web/sites/config@2021-02-01' = {
Expand Down

0 comments on commit 033463d

Please sign in to comment.