2
0

NtlmClient.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. //
  2. // System.Net.NtlmClient
  3. //
  4. // Authors:
  5. // Sebastien Pouliot ([email protected])
  6. // Gonzalo Paniagua Javier ([email protected])
  7. //
  8. // (C) 2003 Motus Technologies. All rights reserved.
  9. // (c) 2003 Novell, Inc. (http://www.novell.com)
  10. //
  11. using System;
  12. using System.Reflection;
  13. namespace System.Net
  14. {
  15. class NtlmClient : IAuthenticationModule
  16. {
  17. static Type ntlmAuthType;
  18. IAuthenticationModule authObject;
  19. static NtlmClient ()
  20. {
  21. Assembly ass = Assembly.Load ("Mono.Security");
  22. if (ass != null)
  23. ntlmAuthType = ass.GetType ("Mono.Http.NtlmClient", false);
  24. }
  25. public NtlmClient ()
  26. {
  27. if (ntlmAuthType != null)
  28. authObject = (IAuthenticationModule) Activator.CreateInstance (ntlmAuthType);
  29. }
  30. public Authorization Authenticate (string challenge, WebRequest webRequest, ICredentials credentials)
  31. {
  32. if (authObject == null)
  33. return null;
  34. return authObject.Authenticate (challenge, webRequest, credentials);
  35. }
  36. public Authorization PreAuthenticate (WebRequest webRequest, ICredentials credentials)
  37. {
  38. return null;
  39. }
  40. public string AuthenticationType {
  41. get { return "NTLM"; }
  42. }
  43. public bool CanPreAuthenticate {
  44. get { return false; }
  45. }
  46. }
  47. }