From 35b32ca4a0c32a4e0356d8f6faf243dc74a6c69e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vincent=20Lain=C3=A9?= Date: Sat, 18 Jul 2020 10:19:05 +0200 Subject: [PATCH] Added UWP support --- .../Okta.Xamarin.UWP/OidcClient.UWP.cs | 43 +++++ .../Okta.Xamarin.UWP/Okta.Xamarin.UWP.csproj | 158 ++++++++++++++++++ .../Okta.Xamarin.UWP/OktaConfig.UWP.cs | 16 ++ .../Properties/AssemblyInfo.cs | 29 ++++ .../Properties/Okta.Xamarin.UWP.rd.xml | 33 ++++ Okta.Xamarin/Okta.Xamarin.sln | 106 ++++++++++++ Okta.Xamarin/Okta.Xamarin/OidcClient.cs | 17 +- 7 files changed, 398 insertions(+), 4 deletions(-) create mode 100644 Okta.Xamarin/Okta.Xamarin.UWP/OidcClient.UWP.cs create mode 100644 Okta.Xamarin/Okta.Xamarin.UWP/Okta.Xamarin.UWP.csproj create mode 100644 Okta.Xamarin/Okta.Xamarin.UWP/OktaConfig.UWP.cs create mode 100644 Okta.Xamarin/Okta.Xamarin.UWP/Properties/AssemblyInfo.cs create mode 100644 Okta.Xamarin/Okta.Xamarin.UWP/Properties/Okta.Xamarin.UWP.rd.xml diff --git a/Okta.Xamarin/Okta.Xamarin.UWP/OidcClient.UWP.cs b/Okta.Xamarin/Okta.Xamarin.UWP/OidcClient.UWP.cs new file mode 100644 index 00000000..265e675c --- /dev/null +++ b/Okta.Xamarin/Okta.Xamarin.UWP/OidcClient.UWP.cs @@ -0,0 +1,43 @@ +using System; +using System.Threading.Tasks; +using Windows.Security.Authentication.Web; + +namespace Okta.Xamarin +{ + public partial class OidcClient : IOidcClient + { + /// + /// Creates a new UWO Okta OidcClient based on the specified + /// + /// The to use for this client. The config must be valid at the time this is called. + public OidcClient(IOktaConfig config) + { + this.Config = config; + validator.Validate(Config); + } + + private async Task LaunchBrowserAsync(string url) + { + var appUri = WebAuthenticationBroker.GetCurrentApplicationCallbackUri().AbsoluteUri; + + var result = await WebAuthenticationBroker.AuthenticateAsync( + WebAuthenticationOptions.None, + new Uri(url), + new Uri(appUri)); + if (result.ResponseStatus == WebAuthenticationStatus.Success) + OidcClient.CaptureRedirectUrl(new Uri(result.ResponseData)); + else if (result.ResponseStatus == WebAuthenticationStatus.UserCancel) + throw new TaskCanceledException(result.ResponseData); + else + throw new Exception(result.ResponseData); + } + + /// + /// Called by the cross-platform code to close the browser used for login after the redirect. On UWP this is handled automatically, so an implementation is not needed. + /// + private void CloseBrowser() + { + // not needed on UWP + } + } +} diff --git a/Okta.Xamarin/Okta.Xamarin.UWP/Okta.Xamarin.UWP.csproj b/Okta.Xamarin/Okta.Xamarin.UWP/Okta.Xamarin.UWP.csproj new file mode 100644 index 00000000..70fc64fa --- /dev/null +++ b/Okta.Xamarin/Okta.Xamarin.UWP/Okta.Xamarin.UWP.csproj @@ -0,0 +1,158 @@ + + + + + Debug + AnyCPU + {772D0C03-592E-4478-A25F-E336BE66E10F} + Library + Properties + Okta.Xamarin.UWP + Okta.Xamarin.UWP + en-US + UAP + 10.0.18362.0 + 10.0.17763.0 + 14 + 512 + {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + prompt + 4 + + + x86 + true + bin\x86\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + ;2008 + full + false + prompt + + + x86 + bin\x86\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + true + ;2008 + pdbonly + false + prompt + + + ARM + true + bin\ARM\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + ;2008 + full + false + prompt + + + ARM + bin\ARM\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + true + ;2008 + pdbonly + false + prompt + + + ARM64 + true + bin\ARM64\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + ;2008 + full + false + prompt + + + ARM64 + bin\ARM64\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + true + ;2008 + pdbonly + false + prompt + + + x64 + true + bin\x64\Debug\ + DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP + ;2008 + full + false + prompt + + + x64 + bin\x64\Release\ + TRACE;NETFX_CORE;WINDOWS_UWP + true + ;2008 + pdbonly + false + prompt + + + PackageReference + + + + OidcClient.cs + + + OktaConfig.cs + + + + + + + + 6.2.10 + + + + + {49cd54c4-eb9a-423d-a2e8-885d80744659} + Okta.Xamarin + + + + + + + 14.0 + + + + \ No newline at end of file diff --git a/Okta.Xamarin/Okta.Xamarin.UWP/OktaConfig.UWP.cs b/Okta.Xamarin/Okta.Xamarin.UWP/OktaConfig.UWP.cs new file mode 100644 index 00000000..d1d70023 --- /dev/null +++ b/Okta.Xamarin/Okta.Xamarin.UWP/OktaConfig.UWP.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Okta.Xamarin +{ + /// + /// Stores configuration for the Okta UWP OIDC client + /// + public partial class OktaConfig : IOktaConfig + { + + } +} diff --git a/Okta.Xamarin/Okta.Xamarin.UWP/Properties/AssemblyInfo.cs b/Okta.Xamarin/Okta.Xamarin.UWP/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..72e3324b --- /dev/null +++ b/Okta.Xamarin/Okta.Xamarin.UWP/Properties/AssemblyInfo.cs @@ -0,0 +1,29 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Okta.Xamarin.UWP")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Okta")] +[assembly: AssemblyProduct("Okta.Xamarin.UWP")] +[assembly: AssemblyCopyright("Copyright © 2019 Okta")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: ComVisible(false)] \ No newline at end of file diff --git a/Okta.Xamarin/Okta.Xamarin.UWP/Properties/Okta.Xamarin.UWP.rd.xml b/Okta.Xamarin/Okta.Xamarin.UWP/Properties/Okta.Xamarin.UWP.rd.xml new file mode 100644 index 00000000..5e3bb84d --- /dev/null +++ b/Okta.Xamarin/Okta.Xamarin.UWP/Properties/Okta.Xamarin.UWP.rd.xml @@ -0,0 +1,33 @@ + + + + + + + + + diff --git a/Okta.Xamarin/Okta.Xamarin.sln b/Okta.Xamarin/Okta.Xamarin.sln index eb0bb5aa..c6302d6a 100644 --- a/Okta.Xamarin/Okta.Xamarin.sln +++ b/Okta.Xamarin/Okta.Xamarin.sln @@ -24,79 +24,185 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Examples", "Examples", "{80 EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{D2A7ED8B-B27B-4EA6-88FF-CF76C87D4FAF}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Okta.Xamarin.UWP", "Okta.Xamarin.UWP\Okta.Xamarin.UWP.csproj", "{772D0C03-592E-4478-A25F-E336BE66E10F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Android = Debug|Android Debug|Any CPU = Debug|Any CPU + Debug|ARM = Debug|ARM + Debug|ARM64 = Debug|ARM64 Debug|iPhone = Debug|iPhone Debug|iPhoneSimulator = Debug|iPhoneSimulator + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 Release|Android = Release|Android Release|Any CPU = Release|Any CPU + Release|ARM = Release|ARM + Release|ARM64 = Release|ARM64 Release|iPhone = Release|iPhone Release|iPhoneSimulator = Release|iPhoneSimulator + Release|x64 = Release|x64 + Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {D698F0D7-DFBA-4AE3-9ABE-219D87B1DFEE}.Debug|Android.ActiveCfg = Debug|Any CPU {D698F0D7-DFBA-4AE3-9ABE-219D87B1DFEE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D698F0D7-DFBA-4AE3-9ABE-219D87B1DFEE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D698F0D7-DFBA-4AE3-9ABE-219D87B1DFEE}.Debug|ARM.ActiveCfg = Debug|Any CPU + {D698F0D7-DFBA-4AE3-9ABE-219D87B1DFEE}.Debug|ARM.Build.0 = Debug|Any CPU + {D698F0D7-DFBA-4AE3-9ABE-219D87B1DFEE}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {D698F0D7-DFBA-4AE3-9ABE-219D87B1DFEE}.Debug|ARM64.Build.0 = Debug|Any CPU {D698F0D7-DFBA-4AE3-9ABE-219D87B1DFEE}.Debug|iPhone.ActiveCfg = Debug|Any CPU {D698F0D7-DFBA-4AE3-9ABE-219D87B1DFEE}.Debug|iPhone.Build.0 = Debug|Any CPU {D698F0D7-DFBA-4AE3-9ABE-219D87B1DFEE}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU {D698F0D7-DFBA-4AE3-9ABE-219D87B1DFEE}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {D698F0D7-DFBA-4AE3-9ABE-219D87B1DFEE}.Debug|x64.ActiveCfg = Debug|Any CPU + {D698F0D7-DFBA-4AE3-9ABE-219D87B1DFEE}.Debug|x64.Build.0 = Debug|Any CPU + {D698F0D7-DFBA-4AE3-9ABE-219D87B1DFEE}.Debug|x86.ActiveCfg = Debug|Any CPU + {D698F0D7-DFBA-4AE3-9ABE-219D87B1DFEE}.Debug|x86.Build.0 = Debug|Any CPU {D698F0D7-DFBA-4AE3-9ABE-219D87B1DFEE}.Release|Android.ActiveCfg = Release|Any CPU {D698F0D7-DFBA-4AE3-9ABE-219D87B1DFEE}.Release|Android.Build.0 = Release|Any CPU {D698F0D7-DFBA-4AE3-9ABE-219D87B1DFEE}.Release|Any CPU.ActiveCfg = Release|Any CPU {D698F0D7-DFBA-4AE3-9ABE-219D87B1DFEE}.Release|Any CPU.Build.0 = Release|Any CPU + {D698F0D7-DFBA-4AE3-9ABE-219D87B1DFEE}.Release|ARM.ActiveCfg = Release|Any CPU + {D698F0D7-DFBA-4AE3-9ABE-219D87B1DFEE}.Release|ARM.Build.0 = Release|Any CPU + {D698F0D7-DFBA-4AE3-9ABE-219D87B1DFEE}.Release|ARM64.ActiveCfg = Release|Any CPU + {D698F0D7-DFBA-4AE3-9ABE-219D87B1DFEE}.Release|ARM64.Build.0 = Release|Any CPU {D698F0D7-DFBA-4AE3-9ABE-219D87B1DFEE}.Release|iPhone.ActiveCfg = Release|Any CPU {D698F0D7-DFBA-4AE3-9ABE-219D87B1DFEE}.Release|iPhone.Build.0 = Release|Any CPU {D698F0D7-DFBA-4AE3-9ABE-219D87B1DFEE}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU {D698F0D7-DFBA-4AE3-9ABE-219D87B1DFEE}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {D698F0D7-DFBA-4AE3-9ABE-219D87B1DFEE}.Release|x64.ActiveCfg = Release|Any CPU + {D698F0D7-DFBA-4AE3-9ABE-219D87B1DFEE}.Release|x64.Build.0 = Release|Any CPU + {D698F0D7-DFBA-4AE3-9ABE-219D87B1DFEE}.Release|x86.ActiveCfg = Release|Any CPU + {D698F0D7-DFBA-4AE3-9ABE-219D87B1DFEE}.Release|x86.Build.0 = Release|Any CPU {727DA7A1-7D67-4402-82AD-3F43FAC34BF9}.Debug|Android.ActiveCfg = Debug|Any CPU {727DA7A1-7D67-4402-82AD-3F43FAC34BF9}.Debug|Android.Build.0 = Debug|Any CPU {727DA7A1-7D67-4402-82AD-3F43FAC34BF9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {727DA7A1-7D67-4402-82AD-3F43FAC34BF9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {727DA7A1-7D67-4402-82AD-3F43FAC34BF9}.Debug|ARM.ActiveCfg = Debug|Any CPU + {727DA7A1-7D67-4402-82AD-3F43FAC34BF9}.Debug|ARM.Build.0 = Debug|Any CPU + {727DA7A1-7D67-4402-82AD-3F43FAC34BF9}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {727DA7A1-7D67-4402-82AD-3F43FAC34BF9}.Debug|ARM64.Build.0 = Debug|Any CPU {727DA7A1-7D67-4402-82AD-3F43FAC34BF9}.Debug|iPhone.ActiveCfg = Debug|Any CPU {727DA7A1-7D67-4402-82AD-3F43FAC34BF9}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {727DA7A1-7D67-4402-82AD-3F43FAC34BF9}.Debug|x64.ActiveCfg = Debug|Any CPU + {727DA7A1-7D67-4402-82AD-3F43FAC34BF9}.Debug|x64.Build.0 = Debug|Any CPU + {727DA7A1-7D67-4402-82AD-3F43FAC34BF9}.Debug|x86.ActiveCfg = Debug|Any CPU + {727DA7A1-7D67-4402-82AD-3F43FAC34BF9}.Debug|x86.Build.0 = Debug|Any CPU {727DA7A1-7D67-4402-82AD-3F43FAC34BF9}.Release|Android.ActiveCfg = Release|Any CPU {727DA7A1-7D67-4402-82AD-3F43FAC34BF9}.Release|Android.Build.0 = Release|Any CPU {727DA7A1-7D67-4402-82AD-3F43FAC34BF9}.Release|Any CPU.ActiveCfg = Release|Any CPU {727DA7A1-7D67-4402-82AD-3F43FAC34BF9}.Release|Any CPU.Build.0 = Release|Any CPU + {727DA7A1-7D67-4402-82AD-3F43FAC34BF9}.Release|ARM.ActiveCfg = Release|Any CPU + {727DA7A1-7D67-4402-82AD-3F43FAC34BF9}.Release|ARM.Build.0 = Release|Any CPU + {727DA7A1-7D67-4402-82AD-3F43FAC34BF9}.Release|ARM64.ActiveCfg = Release|Any CPU + {727DA7A1-7D67-4402-82AD-3F43FAC34BF9}.Release|ARM64.Build.0 = Release|Any CPU {727DA7A1-7D67-4402-82AD-3F43FAC34BF9}.Release|iPhone.ActiveCfg = Release|Any CPU {727DA7A1-7D67-4402-82AD-3F43FAC34BF9}.Release|iPhone.Build.0 = Release|Any CPU {727DA7A1-7D67-4402-82AD-3F43FAC34BF9}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU {727DA7A1-7D67-4402-82AD-3F43FAC34BF9}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {727DA7A1-7D67-4402-82AD-3F43FAC34BF9}.Release|x64.ActiveCfg = Release|Any CPU + {727DA7A1-7D67-4402-82AD-3F43FAC34BF9}.Release|x64.Build.0 = Release|Any CPU + {727DA7A1-7D67-4402-82AD-3F43FAC34BF9}.Release|x86.ActiveCfg = Release|Any CPU + {727DA7A1-7D67-4402-82AD-3F43FAC34BF9}.Release|x86.Build.0 = Release|Any CPU {49CD54C4-EB9A-423D-A2E8-885D80744659}.Debug|Android.ActiveCfg = Debug|Any CPU {49CD54C4-EB9A-423D-A2E8-885D80744659}.Debug|Android.Build.0 = Debug|Any CPU {49CD54C4-EB9A-423D-A2E8-885D80744659}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {49CD54C4-EB9A-423D-A2E8-885D80744659}.Debug|Any CPU.Build.0 = Debug|Any CPU + {49CD54C4-EB9A-423D-A2E8-885D80744659}.Debug|ARM.ActiveCfg = Debug|Any CPU + {49CD54C4-EB9A-423D-A2E8-885D80744659}.Debug|ARM.Build.0 = Debug|Any CPU + {49CD54C4-EB9A-423D-A2E8-885D80744659}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {49CD54C4-EB9A-423D-A2E8-885D80744659}.Debug|ARM64.Build.0 = Debug|Any CPU {49CD54C4-EB9A-423D-A2E8-885D80744659}.Debug|iPhone.ActiveCfg = Debug|Any CPU {49CD54C4-EB9A-423D-A2E8-885D80744659}.Debug|iPhone.Build.0 = Debug|Any CPU {49CD54C4-EB9A-423D-A2E8-885D80744659}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU {49CD54C4-EB9A-423D-A2E8-885D80744659}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {49CD54C4-EB9A-423D-A2E8-885D80744659}.Debug|x64.ActiveCfg = Debug|Any CPU + {49CD54C4-EB9A-423D-A2E8-885D80744659}.Debug|x64.Build.0 = Debug|Any CPU + {49CD54C4-EB9A-423D-A2E8-885D80744659}.Debug|x86.ActiveCfg = Debug|Any CPU + {49CD54C4-EB9A-423D-A2E8-885D80744659}.Debug|x86.Build.0 = Debug|Any CPU {49CD54C4-EB9A-423D-A2E8-885D80744659}.Release|Android.ActiveCfg = Release|Any CPU {49CD54C4-EB9A-423D-A2E8-885D80744659}.Release|Android.Build.0 = Release|Any CPU {49CD54C4-EB9A-423D-A2E8-885D80744659}.Release|Any CPU.ActiveCfg = Release|Any CPU {49CD54C4-EB9A-423D-A2E8-885D80744659}.Release|Any CPU.Build.0 = Release|Any CPU + {49CD54C4-EB9A-423D-A2E8-885D80744659}.Release|ARM.ActiveCfg = Release|Any CPU + {49CD54C4-EB9A-423D-A2E8-885D80744659}.Release|ARM.Build.0 = Release|Any CPU + {49CD54C4-EB9A-423D-A2E8-885D80744659}.Release|ARM64.ActiveCfg = Release|Any CPU + {49CD54C4-EB9A-423D-A2E8-885D80744659}.Release|ARM64.Build.0 = Release|Any CPU {49CD54C4-EB9A-423D-A2E8-885D80744659}.Release|iPhone.ActiveCfg = Release|Any CPU {49CD54C4-EB9A-423D-A2E8-885D80744659}.Release|iPhone.Build.0 = Release|Any CPU {49CD54C4-EB9A-423D-A2E8-885D80744659}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU {49CD54C4-EB9A-423D-A2E8-885D80744659}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {49CD54C4-EB9A-423D-A2E8-885D80744659}.Release|x64.ActiveCfg = Release|Any CPU + {49CD54C4-EB9A-423D-A2E8-885D80744659}.Release|x64.Build.0 = Release|Any CPU + {49CD54C4-EB9A-423D-A2E8-885D80744659}.Release|x86.ActiveCfg = Release|Any CPU + {49CD54C4-EB9A-423D-A2E8-885D80744659}.Release|x86.Build.0 = Release|Any CPU {6BC0D61C-8B1E-4AE3-A718-8118CF5F68DD}.Debug|Android.ActiveCfg = Debug|Any CPU {6BC0D61C-8B1E-4AE3-A718-8118CF5F68DD}.Debug|Android.Build.0 = Debug|Any CPU {6BC0D61C-8B1E-4AE3-A718-8118CF5F68DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {6BC0D61C-8B1E-4AE3-A718-8118CF5F68DD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6BC0D61C-8B1E-4AE3-A718-8118CF5F68DD}.Debug|ARM.ActiveCfg = Debug|Any CPU + {6BC0D61C-8B1E-4AE3-A718-8118CF5F68DD}.Debug|ARM.Build.0 = Debug|Any CPU + {6BC0D61C-8B1E-4AE3-A718-8118CF5F68DD}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {6BC0D61C-8B1E-4AE3-A718-8118CF5F68DD}.Debug|ARM64.Build.0 = Debug|Any CPU {6BC0D61C-8B1E-4AE3-A718-8118CF5F68DD}.Debug|iPhone.ActiveCfg = Debug|Any CPU {6BC0D61C-8B1E-4AE3-A718-8118CF5F68DD}.Debug|iPhone.Build.0 = Debug|Any CPU {6BC0D61C-8B1E-4AE3-A718-8118CF5F68DD}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU {6BC0D61C-8B1E-4AE3-A718-8118CF5F68DD}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {6BC0D61C-8B1E-4AE3-A718-8118CF5F68DD}.Debug|x64.ActiveCfg = Debug|Any CPU + {6BC0D61C-8B1E-4AE3-A718-8118CF5F68DD}.Debug|x64.Build.0 = Debug|Any CPU + {6BC0D61C-8B1E-4AE3-A718-8118CF5F68DD}.Debug|x86.ActiveCfg = Debug|Any CPU + {6BC0D61C-8B1E-4AE3-A718-8118CF5F68DD}.Debug|x86.Build.0 = Debug|Any CPU {6BC0D61C-8B1E-4AE3-A718-8118CF5F68DD}.Release|Android.ActiveCfg = Release|Any CPU {6BC0D61C-8B1E-4AE3-A718-8118CF5F68DD}.Release|Android.Build.0 = Release|Any CPU {6BC0D61C-8B1E-4AE3-A718-8118CF5F68DD}.Release|Any CPU.ActiveCfg = Release|Any CPU {6BC0D61C-8B1E-4AE3-A718-8118CF5F68DD}.Release|Any CPU.Build.0 = Release|Any CPU + {6BC0D61C-8B1E-4AE3-A718-8118CF5F68DD}.Release|ARM.ActiveCfg = Release|Any CPU + {6BC0D61C-8B1E-4AE3-A718-8118CF5F68DD}.Release|ARM.Build.0 = Release|Any CPU + {6BC0D61C-8B1E-4AE3-A718-8118CF5F68DD}.Release|ARM64.ActiveCfg = Release|Any CPU + {6BC0D61C-8B1E-4AE3-A718-8118CF5F68DD}.Release|ARM64.Build.0 = Release|Any CPU {6BC0D61C-8B1E-4AE3-A718-8118CF5F68DD}.Release|iPhone.ActiveCfg = Release|Any CPU {6BC0D61C-8B1E-4AE3-A718-8118CF5F68DD}.Release|iPhone.Build.0 = Release|Any CPU {6BC0D61C-8B1E-4AE3-A718-8118CF5F68DD}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU {6BC0D61C-8B1E-4AE3-A718-8118CF5F68DD}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {6BC0D61C-8B1E-4AE3-A718-8118CF5F68DD}.Release|x64.ActiveCfg = Release|Any CPU + {6BC0D61C-8B1E-4AE3-A718-8118CF5F68DD}.Release|x64.Build.0 = Release|Any CPU + {6BC0D61C-8B1E-4AE3-A718-8118CF5F68DD}.Release|x86.ActiveCfg = Release|Any CPU + {6BC0D61C-8B1E-4AE3-A718-8118CF5F68DD}.Release|x86.Build.0 = Release|Any CPU + {772D0C03-592E-4478-A25F-E336BE66E10F}.Debug|Android.ActiveCfg = Debug|Any CPU + {772D0C03-592E-4478-A25F-E336BE66E10F}.Debug|Android.Build.0 = Debug|Any CPU + {772D0C03-592E-4478-A25F-E336BE66E10F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {772D0C03-592E-4478-A25F-E336BE66E10F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {772D0C03-592E-4478-A25F-E336BE66E10F}.Debug|ARM.ActiveCfg = Debug|ARM + {772D0C03-592E-4478-A25F-E336BE66E10F}.Debug|ARM.Build.0 = Debug|ARM + {772D0C03-592E-4478-A25F-E336BE66E10F}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {772D0C03-592E-4478-A25F-E336BE66E10F}.Debug|ARM64.Build.0 = Debug|ARM64 + {772D0C03-592E-4478-A25F-E336BE66E10F}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {772D0C03-592E-4478-A25F-E336BE66E10F}.Debug|iPhone.Build.0 = Debug|Any CPU + {772D0C03-592E-4478-A25F-E336BE66E10F}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {772D0C03-592E-4478-A25F-E336BE66E10F}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {772D0C03-592E-4478-A25F-E336BE66E10F}.Debug|x64.ActiveCfg = Debug|x64 + {772D0C03-592E-4478-A25F-E336BE66E10F}.Debug|x64.Build.0 = Debug|x64 + {772D0C03-592E-4478-A25F-E336BE66E10F}.Debug|x86.ActiveCfg = Debug|x86 + {772D0C03-592E-4478-A25F-E336BE66E10F}.Debug|x86.Build.0 = Debug|x86 + {772D0C03-592E-4478-A25F-E336BE66E10F}.Release|Android.ActiveCfg = Release|Any CPU + {772D0C03-592E-4478-A25F-E336BE66E10F}.Release|Android.Build.0 = Release|Any CPU + {772D0C03-592E-4478-A25F-E336BE66E10F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {772D0C03-592E-4478-A25F-E336BE66E10F}.Release|Any CPU.Build.0 = Release|Any CPU + {772D0C03-592E-4478-A25F-E336BE66E10F}.Release|ARM.ActiveCfg = Release|ARM + {772D0C03-592E-4478-A25F-E336BE66E10F}.Release|ARM.Build.0 = Release|ARM + {772D0C03-592E-4478-A25F-E336BE66E10F}.Release|ARM64.ActiveCfg = Release|ARM64 + {772D0C03-592E-4478-A25F-E336BE66E10F}.Release|ARM64.Build.0 = Release|ARM64 + {772D0C03-592E-4478-A25F-E336BE66E10F}.Release|iPhone.ActiveCfg = Release|Any CPU + {772D0C03-592E-4478-A25F-E336BE66E10F}.Release|iPhone.Build.0 = Release|Any CPU + {772D0C03-592E-4478-A25F-E336BE66E10F}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {772D0C03-592E-4478-A25F-E336BE66E10F}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {772D0C03-592E-4478-A25F-E336BE66E10F}.Release|x64.ActiveCfg = Release|x64 + {772D0C03-592E-4478-A25F-E336BE66E10F}.Release|x64.Build.0 = Release|x64 + {772D0C03-592E-4478-A25F-E336BE66E10F}.Release|x86.ActiveCfg = Release|x86 + {772D0C03-592E-4478-A25F-E336BE66E10F}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Okta.Xamarin/Okta.Xamarin/OidcClient.cs b/Okta.Xamarin/Okta.Xamarin/OidcClient.cs index fed4e220..abf08341 100644 --- a/Okta.Xamarin/Okta.Xamarin/OidcClient.cs +++ b/Okta.Xamarin/Okta.Xamarin/OidcClient.cs @@ -44,16 +44,25 @@ public partial class OidcClient : IOidcClient /// Start the authorization flow. This is an async method and should be awaited. /// /// In case of successful authorization, this Task will return a valid . Clients are responsible for further storage and maintenance of the manager. - public Task SignInWithBrowserAsync() + public +#if WINDOWS_UWP + async +#endif + Task SignInWithBrowserAsync() { validator.Validate(Config); currentTask = new TaskCompletionSource(); GenerateStateCodeVerifierAndChallenge(); currentAuthenticatorbyState.Add(State, this); - this.LaunchBrowser(this.GenerateAuthorizeUrl()); +#if !WINDOWS_UWP + this.LaunchBrowser(this.GenerateAuthorizeUrl()); return currentTask.Task; +#else + await this.LaunchBrowserAsync(this.GenerateAuthorizeUrl()).ConfigureAwait(false); + return await currentTask.Task; +#endif } /// @@ -232,11 +241,11 @@ private string GenerateAuthorizeUrl() string url = baseUri.AbsoluteUri; // remove fragment if any - if (url.Contains('#')) + if (url.Contains("#")) url = url.Substring(0, url.IndexOf('#')); // if url already has a query, then append to it - if (!baseUri.PathAndQuery.Contains('?')) + if (!baseUri.PathAndQuery.Contains("?")) url += "?"; else url += "&";