Secure your NGINX locations with JWT

12 — 所有核心与模块指令——语法、默认值、上下文与真实配置示例。

auth_jwt_algorithm `auth_jwt_algorithm` 指令指定用于在 NGINX 中验证 JSON Web Tokens (JWTs) 的算法。 httpserverlocation auth_jwt_enabled 指令 `auth_jwt_enabled` 为 NGINX 的 location 启用 JWT 验证检查。 httpserverlocation auth_jwt_extract_request_claims 该 `auth_jwt_extract_request_claims` 指令从 JWT 中提取特定声明并将其设置为请求头。 httpserverlocation auth_jwt_extract_response_claims `auth_jwt_extract_response_claims` 指令从 JWT 中提取指定的声明并将其添加到响应头中。 httpserverlocation auth_jwt_extract_var_claims `auth_jwt_extract_var_claims` 指令从 JWT 中提取指定的声明,并将它们作为 NGINX 变量提供可用。 httpserverlocation auth_jwt_key `auth_jwt_key` 指令指定用于在 NGINX 中解码和验证 JWT 的密钥。 httpserverlocation auth_jwt_keyfile_path 指令 `auth_jwt_keyfile_path` 设置在 NGINX 中用于 JWT 验证的密钥文件路径。 httpserverlocation auth_jwt_location auth_jwt_location 指令指定了 HTTP 请求中 JSON Web Token (JWT) 的位置。 httpserverlocation auth_jwt_loginurl 指令 `auth_jwt_loginurl` 指定在 JWT 验证失败时要重定向到的 URL。 httpserverlocation auth_jwt_redirect 当 JWT 验证失败时,`auth_jwt_redirect` 指令会将请求重定向到指定的登录 URL。 httpserverlocation auth_jwt_use_keyfile `auth_jwt_use_keyfile` 指令指定是否从文件加载用于 JWT 验证的密钥。 httpserverlocation auth_jwt_validate_sub `auth_jwt_validate_sub` 指令在授权检查期间验证 JWT 中的 `sub` 声明。 httpserverlocation