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>
|
<AndroidResgenFile>Resources\Resource.Designer.cs</AndroidResgenFile>
|
||||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||||
<AndroidUseLatestPlatformSdk>True</AndroidUseLatestPlatformSdk>
|
<AndroidUseLatestPlatformSdk>True</AndroidUseLatestPlatformSdk>
|
||||||
<TargetFrameworkVersion>v7.0</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v6.0</TargetFrameworkVersion>
|
||||||
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
|
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
|
||||||
<NuGetPackageImportStamp>
|
<NuGetPackageImportStamp>
|
||||||
</NuGetPackageImportStamp>
|
</NuGetPackageImportStamp>
|
||||||
|
@ -156,10 +156,11 @@ namespace IdentityServer4.Quickstart.UI.Controllers
|
|||||||
return await Logout(new LogoutViewModel { LogoutId = logoutId });
|
return await Logout(new LogoutViewModel { LogoutId = logoutId });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Test for Xamarin.
|
||||||
var context = await _interaction.GetLogoutContextAsync(logoutId);
|
var context = await _interaction.GetLogoutContextAsync(logoutId);
|
||||||
if (context?.ShowSignoutPrompt == false)
|
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 });
|
return await Logout(new LogoutViewModel { LogoutId = logoutId });
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,7 +170,6 @@ namespace IdentityServer4.Quickstart.UI.Controllers
|
|||||||
{
|
{
|
||||||
LogoutId = logoutId
|
LogoutId = logoutId
|
||||||
};
|
};
|
||||||
|
|
||||||
return View(vm);
|
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)
|
// get context information (client name, post logout redirect URI and iframe for federated signout)
|
||||||
var logout = await _interaction.GetLogoutContextAsync(model.LogoutId);
|
var logout = await _interaction.GetLogoutContextAsync(model.LogoutId);
|
||||||
|
|
||||||
return Redirect(logout?.PostLogoutRedirectUri);
|
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>
|
/// <summary>
|
||||||
/// initiate roundtrip to external authentication provider
|
/// initiate roundtrip to external authentication provider
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -24,9 +24,6 @@ namespace IdentityServer4.Quickstart.UI.Controllers
|
|||||||
|
|
||||||
public IActionResult Index(string returnUrl)
|
public IActionResult Index(string returnUrl)
|
||||||
{
|
{
|
||||||
if (returnUrl != "")
|
|
||||||
return Redirect(_settings.Value.MvcClient);
|
|
||||||
|
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,10 @@
|
|||||||
public async Task<IActionResult> AddOrder([FromBody]NewOrderRequest order)
|
public async Task<IActionResult> AddOrder([FromBody]NewOrderRequest order)
|
||||||
{
|
{
|
||||||
if (order.CardExpiration == DateTime.MinValue)
|
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();
|
order.Buyer = GetUserName();
|
||||||
|
|
||||||
|
@ -31,7 +31,6 @@ namespace Microsoft.eShopOnContainers.WebMVC.ViewComponents
|
|||||||
{
|
{
|
||||||
var basket = await _cartSvc.GetBasket(user);
|
var basket = await _cartSvc.GetBasket(user);
|
||||||
return basket.Items.Count;
|
return basket.Items.Count;
|
||||||
return await Task<int>.Run(()=> { return 0; });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ namespace eShopConContainers.WebSPA
|
|||||||
.UseConfiguration(config)
|
.UseConfiguration(config)
|
||||||
.UseContentRoot(Directory.GetCurrentDirectory())
|
.UseContentRoot(Directory.GetCurrentDirectory())
|
||||||
.UseIISIntegration()
|
.UseIISIntegration()
|
||||||
.UseUrls("http://localhost:5104/")
|
//.UseUrls("http://localhost:5104/")
|
||||||
.UseStartup<Startup>()
|
.UseStartup<Startup>()
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
"windowsAuthentication": false,
|
"windowsAuthentication": false,
|
||||||
"anonymousAuthentication": true,
|
"anonymousAuthentication": true,
|
||||||
"iisExpress": {
|
"iisExpress": {
|
||||||
"applicationUrl": "http://localhost:1250/",
|
"applicationUrl": "http://localhost:5104/",
|
||||||
"sslPort": 0
|
"sslPort": 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user