Skip to content
This repository was archived by the owner on Mar 25, 2021. It is now read-only.

Commit d80b836

Browse files
committed
Merge pull request #33 from dylanplecki/dev
Dev
2 parents 59c8b91 + 81e583a commit d80b836

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ platform: Any CPU
44
os: Visual Studio 2015
55

66
environment:
7-
app_version: '2.1.5'
7+
app_version: '2.1.6'
88
app_version_postfix: ''
99

1010
branches:

src/KeycloakIdentityModel/KeycloakIdentity.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -294,18 +294,17 @@ public static async Task<Uri> GenerateLoginCallbackUriAsync(IKeycloakParameters
294294
/// </summary>
295295
/// <param name="parameters"></param>
296296
/// <param name="baseUri"></param>
297-
/// <param name="redirectUri"></param>
297+
/// <param name="redirectUrl"></param>
298298
/// <returns></returns>
299299
public static async Task<Uri> GenerateLogoutUriAsync(IKeycloakParameters parameters, Uri baseUri,
300-
Uri redirectUri)
300+
string redirectUrl = null)
301301
{
302302
if (parameters == null) throw new ArgumentNullException(nameof(parameters));
303303
if (baseUri == null) throw new ArgumentNullException(nameof(baseUri));
304-
if (redirectUri == null) throw new ArgumentNullException(nameof(redirectUri));
305304

306305
// Generate logout URI and data
307306
var uriManager = await OidcDataManager.GetCachedContextAsync(parameters);
308-
var logoutParams = uriManager.BuildEndSessionEndpointContent(baseUri, null, redirectUri.ToString());
307+
var logoutParams = uriManager.BuildEndSessionEndpointContent(baseUri, null, redirectUrl);
309308
var logoutUrl = uriManager.GetEndSessionEndpoint();
310309

311310
// Return logout URI

src/KeycloakIdentityModel/Utilities/OidcDataManager.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,9 @@ public HttpContent BuildEndSessionEndpointContent(Uri requestUri, string idToken
357357
if (string.IsNullOrEmpty(postLogoutRedirectUrl))
358358
postLogoutRedirectUrl = _options.PostLogoutRedirectUrl;
359359

360-
if (Uri.IsWellFormedUriString(postLogoutRedirectUrl, UriKind.Relative))
360+
if (string.IsNullOrEmpty(postLogoutRedirectUrl)) // Double-check options for empty/null
361+
postLogoutRedirectUrl = requestUri.GetLeftPart(UriPartial.Authority);
362+
else if (Uri.IsWellFormedUriString(postLogoutRedirectUrl, UriKind.Relative))
361363
postLogoutRedirectUrl = requestUri.GetLeftPart(UriPartial.Authority) + postLogoutRedirectUrl;
362364

363365
if (!Uri.IsWellFormedUriString(postLogoutRedirectUrl, UriKind.RelativeOrAbsolute))

src/Owin.Security.Keycloak/Middleware/KeycloakAuthenticationHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ private async Task LogoutRedirectAsync()
255255
// Redirect response to logout
256256
Response.Redirect(
257257
(await
258-
KeycloakIdentity.GenerateLogoutUriAsync(Options, Request.Uri, new Uri(Options.PostLogoutRedirectUrl)))
258+
KeycloakIdentity.GenerateLogoutUriAsync(Options, Request.Uri))
259259
.ToString());
260260
}
261261

0 commit comments

Comments
 (0)