模块ngx_http_auth_jwt_module

Example Configuration
Directives
auth_jwt
auth_jwt_header_set
auth_jwt_claim_set
auth_jwt_key_file
Embedded Variables

ngx_http_auth_jwt_module模块(1.11.3)通过使用指定的键验证提供的JSON Web令牌(JWT)来实现客户端授权。JWT声明必须以JSON Web Signature(JWS)结构编码。该模块可用于OpenID Connect认证。

该模块可以通过满足与其他访问模块组合,例如ngx_http_access_modulengx_http_auth_basic_modulengx_http_auth_request_module指示。

此模块可作为商业订阅的一部分。

Example Configuration

location / {
    auth_jwt          "closed site";
    auth_jwt_key_file conf/keys.json;
}

Directives

句法: auth_jwt string [token = $variable] | 关 T7>; T0>
默认:
auth_jwt off;
语境: http服务器位置

启用JSON Web令牌的验证。指定的string用作领域参数值可以包含变量。

可选的令牌参数指定包含JSON Web令牌的变量。By default, JWT is passed in the “Authorization” header as a Bearer Token. JWT也可以作为cookie或查询字符串的一部分传递:

auth_jwt "closed site" token=$cookie_auth_token;

特殊值off取消从先前配置级别继承的auth_jwt指令的效果。

句法: auth_jwt_header_set $variable name
默认: -
语境: HTTP T0>

该指令出现在1.11.10版本中。

variable设置为给定的JOSE头参数name

句法: auth_jwt_claim_set $variable name
默认: -
语境: HTTP T0>

该指令出现在1.11.10版本中。

variable设置为给定的JWT声明参数name

句法: auth_jwt_key_file file
默认: -
语境: http服务器位置

JSON Web Key Set格式中指定file以验证JWT签名。参数值可以包含变量。

Embedded Variables

ngx_http_auth_jwt_module模块支持嵌入式变量:

$ jwt_header _ T0> name
返回指定的JOSE标头的值
$ jwt_claim _ T0> name
返回指定的JWT声明的值