Merge remote-tracking branch 'origin/xamarin-fix-uwp-login' into dev
This commit is contained in:
commit
47b7cabdcd
Binary file not shown.
BIN
img/ebook_xamarin_patterns_cover.png
Normal file
BIN
img/ebook_xamarin_patterns_cover.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 30 KiB |
@ -14,6 +14,7 @@ namespace Microsoft.eShopOnContainers.BuildingBlocks.Resilience.HttpResilience
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// HttpClient wrapper that integrates Retry and Circuit
|
/// HttpClient wrapper that integrates Retry and Circuit
|
||||||
/// breaker policies when invoking HTTP services.
|
/// breaker policies when invoking HTTP services.
|
||||||
|
/// Based on Polly library: https://github.com/App-vNext/Polly
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class ResilientHttpClient : IHttpClient
|
public class ResilientHttpClient : IHttpClient
|
||||||
{
|
{
|
||||||
|
@ -106,8 +106,9 @@
|
|||||||
<converters:InverseBoolConverter x:Key="InverseBoolConverter" />
|
<converters:InverseBoolConverter x:Key="InverseBoolConverter" />
|
||||||
<converters:ItemsToHeightConverter x:Key="ItemsToHeightConverter" />
|
<converters:ItemsToHeightConverter x:Key="ItemsToHeightConverter" />
|
||||||
<converters:ToUpperConverter x:Key="ToUpperConverter" />
|
<converters:ToUpperConverter x:Key="ToUpperConverter" />
|
||||||
<converters:WebNavigatingEventArgsConverter x:Key="WebNavigatingEventArgsConverter" />
|
<converters:WebNavigatingEventArgsConverter x:Key="WebNavigatingEventArgsConverter" />
|
||||||
|
<converters:WebNavigatedEventArgsConverter x:Key="WebNavigatedEventArgsConverter" />
|
||||||
|
|
||||||
<!-- STYLES -->
|
<!-- STYLES -->
|
||||||
<Style x:Key="EntryStyle"
|
<Style x:Key="EntryStyle"
|
||||||
TargetType="{x:Type Entry}">
|
TargetType="{x:Type Entry}">
|
||||||
|
@ -0,0 +1,23 @@
|
|||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
using Xamarin.Forms;
|
||||||
|
|
||||||
|
namespace eShopOnContainers.Core.Converters
|
||||||
|
{
|
||||||
|
public class WebNavigatedEventArgsConverter : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
var eventArgs = value as WebNavigatedEventArgs;
|
||||||
|
if (eventArgs == null)
|
||||||
|
throw new ArgumentException("Expected WebNavigatedEventArgs as value", "value");
|
||||||
|
|
||||||
|
return eventArgs.Url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -60,7 +60,7 @@
|
|||||||
IdentityEndpoint = string.Format("{0}:5105/connect/authorize", baseEndpoint);
|
IdentityEndpoint = string.Format("{0}:5105/connect/authorize", baseEndpoint);
|
||||||
UserInfoEndpoint = string.Format("{0}:5105/connect/userinfo", baseEndpoint);
|
UserInfoEndpoint = string.Format("{0}:5105/connect/userinfo", baseEndpoint);
|
||||||
LogoutEndpoint = string.Format("{0}:5105/connect/endsession", baseEndpoint);
|
LogoutEndpoint = string.Format("{0}:5105/connect/endsession", baseEndpoint);
|
||||||
IdentityCallback = "http://eshopxamarin/callback.html";
|
IdentityCallback = string.Format("{0}:5105/xamarincallback", baseEndpoint);
|
||||||
LogoutCallback = string.Format("{0}:5105/Account/Redirecting", baseEndpoint);
|
LogoutCallback = string.Format("{0}:5105/Account/Redirecting", baseEndpoint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -221,14 +221,16 @@ namespace eShopOnContainers.Core.ViewModels
|
|||||||
|
|
||||||
private async Task NavigateAsync(string url)
|
private async Task NavigateAsync(string url)
|
||||||
{
|
{
|
||||||
if (url.Equals(GlobalSetting.Instance.LogoutCallback))
|
var unescapedUrl = System.Net.WebUtility.UrlDecode(url);
|
||||||
|
|
||||||
|
if (unescapedUrl.Equals(GlobalSetting.Instance.LogoutCallback))
|
||||||
{
|
{
|
||||||
Settings.AuthAccessToken = string.Empty;
|
Settings.AuthAccessToken = string.Empty;
|
||||||
Settings.AuthIdToken = string.Empty;
|
Settings.AuthIdToken = string.Empty;
|
||||||
IsLogin = false;
|
IsLogin = false;
|
||||||
LoginUrl = _identityService.CreateAuthorizeRequest();
|
LoginUrl = _identityService.CreateAuthorizeRequest();
|
||||||
}
|
}
|
||||||
else if (url.Contains(GlobalSetting.Instance.IdentityCallback))
|
else if (unescapedUrl.Contains(GlobalSetting.Instance.IdentityCallback))
|
||||||
{
|
{
|
||||||
var authResponse = new AuthorizeResponse(url);
|
var authResponse = new AuthorizeResponse(url);
|
||||||
|
|
||||||
|
@ -313,10 +313,26 @@
|
|||||||
AbsoluteLayout.LayoutBounds="0, 0, 1, 1"
|
AbsoluteLayout.LayoutBounds="0, 0, 1, 1"
|
||||||
AbsoluteLayout.LayoutFlags="All">
|
AbsoluteLayout.LayoutFlags="All">
|
||||||
<WebView.Behaviors>
|
<WebView.Behaviors>
|
||||||
<behaviors:EventToCommandBehavior
|
<OnPlatform x:TypeArguments="Behavior">
|
||||||
EventName="Navigating"
|
<OnPlatform.Android>
|
||||||
EventArgsConverter="{StaticResource WebNavigatingEventArgsConverter}"
|
<behaviors:EventToCommandBehavior
|
||||||
Command="{Binding NavigateCommand}" />
|
EventName="Navigating"
|
||||||
|
EventArgsConverter="{StaticResource WebNavigatingEventArgsConverter}"
|
||||||
|
Command="{Binding NavigateCommand}" />
|
||||||
|
</OnPlatform.Android>
|
||||||
|
<OnPlatform.iOS>
|
||||||
|
<behaviors:EventToCommandBehavior
|
||||||
|
EventName="Navigating"
|
||||||
|
EventArgsConverter="{StaticResource WebNavigatingEventArgsConverter}"
|
||||||
|
Command="{Binding NavigateCommand}" />
|
||||||
|
</OnPlatform.iOS>
|
||||||
|
<OnPlatform.WinPhone>
|
||||||
|
<behaviors:EventToCommandBehavior
|
||||||
|
EventName="Navigated"
|
||||||
|
EventArgsConverter="{StaticResource WebNavigatedEventArgsConverter}"
|
||||||
|
Command="{Binding NavigateCommand}" />
|
||||||
|
</OnPlatform.WinPhone>
|
||||||
|
</OnPlatform>
|
||||||
</WebView.Behaviors>
|
</WebView.Behaviors>
|
||||||
</WebView>
|
</WebView>
|
||||||
</AbsoluteLayout>
|
</AbsoluteLayout>
|
||||||
|
@ -58,6 +58,7 @@
|
|||||||
<Compile Include="Converters\ItemsToHeightConverter.cs" />
|
<Compile Include="Converters\ItemsToHeightConverter.cs" />
|
||||||
<Compile Include="Converters\ItemTappedEventArgsConverter.cs" />
|
<Compile Include="Converters\ItemTappedEventArgsConverter.cs" />
|
||||||
<Compile Include="Converters\ToUpperConverter.cs" />
|
<Compile Include="Converters\ToUpperConverter.cs" />
|
||||||
|
<Compile Include="Converters\WebNavigatedEventArgsConverter.cs" />
|
||||||
<Compile Include="Effects\LineColorEffect.cs" />
|
<Compile Include="Effects\LineColorEffect.cs" />
|
||||||
<Compile Include="Exceptions\ServiceAuthenticationException.cs" />
|
<Compile Include="Exceptions\ServiceAuthenticationException.cs" />
|
||||||
<Compile Include="Extensions\AnimationExtension.cs" />
|
<Compile Include="Extensions\AnimationExtension.cs" />
|
||||||
|
@ -24,5 +24,6 @@
|
|||||||
</Applications>
|
</Applications>
|
||||||
<Capabilities>
|
<Capabilities>
|
||||||
<Capability Name="internetClient" />
|
<Capability Name="internetClient" />
|
||||||
|
<Capability Name="privateNetworkClientServer" />
|
||||||
</Capabilities>
|
</Capabilities>
|
||||||
</Package>
|
</Package>
|
Loading…
x
Reference in New Issue
Block a user