Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* vim:set ts=4 sw=4 et cindent: */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #ifndef nsAuthSSPI_h__ |
michael@0 | 7 | #define nsAuthSSPI_h__ |
michael@0 | 8 | |
michael@0 | 9 | #include "nsAuth.h" |
michael@0 | 10 | #include "nsIAuthModule.h" |
michael@0 | 11 | #include "nsString.h" |
michael@0 | 12 | |
michael@0 | 13 | #include <windows.h> |
michael@0 | 14 | |
michael@0 | 15 | #define SECURITY_WIN32 1 |
michael@0 | 16 | #include <ntsecapi.h> |
michael@0 | 17 | #include <security.h> |
michael@0 | 18 | #include <rpc.h> |
michael@0 | 19 | |
michael@0 | 20 | // The nsNegotiateAuth class provides responses for the GSS-API Negotiate method |
michael@0 | 21 | // as specified by Microsoft in draft-brezak-spnego-http-04.txt |
michael@0 | 22 | |
michael@0 | 23 | // It can also be configured to talk raw NTLM. This implementation of NTLM has |
michael@0 | 24 | // the advantage of being able to access the user's logon credentials. This |
michael@0 | 25 | // implementation of NTLM should only be used for single-signon. It should be |
michael@0 | 26 | // avoided when authenticating over the internet since it may use a lower-grade |
michael@0 | 27 | // version of password hashing depending on the version of Windows being used. |
michael@0 | 28 | |
michael@0 | 29 | class nsAuthSSPI MOZ_FINAL : public nsIAuthModule |
michael@0 | 30 | { |
michael@0 | 31 | public: |
michael@0 | 32 | NS_DECL_ISUPPORTS |
michael@0 | 33 | NS_DECL_NSIAUTHMODULE |
michael@0 | 34 | |
michael@0 | 35 | nsAuthSSPI(pType package = PACKAGE_TYPE_NEGOTIATE); |
michael@0 | 36 | |
michael@0 | 37 | private: |
michael@0 | 38 | ~nsAuthSSPI(); |
michael@0 | 39 | |
michael@0 | 40 | void Reset(); |
michael@0 | 41 | |
michael@0 | 42 | typedef TimeStamp MS_TimeStamp; |
michael@0 | 43 | |
michael@0 | 44 | private: |
michael@0 | 45 | CredHandle mCred; |
michael@0 | 46 | CtxtHandle mCtxt; |
michael@0 | 47 | nsCString mServiceName; |
michael@0 | 48 | uint32_t mServiceFlags; |
michael@0 | 49 | uint32_t mMaxTokenLen; |
michael@0 | 50 | pType mPackage; |
michael@0 | 51 | nsString mDomain; |
michael@0 | 52 | nsString mUsername; |
michael@0 | 53 | nsString mPassword; |
michael@0 | 54 | bool mIsFirst; |
michael@0 | 55 | void* mCertDERData; |
michael@0 | 56 | uint32_t mCertDERLength; |
michael@0 | 57 | }; |
michael@0 | 58 | |
michael@0 | 59 | #endif /* nsAuthSSPI_h__ */ |