michael@0: /* vim:set ts=4 sw=4 et cindent: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsAuthGSSAPI_h__ michael@0: #define nsAuthGSSAPI_h__ michael@0: michael@0: #include "nsAuth.h" michael@0: #include "nsIAuthModule.h" michael@0: #include "nsString.h" michael@0: #include "mozilla/Attributes.h" michael@0: michael@0: #define GSS_USE_FUNCTION_POINTERS 1 michael@0: michael@0: #include "gssapi.h" michael@0: michael@0: // The nsAuthGSSAPI class provides responses for the GSS-API Negotiate method michael@0: // as specified by Microsoft in draft-brezak-spnego-http-04.txt michael@0: michael@0: /* Some remarks on thread safety ... michael@0: * michael@0: * The thread safety of this class depends largely upon the thread safety of michael@0: * the underlying GSSAPI and Kerberos libraries. This code just loads the michael@0: * system GSSAPI library, and whilst it avoids loading known bad libraries, michael@0: * it cannot determine the thread safety of the the code it loads. michael@0: * michael@0: * When used with a non-threadsafe library, it is not safe to simultaneously michael@0: * use multiple instantiations of this class. michael@0: * michael@0: * When used with a threadsafe Kerberos library, multiple instantiations of michael@0: * this class may happily co-exist. Methods may be sequentially called from michael@0: * multiple threads. The nature of the GSSAPI protocol is such that a correct michael@0: * implementation will never call methods in parallel, as the results of the michael@0: * last call are required as input to the next. michael@0: */ michael@0: michael@0: class nsAuthGSSAPI MOZ_FINAL : public nsIAuthModule michael@0: { michael@0: public: michael@0: NS_DECL_THREADSAFE_ISUPPORTS michael@0: NS_DECL_NSIAUTHMODULE michael@0: michael@0: nsAuthGSSAPI(pType package); michael@0: michael@0: static void Shutdown(); michael@0: michael@0: private: michael@0: ~nsAuthGSSAPI() { Reset(); } michael@0: michael@0: void Reset(); michael@0: gss_OID GetOID() { return mMechOID; } michael@0: michael@0: private: michael@0: gss_ctx_id_t mCtx; michael@0: gss_OID mMechOID; michael@0: nsCString mServiceName; michael@0: uint32_t mServiceFlags; michael@0: nsString mUsername; michael@0: bool mComplete; michael@0: }; michael@0: michael@0: #endif /* nsAuthGSSAPI_h__ */