Skip to content

Commit fc99522

Browse files
Merge pull request #2 from Buholzer-Nick/fix-01-signout-logic-mistake
fix: quick redirect fix
2 parents 2e230b6 + 5f56537 commit fc99522

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

examples/oauth-proxy/oauth-proxy-sign-out.xml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@
1616
<!-- Cookie not the right format - redirect to the sign-in endpoint -->
1717
<when condition="@(((string)context.Variables["encryptedIncomingFullSessionCookie"]).Split('.').Length != 3)">
1818
<return-response>
19-
<set-status code="401" reason="Incorrect formed cookie" />
19+
<set-status code="302" />
20+
<set-header name="Location" exists-action="override">
21+
<value>@($"/oauth/signin?redirect={Uri.EscapeDataString(context.Request.OriginalUrl.ToString())}")</value>
22+
</set-header>
2023
</return-response>
2124
</when>
2225
</choose>
@@ -25,13 +28,14 @@
2528
<set-variable name="encryptedCookie" value="@(((string)context.Variables["encryptedIncomingFullSessionCookie"]).Split('.')[0])" />
2629
<set-variable name="ivCookie" value="@(((string)context.Variables["encryptedIncomingFullSessionCookie"]).Split('.')[1])" />
2730
<set-variable name="cookieKey" value="@(((string)context.Variables["encryptedIncomingFullSessionCookie"]).Split('.')[2])" />
31+
2832
<choose>
2933
<!-- Cookie not the right format - redirect to the sign-in endpoint -->
3034
<when condition="@(((string)context.Variables["ivCookie"]) == string.Empty)">
3135
<return-response>
3236
<set-status code="302" />
3337
<set-header name="Location" exists-action="override">
34-
<value>@($"/oauth/signin?redirect={(string)context.Variables["redirect-no-cookie"]}")</value>
38+
<value>@($"/oauth/signin?redirect={Uri.EscapeDataString(context.Request.OriginalUrl.ToString())}")</value>
3539
</set-header>
3640
</return-response>
3741
</when>
@@ -57,7 +61,7 @@
5761
<return-response>
5862
<set-status code="302" />
5963
<set-header name="Location" exists-action="override">
60-
<value>@($"/oauth/signin?redirect={(string)context.Variables["redirect-no-cookie"]}")</value>
64+
<value>@($"/oauth/signin?redirect={Uri.EscapeDataString(context.Request.OriginalUrl.ToString())}")</value>
6165
</set-header>
6266
</return-response>
6367
</when>

0 commit comments

Comments
 (0)