File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
src/Tests/Tests/ClientConcepts/Connection Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 1111using Tests . Core . Extensions ;
1212using Tests . Domain ;
1313using Tests . Framework ;
14+ #if DOTNETCORE
15+ using System . Net . Http ;
16+ using System . Net . Http . Headers ;
17+ #endif
1418
1519namespace Tests . ClientConcepts . Connection
1620{
@@ -117,6 +121,7 @@ public void InMemoryConnectionOverloadedCtor()
117121 * By deriving from `HttpConnection`, it is possible to change the behaviour of the connection. The following
118122 * provides some examples
119123 *
124+ *
120125 * [[servicepoint-behaviour]]
121126 * ===== ServicePoint behaviour
122127 *
@@ -180,5 +185,30 @@ public void UseX509CertificateHttpConnection()
180185 * See <<working-with-certificates, Working with certificates>> for further details.
181186 */
182187#endif
188+ #if DOTNETCORE
189+ /*
190+ * [[kerberos-authentication]]
191+ * ===== Kerberos Authentication
192+ *
193+ * For a lot of use cases subclassing HttpConnection is a great way to customize the http connection for your needs.
194+ * E.g if you want to authenticate with Kerberos, creating a custom HttpConnection as followed allows you to set the right HTTP headers.
195+ *
196+ *
197+ * TIP use something like https://www.nuget.org/packages/Kerberos.NET/ to fill in the actual blanks of this implementation
198+ */
199+ public class KerberosConnection : HttpConnection
200+ {
201+ protected override HttpRequestMessage CreateRequestMessage ( RequestData requestData )
202+ {
203+ var message = base . CreateRequestMessage ( requestData ) ;
204+ var header = string . Empty ;
205+ message . Headers . Authorization = new AuthenticationHeaderValue ( "Negotiate" , header ) ;
206+ return message ;
207+ }
208+ }
209+ #endif
210+
211+
212+
183213 }
184214}
You can’t perform that action at this time.
0 commit comments