Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OAuth2Manager Implementation #4828

Merged
merged 10 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PackageVersion Include="Microsoft.ProjectReunion.InteractiveExperiences.TransportPackage" Version="1.8.0-CI-26107.1720.241003-1631.3" />
<PackageVersion Include="Microsoft.Windows.CsWinRT" Version="$(MicrosoftWindowsCsWinRTPackageVersion)" />
<PackageVersion Include="Microsoft.SourceLink.Common" Version="$(MicrosoftSourceLinkCommonVersion)" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="$(MicrosoftSourceLinkGitHubVersion)" />
Expand Down
26 changes: 26 additions & 0 deletions WindowsAppRuntime.sln
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,12 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PackageManager.Test.M.White
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PackageManager.Test.M.White.msix", "test\PackageManager\data\PackageManager.Test.M.White.msix\PackageManager.Test.M.White.msix.vcxproj", "{28DCF9CE-D9F4-4A7D-8AD1-F2EFC0D3B4DF}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "OAuth", "OAuth", "{1A6F936D-7350-4177-8195-146BDDFACF3B}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OAuth", "dev\OAuth\OAuth.vcxitems", "{3E7FD510-8B66-40E7-A80B-780CB8972F83}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Security.Authentication.OAuth.Projection", "dev\Projections\CS\Microsoft.Security.Authentication.OAuth\Microsoft.Security.Authentication.OAuth.Projection.csproj", "{1D24CC70-85B1-4864-B847-3328F40AF01E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -1871,6 +1877,22 @@ Global
{28DCF9CE-D9F4-4A7D-8AD1-F2EFC0D3B4DF}.Release|x64.Build.0 = Release|x64
{28DCF9CE-D9F4-4A7D-8AD1-F2EFC0D3B4DF}.Release|x86.ActiveCfg = Release|Win32
{28DCF9CE-D9F4-4A7D-8AD1-F2EFC0D3B4DF}.Release|x86.Build.0 = Release|Win32
{1D24CC70-85B1-4864-B847-3328F40AF01E}.Debug|Any CPU.ActiveCfg = Debug|x64
{1D24CC70-85B1-4864-B847-3328F40AF01E}.Debug|Any CPU.Build.0 = Debug|x64
{1D24CC70-85B1-4864-B847-3328F40AF01E}.Debug|ARM64.ActiveCfg = Debug|arm64
{1D24CC70-85B1-4864-B847-3328F40AF01E}.Debug|ARM64.Build.0 = Debug|arm64
{1D24CC70-85B1-4864-B847-3328F40AF01E}.Debug|x64.ActiveCfg = Debug|x64
{1D24CC70-85B1-4864-B847-3328F40AF01E}.Debug|x64.Build.0 = Debug|x64
{1D24CC70-85B1-4864-B847-3328F40AF01E}.Debug|x86.ActiveCfg = Debug|x86
{1D24CC70-85B1-4864-B847-3328F40AF01E}.Debug|x86.Build.0 = Debug|x86
{1D24CC70-85B1-4864-B847-3328F40AF01E}.Release|Any CPU.ActiveCfg = Release|x64
{1D24CC70-85B1-4864-B847-3328F40AF01E}.Release|Any CPU.Build.0 = Release|x64
{1D24CC70-85B1-4864-B847-3328F40AF01E}.Release|ARM64.ActiveCfg = Release|arm64
{1D24CC70-85B1-4864-B847-3328F40AF01E}.Release|ARM64.Build.0 = Release|arm64
{1D24CC70-85B1-4864-B847-3328F40AF01E}.Release|x64.ActiveCfg = Release|x64
{1D24CC70-85B1-4864-B847-3328F40AF01E}.Release|x64.Build.0 = Release|x64
{1D24CC70-85B1-4864-B847-3328F40AF01E}.Release|x86.ActiveCfg = Release|x86
{1D24CC70-85B1-4864-B847-3328F40AF01E}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -2033,6 +2055,9 @@ Global
{7C240089-0F22-4247-9C91-51255C8DC18B} = {6213B1A3-E854-498F-AAFA-4CFC1E71023E}
{AC79B8FF-4C27-4326-AD20-BBC70059FF51} = {7C240089-0F22-4247-9C91-51255C8DC18B}
{28DCF9CE-D9F4-4A7D-8AD1-F2EFC0D3B4DF} = {6759ECC6-9381-4172-89E6-853F81A03D28}
{1A6F936D-7350-4177-8195-146BDDFACF3B} = {448ED2E5-0B37-4D97-9E6B-8C10A507976A}
{3E7FD510-8B66-40E7-A80B-780CB8972F83} = {1A6F936D-7350-4177-8195-146BDDFACF3B}
{1D24CC70-85B1-4864-B847-3328F40AF01E} = {716C26A0-E6B0-4981-8412-D14A4D410531}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4B3D7591-CFEC-4762-9A07-ABE99938FB77}
Expand All @@ -2041,6 +2066,7 @@ Global
test\inc\inc.vcxitems*{08bc78e0-63c6-49a7-81b3-6afc3deac4de}*SharedItemsImports = 4
dev\PushNotifications\PushNotifications.vcxitems*{103c0c23-7ba8-4d44-a63c-83488e2e3a81}*SharedItemsImports = 9
dev\EnvironmentManager\API\Microsoft.Process.Environment.vcxitems*{2f3fad1b-d3df-4866-a3a3-c2c777d55638}*SharedItemsImports = 9
dev\OAuth\OAuth.vcxitems*{3e7fd510-8b66-40e7-a80b-780cb8972f83}*SharedItemsImports = 9
test\inc\inc.vcxitems*{412d023e-8635-4ad2-a0ea-e19e08d36915}*SharedItemsImports = 4
test\inc\inc.vcxitems*{4b30c685-8490-440f-9879-a75d45daa361}*SharedItemsImports = 4
dev\UndockedRegFreeWinRT\UndockedRegFreeWinRT.vcxitems*{56371ca6-144b-4989-a4e9-391ad4fa7651}*SharedItemsImports = 9
Expand Down
4 changes: 4 additions & 0 deletions build/CopyFilesToStagingDir.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windo
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.Management.Deployment.winmd $FullPublishDir\Microsoft.WindowsAppRuntime\
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.PushNotifications.winmd $FullPublishDir\Microsoft.WindowsAppRuntime\
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.Security.AccessControl.winmd $FullPublishDir\Microsoft.WindowsAppRuntime\
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Security.Authentication.OAuth.winmd $FullPublishDir\Microsoft.WindowsAppRuntime\
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.Storage.winmd $FullPublishDir\Microsoft.WindowsAppRuntime\
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.System.Power.winmd $FullPublishDir\Microsoft.WindowsAppRuntime\
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.System.winmd $FullPublishDir\Microsoft.WindowsAppRuntime\
Expand Down Expand Up @@ -118,6 +119,8 @@ PublishFile $FullBuildOutput\Microsoft.Windows.PushNotifications.Projection\Micr
PublishFile $FullBuildOutput\Microsoft.Windows.PushNotifications.Projection\Microsoft.Windows.PushNotifications.Projection.pdb $NugetDir\lib\net6.0-windows10.0.17763.0
PublishFile $FullBuildOutput\Microsoft.Windows.Security.AccessControl.Projection\Microsoft.Windows.Security.AccessControl.Projection.dll $NugetDir\lib\net6.0-windows10.0.17763.0
PublishFile $FullBuildOutput\Microsoft.Windows.Security.AccessControl.Projection\Microsoft.Windows.Security.AccessControl.Projection.pdb $NugetDir\lib\net6.0-windows10.0.17763.0
PublishFile $FullBuildOutput\Microsoft.Security.Authentication.OAuth.Projection\Microsoft.Security.Authentication.OAuth.Projection.dll $NugetDir\lib\net6.0-windows10.0.17763.0
PublishFile $FullBuildOutput\Microsoft.Security.Authentication.OAuth.Projection\Microsoft.Security.Authentication.OAuth.Projection.pdb $NugetDir\lib\net6.0-windows10.0.17763.0
PublishFile $FullBuildOutput\Microsoft.Windows.Storage.Projection\Microsoft.Windows.Storage.Projection.dll $NugetDir\lib\net6.0-windows10.0.17763.0
PublishFile $FullBuildOutput\Microsoft.Windows.Storage.Projection\Microsoft.Windows.Storage.Projection.pdb $NugetDir\lib\net6.0-windows10.0.17763.0
PublishFile $FullBuildOutput\Microsoft.Windows.System.Power.Projection\Microsoft.Windows.System.Power.Projection.dll $NugetDir\lib\net6.0-windows10.0.17763.0
Expand Down Expand Up @@ -186,6 +189,7 @@ PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windo
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.Management.Deployment.winmd $NugetDir\lib\uap10.0
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.PushNotifications.winmd $NugetDir\lib\uap10.0
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.Security.AccessControl.winmd $NugetDir\lib\uap10.0
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Security.Authentication.OAuth.winmd $NugetDir\lib\uap10.0
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.Storage.winmd $NugetDir\lib\uap10.0
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.System.Power.winmd $NugetDir\lib\uap10.0
PublishFile $FullBuildOutput\WindowsAppRuntime_DLL\StrippedWinMD\Microsoft.Windows.System.winmd $NugetDir\lib\uap10.0
Expand Down
6 changes: 6 additions & 0 deletions build/NuSpecs/AppxManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@
<Path>Microsoft.WindowsAppRuntime.dll</Path>
<!-- NOTE: Keep ActivationClass elements sorted by absolute ActivatableClassId (namespace.class) -->

<!-- OAuth -->
<ActivatableClass ActivatableClassId="Microsoft.Security.Authentication.OAuth.OAuth2Manager" ThreadingModel="both" />
<ActivatableClass ActivatableClassId="Microsoft.Security.Authentication.OAuth.AuthRequestParams" ThreadingModel="both" />
<ActivatableClass ActivatableClassId="Microsoft.Security.Authentication.OAuth.ClientAuthentication" ThreadingModel="both" />
<ActivatableClass ActivatableClassId="Microsoft.Security.Authentication.OAuth.TokenRequestParams" ThreadingModel="both" />

<!-- Dynamic Dependency -->
<ActivatableClass ActivatableClassId="Microsoft.Windows.ApplicationModel.DynamicDependency.AddPackageDependencyOptions" ThreadingModel="both" />
<ActivatableClass ActivatableClassId="Microsoft.Windows.ApplicationModel.DynamicDependency.CreatePackageDependencyOptions" ThreadingModel="both" />
Expand Down
8 changes: 7 additions & 1 deletion build/NuSpecs/WindowsAppSDK-Nuget-Native.WinRt.props
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE in the project root for license information. -->
<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE in the project root for license information. -->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
Expand Down Expand Up @@ -53,6 +53,12 @@
<Implementation Condition="'$(WindowsAppSDKFrameworkPackage)' != 'true'">$(MSBuildThisFileDirectory)..\..\runtimes\win10-$(_WindowsAppSDKFoundationPlatform)\native\Microsoft.WindowsAppRuntime.dll</Implementation>
<IsWinMDFile>true</IsWinMDFile>
</Reference>
<Reference Include="Microsoft.Security.Authentication.OAuth.winmd"
Condition="Exists('$(MSBuildThisFileDirectory)..\..\lib\uap10.0\Microsoft.Security.Authentication.OAuth.winmd')">
<HintPath>$(MSBuildThisFileDirectory)..\..\lib\uap10.0\Microsoft.Security.Authentication.OAuth.winmd</HintPath>
<Implementation Condition="'$(WindowsAppSDKFrameworkPackage)' != 'true'">$(MSBuildThisFileDirectory)..\..\runtimes\win10-$(_WindowsAppSDKFoundationPlatform)\native\Microsoft.WindowsAppRuntime.dll</Implementation>
<IsWinMDFile>true</IsWinMDFile>
</Reference>
</ItemGroup>

</Project>
9 changes: 8 additions & 1 deletion build/NuSpecs/WindowsAppSDK-Nuget-Native.targets
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE in the project root for license information. -->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

Expand Down Expand Up @@ -74,6 +74,13 @@
<Implementation>Microsoft.WindowsAppRuntime.dll</Implementation>
</Reference>
</ItemGroup>
<ItemGroup>
<Reference Include="$(MSBuildThisFileDirectory)..\..\lib\uap10.0\Microsoft.Security.Authentication.OAuth.winmd"
Condition="Exists('$(MSBuildThisFileDirectory)..\..\lib\uap10.0\Microsoft.Security.Authentication.OAuth.winmd')">
<Private>false</Private>
<Implementation>Microsoft.WindowsAppRuntime.dll</Implementation>
</Reference>
</ItemGroup>

<Import Project="$(MSBuildThisFileDirectory)..\Microsoft.WindowsAppSDK.BootstrapCommon.targets" />
<Import Project="$(MSBuildThisFileDirectory)WindowsAppSDK-Nuget-Native.Bootstrap.targets" Condition="'$(WindowsAppSdkBootstrapInitialize)' == 'true'"/>
Expand Down
1 change: 1 addition & 0 deletions dev/Common/Common.vcxitems
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
<ClInclude Include="$(MSBuildThisFileDirectory)Microsoft.Utf8.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)NotificationTelemetryHelper.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)Security.IntegrityLevel.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)TelemetryHelper.h" />

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:space

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

<ClInclude Include="$(MSBuildThisFileDirectory)WindowsAppRuntime.SelfContained.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)WindowsAppRuntime.VersionInfo.h" />
<ClInclude Include="$(MSBuildThisFileDirectory)winrt_WindowsAppRuntime.h" />
Expand Down
3 changes: 3 additions & 0 deletions dev/Common/Common.vcxitems.filters
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
</ClInclude>
<ClInclude Include="$(MSBuildThisFileDirectory)winrt_WindowsAppRuntime.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="$(MSBuildThisFileDirectory)TelemetryHelper.h">

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:space

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
Expand Down
47 changes: 47 additions & 0 deletions dev/Common/TelemetryHelper.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// Copyright (c) Microsoft Corporation and Contributors.
// Licensed under the MIT License.
#pragma once
class TelemetryHelper
{
public:
TelemetryHelper()
: m_isPackagedApp(AppModel::Identity::IsPackagedProcess()),
m_appName(m_isPackagedApp ? GetAppNamePackaged() : GetAppNameUnpackaged())
{
}

inline bool IsPackagedApp() const
{
return m_isPackagedApp;
}

inline const std::wstring& GetAppName() const
{
return m_appName;
}

private:
const bool m_isPackagedApp{ false };
const std::wstring m_appName;

std::wstring GetAppNamePackaged() const
{
wchar_t appUserModelId[APPLICATION_USER_MODEL_ID_MAX_LENGTH]{};
UINT32 appUserModelIdSize{ ARRAYSIZE(appUserModelId) };
THROW_IF_WIN32_ERROR(::GetCurrentApplicationUserModelId(&appUserModelIdSize, appUserModelId));
return appUserModelId;
}

std::wstring CensorFilePath(const std::wstring& filepath) const
{
return { !PathIsFileSpecW(filepath.c_str()) ? PathFindFileNameW(filepath.c_str()) : filepath };
}

std::wstring GetAppNameUnpackaged() const
{
std::wstring appName;
wil::unique_cotaskmem_string processName;
THROW_IF_FAILED(wil::GetModuleFileNameExW(GetCurrentProcess(), nullptr, processName));
return CensorFilePath(processName.get());
}
};
32 changes: 32 additions & 0 deletions dev/Common/TerminalVelocityFeatures-OAuth.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

// THIS FILE IS AUTOMATICALLY GENERATED; DO NOT EDIT IT

// INPUT FILE: dev\common\TerminalVelocityFeatures-OAuth.xml
// OPTIONS: -Channel Experimental -Language C++ -Namespace Microsoft.Security.Authentication.OAuth -Path dev\common\TerminalVelocityFeatures-OAuth.xml -Output dev\common\TerminalVelocityFeatures-OAuth.h

#if defined(__midlrt)
namespace features
{
feature_name Feature_OAuth = { DisabledByDefault, FALSE };
}
#endif // defined(__midlrt)

// Feature constants
#define WINDOWSAPPRUNTIME_MICROSOFT_SECURITY_AUTHENTICATION_OAUTH_FEATURE_OAUTH_ENABLED 1

#if defined(__cplusplus)

namespace Microsoft::Security::Authentication::OAuth
{

__pragma(detect_mismatch("ODR_violation_WINDOWSAPPRUNTIME_MICROSOFT_WINDOWS_SECURITY_AUTHENTICATION_OAUTH_FEATURE_OAUTH_ENABLED_mismatch", "AlwaysEnabled"))
struct Feature_OAuth
{
static constexpr bool IsEnabled() { return WINDOWSAPPRUNTIME_MICROSOFT_SECURITY_AUTHENTICATION_OAUTH_FEATURE_OAUTH_ENABLED == 1; }
};

} // namespace Microsoft.Security.Authentication.OAuth

#endif // defined(__cplusplus)
16 changes: 16 additions & 0 deletions dev/Common/TerminalVelocityFeatures-OAuth.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0"?>
<features xmlns="http://microsoft.com/windowsappsdk/TerminalVelocity/20210729/TerminalVelocityFeatures.xsd">

<!-- Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License. See LICENSE in the project root for license information.
-->

<!-- See docs/Coding-Guidelines/TerminalVelocity.md for more info. -->

<!-- Enabled variants -->
<feature>
<name>Feature_OAuth</name>
<description>OAuth for the WindowsAppRuntime</description>
<state>AlwaysEnabled</state>
</feature>
</features>
83 changes: 83 additions & 0 deletions dev/OAuth/AuthFailure.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
#include <pch.h>
#include "common.h"

#include "AuthFailure.h"

#include <Microsoft.Security.Authentication.OAuth.AuthFailure.g.cpp>

using namespace std::literals;
using namespace winrt::Microsoft::Security::Authentication::OAuth;
using namespace winrt::Windows::Foundation;
using namespace winrt::Windows::Foundation::Collections;

namespace winrt::Microsoft::Security::Authentication::OAuth::implementation
{
AuthFailure::AuthFailure(const Uri& responseUri)
{
std::map<winrt::hstring, winrt::hstring> additionalParams;

auto parseComponents = [&](const winrt::hstring& str) {
if (str.empty())
{
return; // Avoid unnecessary construction/activation
}

for (auto&& entry : WwwFormUrlDecoder(str))
{
auto name = entry.Name();
if (name == L"error"sv)
{
m_error = entry.Value();
}
else if (name == L"error_description"sv)
{
m_errorDescription = entry.Value();
}
else if (name == L"error_uri"sv)
{
m_errorUri = Uri(entry.Value());
}
else if (name == L"state"sv)
{
m_state = entry.Value();
}
else
{
additionalParams.emplace(std::move(name), entry.Value());
}
}
};

parseComponents(responseUri.Query());
parseComponents(fragment_component(responseUri));

m_additionalParams = winrt::single_threaded_map(std::move(additionalParams)).GetView();
}

winrt::hstring AuthFailure::Error()
{
return m_error;
}

winrt::hstring AuthFailure::ErrorDescription()
{
return m_errorDescription;
}

Uri AuthFailure::ErrorUri()
{
return m_errorUri;
}

winrt::hstring AuthFailure::State()
{
return m_state;
}

IMapView<winrt::hstring, winrt::hstring> AuthFailure::AdditionalParams()
{
return m_additionalParams;
}
}
25 changes: 25 additions & 0 deletions dev/OAuth/AuthFailure.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
#pragma once
#include <Microsoft.Security.Authentication.OAuth.AuthFailure.g.h>

namespace winrt::Microsoft::Security::Authentication::OAuth::implementation
{
struct AuthFailure : AuthFailureT<AuthFailure>
{
AuthFailure(const foundation::Uri& responseUri);

winrt::hstring Error();
winrt::hstring ErrorDescription();
foundation::Uri ErrorUri();
winrt::hstring State();
collections::IMapView<winrt::hstring, winrt::hstring> AdditionalParams();

private:
winrt::hstring m_error;
winrt::hstring m_errorDescription;
foundation::Uri m_errorUri{ nullptr };
winrt::hstring m_state;
collections::IMapView<winrt::hstring, winrt::hstring> m_additionalParams;
};
}
Loading
Loading