Logout fix for Xamarin in identity
This commit is contained in:
parent
10f3e17b55
commit
e4d3c66d27
@ -16,7 +16,7 @@
|
||||
<AndroidResgenFile>Resources\Resource.Designer.cs</AndroidResgenFile>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
<AndroidUseLatestPlatformSdk>True</AndroidUseLatestPlatformSdk>
|
||||
<TargetFrameworkVersion>v7.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v6.0</TargetFrameworkVersion>
|
||||
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
|
@ -156,10 +156,11 @@ namespace IdentityServer4.Quickstart.UI.Controllers
|
||||
return await Logout(new LogoutViewModel { LogoutId = logoutId });
|
||||
}
|
||||
|
||||
//Test for Xamarin.
|
||||
var context = await _interaction.GetLogoutContextAsync(logoutId);
|
||||
if (context?.ShowSignoutPrompt == false)
|
||||
{
|
||||
// it's safe to automatically sign-out
|
||||
//it's safe to automatically sign-out
|
||||
return await Logout(new LogoutViewModel { LogoutId = logoutId });
|
||||
}
|
||||
|
||||
@ -169,7 +170,6 @@ namespace IdentityServer4.Quickstart.UI.Controllers
|
||||
{
|
||||
LogoutId = logoutId
|
||||
};
|
||||
|
||||
return View(vm);
|
||||
}
|
||||
|
||||
@ -211,9 +211,21 @@ namespace IdentityServer4.Quickstart.UI.Controllers
|
||||
|
||||
// get context information (client name, post logout redirect URI and iframe for federated signout)
|
||||
var logout = await _interaction.GetLogoutContextAsync(model.LogoutId);
|
||||
|
||||
return Redirect(logout?.PostLogoutRedirectUri);
|
||||
}
|
||||
|
||||
public async Task<IActionResult> DeviceLogOut(string redirectUrl)
|
||||
{
|
||||
// delete authentication cookie
|
||||
await HttpContext.Authentication.SignOutAsync();
|
||||
|
||||
// set this so UI rendering sees an anonymous user
|
||||
HttpContext.User = new ClaimsPrincipal(new ClaimsIdentity());
|
||||
|
||||
return Redirect(redirectUrl);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// initiate roundtrip to external authentication provider
|
||||
/// </summary>
|
||||
|
@ -24,9 +24,6 @@ namespace IdentityServer4.Quickstart.UI.Controllers
|
||||
|
||||
public IActionResult Index(string returnUrl)
|
||||
{
|
||||
if (returnUrl != "")
|
||||
return Redirect(_settings.Value.MvcClient);
|
||||
|
||||
return View();
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,10 @@
|
||||
public async Task<IActionResult> AddOrder([FromBody]NewOrderRequest order)
|
||||
{
|
||||
if (order.CardExpiration == DateTime.MinValue)
|
||||
order.CardExpiration = DateTime.Now;
|
||||
order.CardExpiration = DateTime.Now.AddYears(5);
|
||||
|
||||
if (order.CardTypeId == 0)
|
||||
order.CardTypeId = 1;
|
||||
|
||||
order.Buyer = GetUserName();
|
||||
|
||||
|
@ -31,7 +31,6 @@ namespace Microsoft.eShopOnContainers.WebMVC.ViewComponents
|
||||
{
|
||||
var basket = await _cartSvc.GetBasket(user);
|
||||
return basket.Items.Count;
|
||||
return await Task<int>.Run(()=> { return 0; });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ namespace eShopConContainers.WebSPA
|
||||
.UseConfiguration(config)
|
||||
.UseContentRoot(Directory.GetCurrentDirectory())
|
||||
.UseIISIntegration()
|
||||
.UseUrls("http://localhost:5104/")
|
||||
//.UseUrls("http://localhost:5104/")
|
||||
.UseStartup<Startup>()
|
||||
.Build();
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:1250/",
|
||||
"applicationUrl": "http://localhost:5104/",
|
||||
"sslPort": 0
|
||||
}
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user