简体   繁体   English

如何在没有任何授权令牌的情况下将 Azure API 用于 FHIR 服务器

[英]How to use Azure API for FHIR Server without any authorization token

I have created a resource for Azure API for FHIR Server .为 FHIR Server 的 Azure API创建了一个资源。 I am able to get see the metadata information using the URL like https://fhir-server-url/metadata .我可以使用像https://fhir-server-url/metadata这样的 URL 来查看元数据信息。 As mentioned in the documentation https://docs.microsoft.com/en-us/azure/healthcare-apis/access-fhir-postman-tutorial to access other URLs like https://fhir-server-url/Patient , we need to get the Authorization token first.正如文档中提到的https://docs.microsoft.com/en-us/azure/healthcare-apis/access-fhir-postman-tutorial访问其他 URL,如https://fhir-server-url/Patient ,我们需要先获取授权令牌。 To get the authorization token we need ClientID which we can get by creating an application in Azure Active Directory.要获取授权令牌,我们需要 ClientID,我们可以通过在 Azure Active Directory 中创建应用程序来获取它。 But I don't have access to it.但我无权访问它。

Is there any way I could access this URL without requiring the authorization token?有什么方法可以在不需要授权令牌的情况下访问此 URL? By making some setup in Azure Portal.通过在 Azure 门户中进行一些设置。

If you are using the first party audience (eg https://azurehealthcareapis ), which is the default when deploying the Azure API for FHIR, you can actually use a first party client application such as the Azure CLI to get a token.如果您使用第一方受众(例如https://azurehealthcareapis ),这是为 FHIR 部署 Azure API 时的默认设置,您实际上可以使用第一方客户端应用程序(例如 Azure CLI)来获取令牌。 Check https://docs.microsoft.com/azure/healthcare-apis/get-healthcare-apis-access-token-cli for details.查看https://docs.microsoft.com/azure/healthcare-apis/get-healthcare-apis-access-token-cli了解详细信息。

First log in with the Azure CLI ( https://docs.microsoft.com/cli/azure/?view=azure-cli-latest ) :首先使用 Azure CLI ( https://docs.microsoft.com/cli/azure/?view=azure-cli-latest ) 登录:

az login

Get a token and store it获取令牌并存储它

token=$(az account get-access-token --resource=https://azurehealthcareapis.com | jq -r .accessToken)

Use the token:使用令牌:

curl -X GET --header "Authorization: Bearer $token" https://<FHIR ACCOUNT NAME>.azurehealthcareapis.com/Patient

It looks like from the FHIR Server Doc you can turn this on or off based on the FhirServer:Security:Enabled config setting see https://github.com/microsoft/fhir-server/blob/master/docs/Authentication.md从 FHIR Server Doc 看来,您可以根据FhirServer:Security:Enabled配置设置打开或关闭此功能,请参阅https://github.com/microsoft/fhir-server/blob/master/docs/Authentication.md

"FhirServer" : {
"Security": {
    "Enabled":  true,
    "Authentication": {
        "Audience": "fhir-api",
        "Authority": "https://localhost:44348"
    }
}}

One way is to get your app registration in Azure Active Directory(AAD).一种方法是在 Azure Active Directory (AAD) 中注册您的应用程序。

You would need two app registrations in AAD to get client Id & client secret for authorization token retrieval.您需要在 AAD 中注册两个应用程序才能获取客户端 ID 和客户端密钥以检索授权令牌。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM