Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document how to use a custom authentication header e.g Kerberos #3519

Merged
merged 2 commits into from
Jan 24, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
using Tests.Core.Extensions;
using Tests.Domain;
using Tests.Framework;
#if DOTNETCORE
using System.Net.Http;
using System.Net.Http.Headers;
#endif

namespace Tests.ClientConcepts.Connection
{
Expand Down Expand Up @@ -117,6 +121,7 @@ public void InMemoryConnectionOverloadedCtor()
* By deriving from `HttpConnection`, it is possible to change the behaviour of the connection. The following
* provides some examples
*
*
* [[servicepoint-behaviour]]
* ===== ServicePoint behaviour
*
Expand Down Expand Up @@ -180,5 +185,30 @@ public void UseX509CertificateHttpConnection()
* See <<working-with-certificates, Working with certificates>> for further details.
*/
#endif
#if DOTNETCORE
/*
* [[kerberos-authentication]]
* ===== Kerberos Authentication
*
* For a lot of use cases subclassing HttpConnection is a great way to customize the http connection for your needs.
* E.g if you want to authenticate with Kerberos, creating a custom HttpConnection as followed allows you to set the right HTTP headers.
*
*
* TIP use something like https://www.nuget.org/packages/Kerberos.NET/ to fill in the actual blanks of this implementation
*/
public class KerberosConnection : HttpConnection
{
protected override HttpRequestMessage CreateRequestMessage(RequestData requestData)
{
var message = base.CreateRequestMessage(requestData);
var header = string.Empty;
message.Headers.Authorization = new AuthenticationHeaderValue("Negotiate", header);
return message;
}
}
#endif



}
}