user-security

user-security 策略可用于抽取用户凭证、对这些凭证进行认证以及获取来自用户的授权。

网关支持

表 1. 该表显示了支持此策略的网关以及对应的策略版本
网关 策略版本
DataPower® API Gateway 2.0.0

本主题描述如何在 OpenAPI 源中配置策略;有关如何在组合件用户界面中配置策略的详细信息,请参阅用户安全性

关于

user-security 策略的格式如下:
- user-security:
  version: version
  title: title
  description: description
  factor-id: factor ID
  extract-identity-method: method_used_to_extract_credentials
       .
       .
       .
     properties_specific_to_the specified_identity_extraction_method
       .
       .
       .
  user-auth-method: authentication_method
       .
       .
       .
     properties_specific_to_the specified_authentication_method
       .
       .
       .
  user-az-method: authorization_method
       .
       .
       .
     properties_specific_to_the specified_authorization_method
       .
       .
       .

属性

表 2. user-security策略属性
属性 必需 描述 数据类型
version 策略版本号 字符串
title 策略的标题。 字符串
description 对策略的描述。 字符串
factor-id 用于识别 API 上下文中的因子认证结果的身份。 字符串
extract-identity-method 选择要用于抽取用户凭证的方法。可用选项如下:
basic
使用基本认证;无需其他配置。
context-var
凭证由 API Connect 上下文变量提供;请指定以下属性:
  • user-context-var:用于获取用户名的上下文变量。
  • pass-context-var:用于获取密码的上下文变量。
html-form
使用基于表单的身份抽取。可使用缺省表单或定制表单。要使用缺省表单,请指定 ei-default-form: true。要使用定制表单,请指定 ei-default-form: false,并提供以下属性:
  • ei-custom-form:表单的位置。
  • ei-custom-form-tls-client-profile:此 TLS 客户机概要文件用于保护与远程服务器的连接。

ei-form-time-limit 属性可用于指定允许提交表单的时间。

redirect
对身份抽取使用重定向;请指定以下属性:
  • redirect-url:URL 片段,将请求重定向至此 URL 片段以获取用户凭证。
  • redirect-time-limit:允许完成事务的时间。
disabled
已禁用身份抽取;将跳过此处理方面。


指定 ei-stop-on-error: true 以在发生身份抽取失败事件时停止组合件处理。如果未禁用身份抽取,那么该字段为必填。

字符串
user-auth-method 选择认证方法。可用选项如下:
auth-url
凭证由外部端点认证;请指定以下属性:
  • auth-url:认证端点的 URL。
  • auth-tls-client-profile:用于保护到认证端点的连接的 TLS 客户机概要文件。
  • auth-response-headers-pattern:用于选择要添加到 API 上下文的响应头的模式。
  • auth-response-header-credential:包含已认证的用户凭证的响应头。
ldap
凭证由 LDAP 用户注册表进行认证;ldap-registry 属性用于指定所需的注册表。
disabled
已禁用认证;将跳过此处理方面。


指定 au-stop-on-error: true 以在发生用户认证失败事件时停止组合件处理。如果未禁用认证,那么该字段为必填。

字符串
user-az-method 选择授权方法。可用选项如下:
authenticated
隐式接受任何先前已认证的用户;无需其他配置。
html-form
用户通过 HTML 表单提供授权。可使用缺省表单或定制表单。要使用缺省表单,请指定 az-default-form: true。要使用定制表单,请指定 az-default-form: false,并提供以下属性:
  • az-custom-form:表单的位置。
  • az-custom-form-tls-client-profile:此 TLS 客户机概要文件用于保护与远程服务器的连接。
  • az-form-time-limit:允许提交表单的时间。
disabled
已禁用授权;将跳过此处理方面。


指定 az-stop-on-error: true 以在发生用户授权失败事件时停止组合件处理。如果未禁用授权,那么该字段为必填。

字符串

示例

# basic authentication with LDAP registry

- user-security:
    version: 2.0.0
    title: user-security
    factor-id: default
    extract-identity-method: basic
    ei-stop-on-error: true
    user-auth-method: ldap
    ldap-registry: corporate-ldap
    au-stop-on-error: true
    user-az-method: authenticated
    az-stop-on-error: true
时间戳记图标 上次更新时间:2019-06-21