// C++/WinRT v2.0.250303.1 // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. #pragma once #ifndef WINRT_Windows_Security_Authentication_Web_H #define WINRT_Windows_Security_Authentication_Web_H #include "winrt/base.h" static_assert(winrt::check_version(CPPWINRT_VERSION, "2.0.250303.1"), "Mismatched C++/WinRT headers."); #define CPPWINRT_VERSION "2.0.250303.1" #include "winrt/impl/Windows.Foundation.2.h" #include "winrt/impl/Windows.Foundation.Collections.2.h" #include "winrt/impl/Windows.Security.Authentication.Web.2.h" namespace winrt::impl { template auto consume_Windows_Security_Authentication_Web_IWebAuthenticationBrokerStatics::AuthenticateAsync(winrt::Windows::Security::Authentication::Web::WebAuthenticationOptions const& options, winrt::Windows::Foundation::Uri const& requestUri, winrt::Windows::Foundation::Uri const& callbackUri) const { void* asyncInfo{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->AuthenticateWithCallbackUriAsync(static_cast(options), *(void**)(&requestUri), *(void**)(&callbackUri), &asyncInfo)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->AuthenticateWithCallbackUriAsync(static_cast(options), *(void**)(&requestUri), *(void**)(&callbackUri), &asyncInfo)); } return winrt::Windows::Foundation::IAsyncOperation{ asyncInfo, take_ownership_from_abi }; } template auto consume_Windows_Security_Authentication_Web_IWebAuthenticationBrokerStatics::AuthenticateAsync(winrt::Windows::Security::Authentication::Web::WebAuthenticationOptions const& options, winrt::Windows::Foundation::Uri const& requestUri) const { void* asyncInfo{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->AuthenticateWithoutCallbackUriAsync(static_cast(options), *(void**)(&requestUri), &asyncInfo)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->AuthenticateWithoutCallbackUriAsync(static_cast(options), *(void**)(&requestUri), &asyncInfo)); } return winrt::Windows::Foundation::IAsyncOperation{ asyncInfo, take_ownership_from_abi }; } template auto consume_Windows_Security_Authentication_Web_IWebAuthenticationBrokerStatics::GetCurrentApplicationCallbackUri() const { void* callbackUri{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->GetCurrentApplicationCallbackUri(&callbackUri)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->GetCurrentApplicationCallbackUri(&callbackUri)); } return winrt::Windows::Foundation::Uri{ callbackUri, take_ownership_from_abi }; } template auto consume_Windows_Security_Authentication_Web_IWebAuthenticationBrokerStatics2::AuthenticateAndContinue(winrt::Windows::Foundation::Uri const& requestUri) const { if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->AuthenticateAndContinue(*(void**)(&requestUri))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->AuthenticateAndContinue(*(void**)(&requestUri))); } } template auto consume_Windows_Security_Authentication_Web_IWebAuthenticationBrokerStatics2::AuthenticateAndContinue(winrt::Windows::Foundation::Uri const& requestUri, winrt::Windows::Foundation::Uri const& callbackUri) const { if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->AuthenticateWithCallbackUriAndContinue(*(void**)(&requestUri), *(void**)(&callbackUri))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->AuthenticateWithCallbackUriAndContinue(*(void**)(&requestUri), *(void**)(&callbackUri))); } } template auto consume_Windows_Security_Authentication_Web_IWebAuthenticationBrokerStatics2::AuthenticateAndContinue(winrt::Windows::Foundation::Uri const& requestUri, winrt::Windows::Foundation::Uri const& callbackUri, winrt::Windows::Foundation::Collections::ValueSet const& continuationData, winrt::Windows::Security::Authentication::Web::WebAuthenticationOptions const& options) const { if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->AuthenticateWithCallbackUriContinuationDataAndOptionsAndContinue(*(void**)(&requestUri), *(void**)(&callbackUri), *(void**)(&continuationData), static_cast(options))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->AuthenticateWithCallbackUriContinuationDataAndOptionsAndContinue(*(void**)(&requestUri), *(void**)(&callbackUri), *(void**)(&continuationData), static_cast(options))); } } template auto consume_Windows_Security_Authentication_Web_IWebAuthenticationBrokerStatics2::AuthenticateSilentlyAsync(winrt::Windows::Foundation::Uri const& requestUri) const { void* asyncInfo{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->AuthenticateSilentlyAsync(*(void**)(&requestUri), &asyncInfo)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->AuthenticateSilentlyAsync(*(void**)(&requestUri), &asyncInfo)); } return winrt::Windows::Foundation::IAsyncOperation{ asyncInfo, take_ownership_from_abi }; } template auto consume_Windows_Security_Authentication_Web_IWebAuthenticationBrokerStatics2::AuthenticateSilentlyAsync(winrt::Windows::Foundation::Uri const& requestUri, winrt::Windows::Security::Authentication::Web::WebAuthenticationOptions const& options) const { void* asyncInfo{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->AuthenticateSilentlyWithOptionsAsync(*(void**)(&requestUri), static_cast(options), &asyncInfo)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->AuthenticateSilentlyWithOptionsAsync(*(void**)(&requestUri), static_cast(options), &asyncInfo)); } return winrt::Windows::Foundation::IAsyncOperation{ asyncInfo, take_ownership_from_abi }; } template auto consume_Windows_Security_Authentication_Web_IWebAuthenticationResult::ResponseData() const { void* value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_ResponseData(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_ResponseData(&value)); } return hstring{ value, take_ownership_from_abi }; } template auto consume_Windows_Security_Authentication_Web_IWebAuthenticationResult::ResponseStatus() const { winrt::Windows::Security::Authentication::Web::WebAuthenticationStatus value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_ResponseStatus(reinterpret_cast(&value))); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_ResponseStatus(reinterpret_cast(&value))); } return value; } template auto consume_Windows_Security_Authentication_Web_IWebAuthenticationResult::ResponseErrorDetail() const { uint32_t value{}; if constexpr (!std::is_same_v) { winrt::hresult _winrt_cast_result_code; auto const _winrt_casted_result = impl::try_as_with_reason(static_cast(this), _winrt_cast_result_code); check_hresult(_winrt_cast_result_code); auto const _winrt_abi_type = *(abi_t**)&_winrt_casted_result; check_hresult(_winrt_abi_type->get_ResponseErrorDetail(&value)); } else { auto const _winrt_abi_type = *(abi_t**)this; check_hresult(_winrt_abi_type->get_ResponseErrorDetail(&value)); } return value; } #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall AuthenticateWithCallbackUriAsync(uint32_t options, void* requestUri, void* callbackUri, void** asyncInfo) noexcept final try { clear_abi(asyncInfo); typename D::abi_guard guard(this->shim()); *asyncInfo = detach_from>(this->shim().AuthenticateAsync(*reinterpret_cast(&options), *reinterpret_cast(&requestUri), *reinterpret_cast(&callbackUri))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall AuthenticateWithoutCallbackUriAsync(uint32_t options, void* requestUri, void** asyncInfo) noexcept final try { clear_abi(asyncInfo); typename D::abi_guard guard(this->shim()); *asyncInfo = detach_from>(this->shim().AuthenticateAsync(*reinterpret_cast(&options), *reinterpret_cast(&requestUri))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall GetCurrentApplicationCallbackUri(void** callbackUri) noexcept final try { clear_abi(callbackUri); typename D::abi_guard guard(this->shim()); *callbackUri = detach_from(this->shim().GetCurrentApplicationCallbackUri()); return 0; } catch (...) { return to_hresult(); } }; #endif #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall AuthenticateAndContinue(void* requestUri) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().AuthenticateAndContinue(*reinterpret_cast(&requestUri)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall AuthenticateWithCallbackUriAndContinue(void* requestUri, void* callbackUri) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().AuthenticateAndContinue(*reinterpret_cast(&requestUri), *reinterpret_cast(&callbackUri)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall AuthenticateWithCallbackUriContinuationDataAndOptionsAndContinue(void* requestUri, void* callbackUri, void* continuationData, uint32_t options) noexcept final try { typename D::abi_guard guard(this->shim()); this->shim().AuthenticateAndContinue(*reinterpret_cast(&requestUri), *reinterpret_cast(&callbackUri), *reinterpret_cast(&continuationData), *reinterpret_cast(&options)); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall AuthenticateSilentlyAsync(void* requestUri, void** asyncInfo) noexcept final try { clear_abi(asyncInfo); typename D::abi_guard guard(this->shim()); *asyncInfo = detach_from>(this->shim().AuthenticateSilentlyAsync(*reinterpret_cast(&requestUri))); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall AuthenticateSilentlyWithOptionsAsync(void* requestUri, uint32_t options, void** asyncInfo) noexcept final try { clear_abi(asyncInfo); typename D::abi_guard guard(this->shim()); *asyncInfo = detach_from>(this->shim().AuthenticateSilentlyAsync(*reinterpret_cast(&requestUri), *reinterpret_cast(&options))); return 0; } catch (...) { return to_hresult(); } }; #endif #ifndef WINRT_LEAN_AND_MEAN template struct produce : produce_base { int32_t __stdcall get_ResponseData(void** value) noexcept final try { clear_abi(value); typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().ResponseData()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_ResponseStatus(int32_t* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().ResponseStatus()); return 0; } catch (...) { return to_hresult(); } int32_t __stdcall get_ResponseErrorDetail(uint32_t* value) noexcept final try { typename D::abi_guard guard(this->shim()); *value = detach_from(this->shim().ResponseErrorDetail()); return 0; } catch (...) { return to_hresult(); } }; #endif } WINRT_EXPORT namespace winrt::Windows::Security::Authentication::Web { constexpr auto operator|(WebAuthenticationOptions const left, WebAuthenticationOptions const right) noexcept { return static_cast(impl::to_underlying_type(left) | impl::to_underlying_type(right)); } constexpr auto operator|=(WebAuthenticationOptions& left, WebAuthenticationOptions const right) noexcept { left = left | right; return left; } constexpr auto operator&(WebAuthenticationOptions const left, WebAuthenticationOptions const right) noexcept { return static_cast(impl::to_underlying_type(left) & impl::to_underlying_type(right)); } constexpr auto operator&=(WebAuthenticationOptions& left, WebAuthenticationOptions const right) noexcept { left = left & right; return left; } constexpr auto operator~(WebAuthenticationOptions const value) noexcept { return static_cast(~impl::to_underlying_type(value)); } constexpr auto operator^(WebAuthenticationOptions const left, WebAuthenticationOptions const right) noexcept { return static_cast(impl::to_underlying_type(left) ^ impl::to_underlying_type(right)); } constexpr auto operator^=(WebAuthenticationOptions& left, WebAuthenticationOptions const right) noexcept { left = left ^ right; return left; } inline auto WebAuthenticationBroker::AuthenticateAsync(winrt::Windows::Security::Authentication::Web::WebAuthenticationOptions const& options, winrt::Windows::Foundation::Uri const& requestUri, winrt::Windows::Foundation::Uri const& callbackUri) { return impl::call_factory([&](IWebAuthenticationBrokerStatics const& f) { return f.AuthenticateAsync(options, requestUri, callbackUri); }); } inline auto WebAuthenticationBroker::AuthenticateAsync(winrt::Windows::Security::Authentication::Web::WebAuthenticationOptions const& options, winrt::Windows::Foundation::Uri const& requestUri) { return impl::call_factory([&](IWebAuthenticationBrokerStatics const& f) { return f.AuthenticateAsync(options, requestUri); }); } inline auto WebAuthenticationBroker::GetCurrentApplicationCallbackUri() { return impl::call_factory_cast([](IWebAuthenticationBrokerStatics const& f) { return f.GetCurrentApplicationCallbackUri(); }); } inline auto WebAuthenticationBroker::AuthenticateAndContinue(winrt::Windows::Foundation::Uri const& requestUri) { impl::call_factory([&](IWebAuthenticationBrokerStatics2 const& f) { return f.AuthenticateAndContinue(requestUri); }); } inline auto WebAuthenticationBroker::AuthenticateAndContinue(winrt::Windows::Foundation::Uri const& requestUri, winrt::Windows::Foundation::Uri const& callbackUri) { impl::call_factory([&](IWebAuthenticationBrokerStatics2 const& f) { return f.AuthenticateAndContinue(requestUri, callbackUri); }); } inline auto WebAuthenticationBroker::AuthenticateAndContinue(winrt::Windows::Foundation::Uri const& requestUri, winrt::Windows::Foundation::Uri const& callbackUri, winrt::Windows::Foundation::Collections::ValueSet const& continuationData, winrt::Windows::Security::Authentication::Web::WebAuthenticationOptions const& options) { impl::call_factory([&](IWebAuthenticationBrokerStatics2 const& f) { return f.AuthenticateAndContinue(requestUri, callbackUri, continuationData, options); }); } inline auto WebAuthenticationBroker::AuthenticateSilentlyAsync(winrt::Windows::Foundation::Uri const& requestUri) { return impl::call_factory([&](IWebAuthenticationBrokerStatics2 const& f) { return f.AuthenticateSilentlyAsync(requestUri); }); } inline auto WebAuthenticationBroker::AuthenticateSilentlyAsync(winrt::Windows::Foundation::Uri const& requestUri, winrt::Windows::Security::Authentication::Web::WebAuthenticationOptions const& options) { return impl::call_factory([&](IWebAuthenticationBrokerStatics2 const& f) { return f.AuthenticateSilentlyAsync(requestUri, options); }); } } namespace std { #ifndef WINRT_LEAN_AND_MEAN template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; template<> struct hash : winrt::impl::hash_base {}; #endif #ifdef __cpp_lib_format #endif } #endif