Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Entra ID OAuthe2 token support #29032

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,18 @@ using TypeSpec.Versioning;
endpoint: url,
}
)
@useAuth(AzureKey)
@useAuth(AzureKey | EntraIdToken)
namespace AzureHealthInsights;

@doc("The secret key for your Azure Cognitive Services subscription.")
model AzureKey
is ApiKeyAuth<ApiKeyLocation.header, "Ocp-Apim-Subscription-Key">;

#suppress "@azure-tools/typespec-azure-core/casing-style" "Supress casing style for AAD"
asaflevi-ms marked this conversation as resolved.
Show resolved Hide resolved
@doc("The Microsoft Entra Id Flow")
model EntraIdToken
is Azure.Core.AadOauth2Auth<["https://cognitiveservices.azure.com/.default"]>;

#suppress "@azure-tools/typespec-azure-core/documentation-required" "https://github.com/Azure/typespec-azure/issues/3107"
enum ApiVersion {
@useDependency(Azure.Core.Versions.v1_0_Preview_2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@
"security": [
{
"AzureKey": []
},
{
"EntraIdToken": [
"https://cognitiveservices.azure.com/.default"
]
}
],
"securityDefinitions": {
Expand All @@ -45,6 +50,16 @@
"description": "The secret key for your Azure Cognitive Services subscription.",
"name": "Ocp-Apim-Subscription-Key",
"in": "header"
},
"EntraIdToken": {
"type": "oauth2",
"description": "The Azure Active Directory OAuth2 Flow",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Azure Active Directory is now Microsoft Entra ID https://learn.microsoft.com/en-us/entra/fundamentals/how-to-rename-azure-ad

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vicancy .
Is this what you meant ?

"flow": "accessCode",
"authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize",
"scopes": {
"https://cognitiveservices.azure.com/.default": ""
},
"tokenUrl": "https://login.microsoftonline.com/common/oauth2/token"
}
},
"tags": [
Expand Down Expand Up @@ -279,6 +294,10 @@
}
}
},
"Azure.Core.RequestIdResponseHeader": {
"type": "object",
"description": "Provides the 'x-ms-request-id' header to enable request correlation in responses."
},
"ClinicalDocumentType": {
"type": "string",
"description": "The type of the clinical document.",
Expand Down Expand Up @@ -2108,10 +2127,23 @@
"error": {
"$ref": "#/definitions/Azure.Core.Foundations.Error",
"description": "The error object."
},
"requestId": {
"type": "object",
"description": "An opaque, globally-unique, server-generated string identifier for the request.",
"properties": {
"response": {
"$ref": "#/definitions/Azure.Core.RequestIdResponseHeader"
}
},
"required": [
"response"
]
}
},
"required": [
"error"
"error",
"requestId"
Copy link
Member

@weidongxu-microsoft weidongxu-microsoft Jun 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see where these changes comes from.

There is no update to typespec file about these in this PR? -- maybe caused by the conflict in branch?

Copy link
Member Author

@asaflevi-ms asaflevi-ms Jun 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@weidongxu-microsoft
Correct.
Fixed by merge from main.

]
},
"ImagingProcedure": {
Expand Down