nsAuthGSSAPI.h (1942B)
1 /* vim:set ts=4 sw=2 et cindent: */ 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 nsAuthGSSAPI_h__ 7 #define nsAuthGSSAPI_h__ 8 9 #include "nsAuth.h" 10 #include "nsIAuthModule.h" 11 #include "nsString.h" 12 13 #define GSS_USE_FUNCTION_POINTERS 1 14 15 #include "gssapi.h" 16 17 // The nsAuthGSSAPI class provides responses for the GSS-API Negotiate method 18 // as specified by Microsoft in draft-brezak-spnego-http-04.txt 19 20 /* Some remarks on thread safety ... 21 * 22 * The thread safety of this class depends largely upon the thread safety of 23 * the underlying GSSAPI and Kerberos libraries. This code just loads the 24 * system GSSAPI library, and whilst it avoids loading known bad libraries, 25 * it cannot determine the thread safety of the the code it loads. 26 * 27 * When used with a non-threadsafe library, it is not safe to simultaneously 28 * use multiple instantiations of this class. 29 * 30 * When used with a threadsafe Kerberos library, multiple instantiations of 31 * this class may happily co-exist. Methods may be sequentially called from 32 * multiple threads. The nature of the GSSAPI protocol is such that a correct 33 * implementation will never call methods in parallel, as the results of the 34 * last call are required as input to the next. 35 */ 36 37 class nsAuthGSSAPI final : public nsIAuthModule { 38 public: 39 NS_DECL_THREADSAFE_ISUPPORTS 40 NS_DECL_NSIAUTHMODULE 41 42 explicit nsAuthGSSAPI(pType package); 43 44 static void Shutdown(); 45 46 private: 47 ~nsAuthGSSAPI() { Reset(); } 48 49 void Reset(); 50 gss_OID GetOID() { return mMechOID; } 51 52 private: 53 gss_ctx_id_t mCtx; 54 gss_OID mMechOID; 55 nsCString mServiceName; 56 uint32_t mServiceFlags = REQ_DEFAULT; 57 nsString mUsername; 58 bool mComplete = false; 59 bool mDelegationRequested = false; 60 bool mDelegationSupported = false; 61 }; 62 63 #endif /* nsAuthGSSAPI_h__ */