-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApimConfiguration.txt
37 lines (37 loc) · 1.09 KB
/
ApimConfiguration.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<policies>
<inbound>
<set-variable name="SigningKey" value="bXloaWdobHlzdXBlcnNlY3JldGtleXdoaWNoY2FudGJlZGVjcmlwdGVk" />
<validate-jwt header-name="Token" failed-validation-httpcode="401" failed-validation-error-message="Unauthorized">
<issuer-signing-keys>
<key>@(context.Variables.GetValueOrDefault<string>("SigningKey"))</key>
</issuer-signing-keys>
<required-claims>
<claim name="role">
<value>authorizedUser</value>
</claim>
</required-claims>
</validate-jwt>
<choose>
<when condition="@(context.Request.Headers.GetValueOrDefault("Accept","").Contains("application/xml"))">
<set-header name="Accept" exists-action="delete">
</set-header>
<set-variable name="ToXml" value="True" />
</when>
<otherwise>
<set-variable name="ToXml" value="False" />
</otherwise>
</choose>
<base />
</inbound>
<backend>
<base />
</backend>
<outbound>
<base />
<choose>
<when condition="@((string)context.Variables["ToXml"] == "True")">
<json-to-xml apply="always" consider-accept-header="false" />
</when>
</choose>
</outbound>
</policies>