Bug 1858509 add thread-safety annotations around MediaSourceDemuxer::mMonitor r=alwu
[gecko.git] / extensions / auth / nsAuthGSSAPI.h
blobc25c75b294faeebe2d73cd036a79e6c1bfe10006
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/. */
6 #ifndef nsAuthGSSAPI_h__
7 #define nsAuthGSSAPI_h__
9 #include "nsAuth.h"
10 #include "nsIAuthModule.h"
11 #include "nsString.h"
12 #include "mozilla/Attributes.h"
14 #define GSS_USE_FUNCTION_POINTERS 1
16 #include "gssapi.h"
18 // The nsAuthGSSAPI class provides responses for the GSS-API Negotiate method
19 // as specified by Microsoft in draft-brezak-spnego-http-04.txt
21 /* Some remarks on thread safety ...
23 * The thread safety of this class depends largely upon the thread safety of
24 * the underlying GSSAPI and Kerberos libraries. This code just loads the
25 * system GSSAPI library, and whilst it avoids loading known bad libraries,
26 * it cannot determine the thread safety of the the code it loads.
28 * When used with a non-threadsafe library, it is not safe to simultaneously
29 * use multiple instantiations of this class.
31 * When used with a threadsafe Kerberos library, multiple instantiations of
32 * this class may happily co-exist. Methods may be sequentially called from
33 * multiple threads. The nature of the GSSAPI protocol is such that a correct
34 * implementation will never call methods in parallel, as the results of the
35 * last call are required as input to the next.
38 class nsAuthGSSAPI final : public nsIAuthModule {
39 public:
40 NS_DECL_THREADSAFE_ISUPPORTS
41 NS_DECL_NSIAUTHMODULE
43 explicit nsAuthGSSAPI(pType package);
45 static void Shutdown();
47 private:
48 ~nsAuthGSSAPI() { Reset(); }
50 void Reset();
51 gss_OID GetOID() { return mMechOID; }
53 private:
54 gss_ctx_id_t mCtx;
55 gss_OID mMechOID;
56 nsCString mServiceName;
57 uint32_t mServiceFlags;
58 nsString mUsername;
59 bool mComplete;
62 #endif /* nsAuthGSSAPI_h__ */