tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

MockHttpAuth.cpp (1680B)


      1 /* vim:set ts=4 sw=2 sts=2 et ci: */
      2 /* This Source Code Form is subject to the terms of the Mozilla Public
      3 * License, v. 2.0. If a copy of the MPL was not distributed with this
      4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      5 
      6 // HttpLog.h should generally be included first
      7 #include "HttpLog.h"
      8 
      9 #include "MockHttpAuth.h"
     10 
     11 namespace mozilla::net {
     12 
     13 NS_IMPL_ISUPPORTS(MockHttpAuth, nsIHttpAuthenticator)
     14 
     15 NS_IMETHODIMP MockHttpAuth::ChallengeReceived(
     16    nsIHttpAuthenticableChannel* aChannel, const nsACString& aChallenge,
     17    bool aProxyAuth, nsISupports** aSessionState,
     18    nsISupports** aContinuationState, bool* aInvalidatesIdentity) {
     19  *aInvalidatesIdentity = false;
     20  return NS_OK;
     21 }
     22 
     23 NS_IMETHODIMP MockHttpAuth::GenerateCredentialsAsync(
     24    nsIHttpAuthenticableChannel* aChannel,
     25    nsIHttpAuthenticatorCallback* aCallback, const nsACString& aChallenge,
     26    bool aProxyAuth, const nsAString& aDomain, const nsAString& aUser,
     27    const nsAString& aPassword, nsISupports* aSessionState,
     28    nsISupports* aContinuationState, nsICancelable** aCancel) {
     29  return NS_ERROR_NOT_IMPLEMENTED;
     30 }
     31 
     32 NS_IMETHODIMP MockHttpAuth::GenerateCredentials(
     33    nsIHttpAuthenticableChannel* aChannel, const nsACString& aChallenge,
     34    bool aProxyAuth, const nsAString& aDomain, const nsAString& aUser,
     35    const nsAString& aPassword, nsISupports** aSessionState,
     36    nsISupports** aContinuationState, uint32_t* aFlags, nsACString& _retval) {
     37  _retval.Assign("moz_test_credentials");
     38  return NS_OK;
     39 }
     40 
     41 NS_IMETHODIMP MockHttpAuth::GetAuthFlags(uint32_t* aAuthFlags) {
     42  *aAuthFlags |= nsIHttpAuthenticator::CONNECTION_BASED;
     43  return NS_OK;
     44 }
     45 
     46 }  // namespace mozilla::net