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

Commit

Permalink
Merge pull request #33 from dylanplecki/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
ntheile committed Feb 12, 2016
2 parents 59c8b91 + 81e583a commit d80b836
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion appveyor.yml
Expand Up @@ -4,7 +4,7 @@ platform: Any CPU
os: Visual Studio 2015

environment:
app_version: '2.1.5'
app_version: '2.1.6'
app_version_postfix: ''

branches:
Expand Down
7 changes: 3 additions & 4 deletions src/KeycloakIdentityModel/KeycloakIdentity.cs
Expand Up @@ -294,18 +294,17 @@ public static async Task<Uri> GenerateLoginCallbackUriAsync(IKeycloakParameters
/// </summary>
/// <param name="parameters"></param>
/// <param name="baseUri"></param>
/// <param name="redirectUri"></param>
/// <param name="redirectUrl"></param>
/// <returns></returns>
public static async Task<Uri> GenerateLogoutUriAsync(IKeycloakParameters parameters, Uri baseUri,
Uri redirectUri)
string redirectUrl = null)
{
if (parameters == null) throw new ArgumentNullException(nameof(parameters));
if (baseUri == null) throw new ArgumentNullException(nameof(baseUri));
if (redirectUri == null) throw new ArgumentNullException(nameof(redirectUri));

// Generate logout URI and data
var uriManager = await OidcDataManager.GetCachedContextAsync(parameters);
var logoutParams = uriManager.BuildEndSessionEndpointContent(baseUri, null, redirectUri.ToString());
var logoutParams = uriManager.BuildEndSessionEndpointContent(baseUri, null, redirectUrl);
var logoutUrl = uriManager.GetEndSessionEndpoint();

// Return logout URI
Expand Down
4 changes: 3 additions & 1 deletion src/KeycloakIdentityModel/Utilities/OidcDataManager.cs
Expand Up @@ -357,7 +357,9 @@ public HttpContent BuildRefreshTokenEndpointContent(string refreshToken)
if (string.IsNullOrEmpty(postLogoutRedirectUrl))
postLogoutRedirectUrl = _options.PostLogoutRedirectUrl;

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

if (!Uri.IsWellFormedUriString(postLogoutRedirectUrl, UriKind.RelativeOrAbsolute))
Expand Down
Expand Up @@ -255,7 +255,7 @@ private async Task LogoutRedirectAsync()
// Redirect response to logout
Response.Redirect(
(await
KeycloakIdentity.GenerateLogoutUriAsync(Options, Request.Uri, new Uri(Options.PostLogoutRedirectUrl)))
KeycloakIdentity.GenerateLogoutUriAsync(Options, Request.Uri))
.ToString());
}

Expand Down

0 comments on commit d80b836

Please sign in to comment.