1 : /* vim:set ts=4 sw=4 et cindent: */
2 : /* ***** BEGIN LICENSE BLOCK *****
3 : * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 : *
5 : * The contents of this file are subject to the Mozilla Public License Version
6 : * 1.1 (the "License"); you may not use this file except in compliance with
7 : * the License. You may obtain a copy of the License at
8 : * http://www.mozilla.org/MPL/
9 : *
10 : * Software distributed under the License is distributed on an "AS IS" basis,
11 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 : * for the specific language governing rights and limitations under the
13 : * License.
14 : *
15 : * The Original Code is the Negotiateauth
16 : *
17 : * The Initial Developer of the Original Code is Daniel Kouril.
18 : * Portions created by the Initial Developer are Copyright (C) 2003
19 : * the Initial Developer. All Rights Reserved.
20 : *
21 : * Contributor(s):
22 : * Daniel Kouril <kouril@ics.muni.cz> (original author)
23 : * Wyllys Ingersoll <wyllys.ingersoll@sun.com>
24 : * Christopher Nebergall <cneberg@sandia.gov>
25 : * Darin Fisher <darin@meer.net>
26 : *
27 : * Alternatively, the contents of this file may be used under the terms of
28 : * either the GNU General Public License Version 2 or later (the "GPL"), or
29 : * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
30 : * in which case the provisions of the GPL or the LGPL are applicable instead
31 : * of those above. If you wish to allow use of your version of this file only
32 : * under the terms of either the GPL or the LGPL, and not to allow others to
33 : * use your version of this file under the terms of the MPL, indicate your
34 : * decision by deleting the provisions above and replace them with the notice
35 : * and other provisions required by the GPL or the LGPL. If you do not delete
36 : * the provisions above, a recipient may use your version of this file under
37 : * the terms of any one of the MPL, the GPL or the LGPL.
38 : *
39 : * ***** END LICENSE BLOCK ***** */
40 :
41 : #ifndef nsAuthGSSAPI_h__
42 : #define nsAuthGSSAPI_h__
43 :
44 : #include "nsAuth.h"
45 : #include "nsIAuthModule.h"
46 : #include "nsString.h"
47 :
48 : #define GSS_USE_FUNCTION_POINTERS 1
49 :
50 : #include "gssapi.h"
51 :
52 : // The nsAuthGSSAPI class provides responses for the GSS-API Negotiate method
53 : // as specified by Microsoft in draft-brezak-spnego-http-04.txt
54 :
55 : /* Some remarks on thread safety ...
56 : *
57 : * The thread safety of this class depends largely upon the thread safety of
58 : * the underlying GSSAPI and Kerberos libraries. This code just loads the
59 : * system GSSAPI library, and whilst it avoids loading known bad libraries,
60 : * it cannot determine the thread safety of the the code it loads.
61 : *
62 : * When used with a non-threadsafe library, it is not safe to simultaneously
63 : * use multiple instantiations of this class.
64 : *
65 : * When used with a threadsafe Kerberos library, multiple instantiations of
66 : * this class may happily co-exist. Methods may be sequentially called from
67 : * multiple threads. The nature of the GSSAPI protocol is such that a correct
68 : * implementation will never call methods in parallel, as the results of the
69 : * last call are required as input to the next.
70 : */
71 :
72 : class nsAuthGSSAPI : public nsIAuthModule
73 : {
74 : public:
75 : NS_DECL_ISUPPORTS
76 : NS_DECL_NSIAUTHMODULE
77 :
78 : nsAuthGSSAPI(pType package);
79 :
80 : static void Shutdown();
81 :
82 : private:
83 0 : ~nsAuthGSSAPI() { Reset(); }
84 :
85 : void Reset();
86 : gss_OID GetOID() { return mMechOID; }
87 :
88 : private:
89 : gss_ctx_id_t mCtx;
90 : gss_OID mMechOID;
91 : nsCString mServiceName;
92 : PRUint32 mServiceFlags;
93 : nsString mUsername;
94 : bool mComplete;
95 : };
96 :
97 : #endif /* nsAuthGSSAPI_h__ */
|