模块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_module,ngx_http_auth_basic_module和ngx_http_auth_request_module指示。
此模块可作为商业订阅的一部分。
Example Configuration
location / { auth_jwt "closed site"; auth_jwt_key_file conf/keys.json; }
Directives
句法: | auth_jwt |
---|---|
默认: |
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 |
---|---|
默认: | - |
语境: | HTTP T0> |
该指令出现在1.11.10版本中。
将variable
设置为给定的JOSE头参数name
。
句法: | auth_jwt_claim_set |
---|---|
默认: | - |
语境: | HTTP T0> |
该指令出现在1.11.10版本中。
将variable
设置为给定的JWT声明参数name
。
句法: | auth_jwt_key_file |
---|---|
默认: | - |
语境: | http ,服务器 ,位置 |
在JSON Web Key Set格式中指定file
以验证JWT签名。参数值可以包含变量。
Embedded Variables
ngx_http_auth_jwt_module
模块支持嵌入式变量: