IdentityNetworkHelpers.h (1913B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef mozilla_dom_IdentityNetworkHelpers_h 8 #define mozilla_dom_IdentityNetworkHelpers_h 9 10 #include "mozilla/Components.h" 11 #include "mozilla/MozPromise.h" 12 #include "mozilla/dom/IdentityCredentialBinding.h" 13 #include "mozilla/dom/Promise-inl.h" 14 #include "mozilla/dom/Promise.h" 15 #include "mozilla/dom/Request.h" 16 #include "mozilla/dom/Response.h" 17 #include "mozilla/dom/WindowGlobalParent.h" 18 #include "nsICredentialChooserService.h" 19 20 namespace mozilla::dom { 21 22 class IdentityNetworkHelpers { 23 public: 24 static RefPtr<MozPromise<IdentityProviderWellKnown, nsresult, true>> 25 FetchWellKnownHelper(nsIURI* aWellKnown, nsIPrincipal* aTriggeringPrincipal); 26 27 static RefPtr<MozPromise< 28 std::tuple<Maybe<IdentityProviderWellKnown>, IdentityProviderAPIConfig>, 29 nsresult, true>> 30 FetchConfigHelper(nsIURI* aConfig, nsIPrincipal* aTriggeringPrincipal, 31 Maybe<IdentityProviderWellKnown> aWellKnownConfig); 32 33 static RefPtr<MozPromise<IdentityProviderAccountList, nsresult, true>> 34 FetchAccountsHelper(nsIURI* aAccountsEndpoint, 35 nsIPrincipal* aTriggeringPrincipal); 36 37 static RefPtr<MozPromise<IdentityAssertionResponse, nsresult, true>> 38 FetchTokenHelper(nsIURI* aAccountsEndpoint, const nsCString& aBody, 39 nsIPrincipal* aTriggeringPrincipal); 40 41 static RefPtr<MozPromise<DisconnectedAccount, nsresult, true>> 42 FetchDisconnectHelper(nsIURI* aAccountsEndpoint, const nsCString& aBody, 43 nsIPrincipal* aTriggeringPrincipal); 44 }; 45 46 } // namespace mozilla::dom 47 48 #endif // mozilla_dom_IdentityNetworkHelpers_h