Bearer

使用Bearer中间件,通过验证Bearer token来确保HTTP端点的安全

The bearer HTTP middleware verifies a Bearer Token using OpenID Connect on a Web API without modifying the application. 这种设计将认证/授权的关注点从应用中分离出来,因此应用操作者可以采用和配置认证/授权提供者,而不影响应用代码。

配置

  1. apiVersion: dapr.io/v1alpha1
  2. kind: Component
  3. metadata:
  4. name: bearer-token
  5. spec:
  6. type: middleware.http.bearer
  7. version: v1
  8. metadata:
  9. - name: clientId
  10. value: "<your client ID>"
  11. - name: issuerURL
  12. value: "https://accounts.google.com"

元数据字段规范

字段详情Example
clientId你的应用程序的客户端ID,它是作为OpenID Connect平台托管的凭证的一部分创建的
issuerURL服务的URL标识https://accounts.google.com, https://login.salesforce.com

Dapr配置

To be applied, the middleware must be referenced in configuration. See middleware pipelines.

  1. apiVersion: dapr.io/v1alpha1
  2. kind: Configuration
  3. metadata:
  4. name: appconfig
  5. spec:
  6. httpPipeline:
  7. handlers:
  8. - name: bearer-token
  9. type: middleware.http.bearer

相关链接