validate-jwt openid-config URL-如何使用变量作为URL? [英] validate-jwt openid-config url - how to use a variable as the URL?

查看:146
本文介绍了validate-jwt openid-config URL-如何使用变量作为URL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个需要验证多个JWT的用例,我的方法是编写validate-jwt策略,如下所示:
< validate-jwt>
< openid-config url ="@((string)context.Variables [" openIdUrl]))" />
</validate-jwt>

I have a use case where I need to validate multiple JWTs, my approach was to write the validate-jwt policy as follows:
<validate-jwt>
<openid-config url="@((string)context.Variables["openIdUrl"])" />
</validate-jwt>

但是,我收到以下错误,该错误表明验证APIM时无法识别url属性的代码块,并尝试验证文本是否为正确的URI.这一定是一个错误.我唯一能想到的解决方法是硬编码 网址并在选择时"策略内复制validate-jwt策略.对于我的理智而言,这是无法管理/可扩展/有益的.

However I get the following error, which shows that when validating APIM doesn't recognise the code block for the url attribute and attempts to validate that the text is a proper URI. This must be a bug. The only workaround I can think of is to hard code the url and duplicate the validate-jwt policy inside a choose when policy. This is not manageable/scalable/good for my sanity.

Error in element 'validate-jwt' on line 65, column 8: Unable to obtain configuration from: '@((string)context.Variables["openIdUrl"])'. Unable to retrieve document from: '@((string)context.Variables["openIdUrl"])'.An invalid request URI was provided. The request URI must either be an absolute URI or BaseAddress must be set

推荐答案

您尝试使用的属性(@URL)不会'支持政策表达.唯一可能的方法/选项是您可以使用命名" 价值观.另外,您可以参考以下代码来了解您的方法.

The attribute (@URL), which you are trying doesn’t support policy expression. The only possible way/option is that you may use Named Values. Also, you may refer to the below code for your approach.

< validate-jwt>

< openid-config url =" {{OIDC_ENDPOINT}}"/>

</validate-jwt>

.

If this answer was helpful, click "Mark as Answer" or "Up-Vote". To provide additional feedback on your forum experience, click here.


这篇关于validate-jwt openid-config URL-如何使用变量作为URL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆