/src/mozilla-central/extensions/auth/nsAuthGSSAPI.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* vim:set ts=4 sw=4 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 | | #include "mozilla/Attributes.h" |
13 | | |
14 | | #define GSS_USE_FUNCTION_POINTERS 1 |
15 | | |
16 | | #include "gssapi.h" |
17 | | |
18 | | // The nsAuthGSSAPI class provides responses for the GSS-API Negotiate method |
19 | | // as specified by Microsoft in draft-brezak-spnego-http-04.txt |
20 | | |
21 | | /* Some remarks on thread safety ... |
22 | | * |
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. |
27 | | * |
28 | | * When used with a non-threadsafe library, it is not safe to simultaneously |
29 | | * use multiple instantiations of this class. |
30 | | * |
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. |
36 | | */ |
37 | | |
38 | | class nsAuthGSSAPI final : public nsIAuthModule |
39 | | { |
40 | | public: |
41 | | NS_DECL_THREADSAFE_ISUPPORTS |
42 | | NS_DECL_NSIAUTHMODULE |
43 | | |
44 | | explicit nsAuthGSSAPI(pType package); |
45 | | |
46 | | static void Shutdown(); |
47 | | |
48 | | private: |
49 | 0 | ~nsAuthGSSAPI() { Reset(); } |
50 | | |
51 | | void Reset(); |
52 | 0 | gss_OID GetOID() { return mMechOID; } |
53 | | |
54 | | private: |
55 | | gss_ctx_id_t mCtx; |
56 | | gss_OID mMechOID; |
57 | | nsCString mServiceName; |
58 | | uint32_t mServiceFlags; |
59 | | nsString mUsername; |
60 | | bool mComplete; |
61 | | }; |
62 | | |
63 | | #endif /* nsAuthGSSAPI_h__ */ |