Skip to content

Instantly share code, notes, and snippets.

View jpda's full-sized avatar
🤔
ok

John Patrick Dandison jpda

🤔
ok
View GitHub Profile
@jpda
jpda / AuthorizationHeaderMessageInspector.cs
Created January 12, 2015 21:27
AuthorizationHeaderMessageInspector.cs
public class AuthorizationHeaderMessageInspector : IClientMessageInspector
{
private readonly string _token;
public AuthorizationHeaderMessageInspector(string token)
{
_token = string.IsNullOrEmpty(token) ? AzureAdToken.Get() : token;
}
public object BeforeSendRequest(ref System.ServiceModel.Channels.Message request, System.ServiceModel.IClientChannel channel)
{
internal class WcfErrorResponseData
{
public WcfErrorResponseData(HttpStatusCode status) : this(status, string.Empty, new KeyValuePair<string, string>[0]){ }
public WcfErrorResponseData(HttpStatusCode status, string body) : this(status, body, new KeyValuePair<string, string>[0]) { }
public WcfErrorResponseData(HttpStatusCode status, string body, params KeyValuePair<string, string>[] headers)
{
StatusCode = status;
Body = body;
Headers = headers;
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- snip -->
<bearerTokenRequired/>
</behavior>
</serviceBehaviors>
</behaviors>
<extensions>