extensions/auth/nsAuthGSSAPI.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/extensions/auth/nsAuthGSSAPI.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,63 @@
     1.4 +/* vim:set ts=4 sw=4 et cindent: */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#ifndef nsAuthGSSAPI_h__
    1.10 +#define nsAuthGSSAPI_h__
    1.11 +
    1.12 +#include "nsAuth.h"
    1.13 +#include "nsIAuthModule.h"
    1.14 +#include "nsString.h"
    1.15 +#include "mozilla/Attributes.h"
    1.16 +
    1.17 +#define GSS_USE_FUNCTION_POINTERS 1
    1.18 +
    1.19 +#include "gssapi.h"
    1.20 +
    1.21 +// The nsAuthGSSAPI class provides responses for the GSS-API Negotiate method
    1.22 +// as specified by Microsoft in draft-brezak-spnego-http-04.txt
    1.23 +
    1.24 +/* Some remarks on thread safety ...
    1.25 + *
    1.26 + * The thread safety of this class depends largely upon the thread safety of
    1.27 + * the underlying GSSAPI and Kerberos libraries. This code just loads the 
    1.28 + * system GSSAPI library, and whilst it avoids loading known bad libraries, 
    1.29 + * it cannot determine the thread safety of the the code it loads.
    1.30 + *
    1.31 + * When used with a non-threadsafe library, it is not safe to simultaneously 
    1.32 + * use multiple instantiations of this class.
    1.33 + *
    1.34 + * When used with a threadsafe Kerberos library, multiple instantiations of 
    1.35 + * this class may happily co-exist. Methods may be sequentially called from 
    1.36 + * multiple threads. The nature of the GSSAPI protocol is such that a correct 
    1.37 + * implementation will never call methods in parallel, as the results of the 
    1.38 + * last call are required as input to the next.
    1.39 + */
    1.40 +
    1.41 +class nsAuthGSSAPI MOZ_FINAL : public nsIAuthModule
    1.42 +{
    1.43 +public:
    1.44 +    NS_DECL_THREADSAFE_ISUPPORTS
    1.45 +    NS_DECL_NSIAUTHMODULE
    1.46 +
    1.47 +    nsAuthGSSAPI(pType package);
    1.48 +
    1.49 +    static void Shutdown();
    1.50 +
    1.51 +private:
    1.52 +    ~nsAuthGSSAPI() { Reset(); }
    1.53 +
    1.54 +    void    Reset();
    1.55 +    gss_OID GetOID() { return mMechOID; }
    1.56 +
    1.57 +private:
    1.58 +    gss_ctx_id_t mCtx;
    1.59 +    gss_OID      mMechOID;
    1.60 +    nsCString    mServiceName;
    1.61 +    uint32_t     mServiceFlags;
    1.62 +    nsString     mUsername;
    1.63 +    bool         mComplete;
    1.64 +};
    1.65 +
    1.66 +#endif /* nsAuthGSSAPI_h__ */

mercurial