@@ -20,43 +20,39 @@ public enum WindowsAuthenticationTypes
2020 All = Ntlm | Negotiate
2121 }
2222
23- public class WindowsIntegratedAuthentication : IWindowsIntegratedAuthentication
23+ public class WindowsIntegratedAuthentication : AuthenticationBase , IWindowsIntegratedAuthentication
2424 {
2525 public static readonly string [ ] AuthorityIds =
2626 {
2727 "integrated" , "windows" , "kerberos" , "ntlm" ,
2828 "tfs" , "sso" ,
2929 } ;
3030
31- private readonly ICommandContext _context ;
32-
3331 public WindowsIntegratedAuthentication ( ICommandContext context )
34- {
35- _context = context ;
36- }
32+ : base ( context ) { }
3733
3834 public async Task < WindowsAuthenticationTypes > GetAuthenticationTypesAsync ( Uri uri )
3935 {
4036 EnsureArgument . AbsoluteUri ( uri , nameof ( uri ) ) ;
4137
4238 var types = WindowsAuthenticationTypes . None ;
4339
44- _context . Trace . WriteLine ( $ "HTTP: HEAD { uri } ") ;
40+ Context . Trace . WriteLine ( $ "HTTP: HEAD { uri } ") ;
4541 using ( HttpResponseMessage response = await HttpClient . HeadAsync ( uri ) )
4642 {
47- _context . Trace . WriteLine ( "HTTP: Response code ignored." ) ;
43+ Context . Trace . WriteLine ( "HTTP: Response code ignored." ) ;
4844
49- _context . Trace . WriteLine ( "Inspecting WWW-Authenticate headers..." ) ;
45+ Context . Trace . WriteLine ( "Inspecting WWW-Authenticate headers..." ) ;
5046 foreach ( AuthenticationHeaderValue wwwHeader in response . Headers . WwwAuthenticate )
5147 {
5248 if ( StringComparer . OrdinalIgnoreCase . Equals ( wwwHeader . Scheme , Constants . Http . WwwAuthenticateNegotiateScheme ) )
5349 {
54- _context . Trace . WriteLine ( "Found WWW-Authenticate header for Negotiate" ) ;
50+ Context . Trace . WriteLine ( "Found WWW-Authenticate header for Negotiate" ) ;
5551 types |= WindowsAuthenticationTypes . Negotiate ;
5652 }
5753 else if ( StringComparer . OrdinalIgnoreCase . Equals ( wwwHeader . Scheme , Constants . Http . WwwAuthenticateNtlmScheme ) )
5854 {
59- _context . Trace . WriteLine ( "Found WWW-Authenticate header for NTLM" ) ;
55+ Context . Trace . WriteLine ( "Found WWW-Authenticate header for NTLM" ) ;
6056 types |= WindowsAuthenticationTypes . Ntlm ;
6157 }
6258 }
@@ -66,7 +62,7 @@ public async Task<WindowsAuthenticationTypes> GetAuthenticationTypesAsync(Uri ur
6662 }
6763
6864 private HttpClient _httpClient ;
69- private HttpClient HttpClient => _httpClient ?? ( _httpClient = _context . HttpClientFactory . CreateClient ( ) ) ;
65+ private HttpClient HttpClient => _httpClient ?? ( _httpClient = Context . HttpClientFactory . CreateClient ( ) ) ;
7066
7167 #region IDisposable
7268
0 commit comments