【发布时间】:2018-11-01 12:59:42
【问题描述】:
我正在尝试创建一个 oAuth 策略来保护使用 JWT 访问令牌的 API。可以通过调用外部 URL 来验证该令牌。
我正在为我的 Mule 代理使用以下 RAML。
#%RAML 1.0
title: Custom API
version: 1
baseUri: http://localhost:8081
securitySchemes:
oauth_2_0:
description: |
This API supports OAuth 2.0 for authenticating all API requests.
type: OAuth 2.0
describedBy:
headers:
authorization:
description: |
Used to send a valid OAuth 2 access token. Do not use with the "access_token" query
string parameter.
type: string
responses:
401:
description: |
Bad or expired token. This can happen if the user or the API revoked or expired an
access token. To fix, you should re-authenticate the user.
403:
description: |
Bad OAuth request (wrong consumer key, bad nonce, expired timestamp...). Unfortunately,
re-authenticating the user won't help here.
/hello:
get:
securedBy: [oauth_2_0]
但是,mule 在验证外部服务时无法发送授权标头。
【问题讨论】:
-
“mule 无法发送授权标头”是什么意思?从 mule 调用外部服务时,您是否明确设置了 Authorization 标头?
-
当我验证授权服务中的所有标头时,缺少名为“授权”的标头
-
调用外部服务时需要设置Authorization header。请分享您的代码,以便我们更轻松地了解问题所在。
-
我没有代码。这是通过 API 管理器中的 OAuth 策略实现的。
标签: validation mule jwt token using