nsHttpBasicAuth.h (1122B)
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 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 #ifndef nsBasicAuth_h__ 7 #define nsBasicAuth_h__ 8 9 #include "nsIHttpAuthenticator.h" 10 #include "mozilla/StaticPtr.h" 11 12 namespace mozilla { 13 namespace net { 14 15 //----------------------------------------------------------------------------- 16 // The nsHttpBasicAuth class produces HTTP Basic-auth responses for a username/ 17 // (optional)password pair, BASE64("user:pass"). 18 //----------------------------------------------------------------------------- 19 20 class nsHttpBasicAuth : public nsIHttpAuthenticator { 21 public: 22 NS_DECL_ISUPPORTS 23 NS_DECL_NSIHTTPAUTHENTICATOR 24 25 nsHttpBasicAuth() = default; 26 27 static already_AddRefed<nsIHttpAuthenticator> GetOrCreate(); 28 29 private: 30 virtual ~nsHttpBasicAuth() = default; 31 32 static StaticRefPtr<nsHttpBasicAuth> gSingleton; 33 }; 34 35 } // namespace net 36 } // namespace mozilla 37 38 #endif // !nsHttpBasicAuth_h__