diff options
-rw-r--r-- | samples/OpenIdOfflineProvider/CheckIdWindow.xaml.cs | 7 | ||||
-rw-r--r-- | samples/OpenIdOfflineProvider/HostedProvider.cs | 149 | ||||
-rw-r--r-- | samples/OpenIdOfflineProvider/HttpHost.cs | 143 | ||||
-rw-r--r-- | samples/OpenIdOfflineProvider/MainWindow.xaml.cs | 151 | ||||
-rw-r--r-- | samples/OpenIdOfflineProvider/OpenIdOfflineProvider.csproj | 7 | ||||
-rw-r--r-- | samples/OpenIdOfflineProvider/packages.config | 1 |
6 files changed, 157 insertions, 301 deletions
diff --git a/samples/OpenIdOfflineProvider/CheckIdWindow.xaml.cs b/samples/OpenIdOfflineProvider/CheckIdWindow.xaml.cs index 3e27507..b56666a 100644 --- a/samples/OpenIdOfflineProvider/CheckIdWindow.xaml.cs +++ b/samples/OpenIdOfflineProvider/CheckIdWindow.xaml.cs @@ -9,6 +9,7 @@ namespace DotNetOpenAuth.OpenIdOfflineProvider { using System.Collections.Generic; using System.Linq; using System.Text; + using System.Threading; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; @@ -19,6 +20,7 @@ namespace DotNetOpenAuth.OpenIdOfflineProvider { using System.Windows.Media.Imaging; using System.Windows.Shapes; using DotNetOpenAuth.Messaging; + using DotNetOpenAuth.OpenId; using DotNetOpenAuth.OpenId.Provider; using Validation; @@ -55,16 +57,17 @@ namespace DotNetOpenAuth.OpenIdOfflineProvider { /// </summary> /// <param name="provider">The OpenID Provider host.</param> /// <param name="request">The incoming authentication request.</param> + /// <param name="cancellationToken">The cancellation token.</param> /// <returns> /// A task that completes with the asynchronous operation. /// </returns> - internal static async Task ProcessAuthenticationAsync(HostedProvider provider, IAuthenticationRequest request) { + internal static async Task ProcessAuthenticationAsync(HostedProvider provider, IAuthenticationRequest request, CancellationToken cancellationToken) { Requires.NotNull(provider, "provider"); Requires.NotNull(request, "request"); var window = new CheckIdWindow(provider, request); - bool isRPDiscoverable = await request.IsReturnUrlDiscoverableAsync(provider.Provider.Channel.HostFactories) == RelyingPartyDiscoveryResult.Success; + bool isRPDiscoverable = await request.IsReturnUrlDiscoverableAsync(cancellationToken: cancellationToken) == RelyingPartyDiscoveryResult.Success; window.discoverableYesLabel.Visibility = isRPDiscoverable ? Visibility.Visible : Visibility.Collapsed; window.discoverableNoLabel.Visibility = isRPDiscoverable ? Visibility.Collapsed : Visibility.Visible; diff --git a/samples/OpenIdOfflineProvider/HostedProvider.cs b/samples/OpenIdOfflineProvider/HostedProvider.cs index 1f41e9a..374b7b2 100644 --- a/samples/OpenIdOfflineProvider/HostedProvider.cs +++ b/samples/OpenIdOfflineProvider/HostedProvider.cs @@ -7,11 +7,17 @@ namespace DotNetOpenAuth.OpenIdOfflineProvider { using System; using System.Collections.Generic; + using System.Globalization; using System.IO; using System.Linq; using System.Net; + using System.Net.Http; + using System.ServiceModel; + using System.Text; using System.Threading.Tasks; using System.Web; + using System.Web.Http; + using System.Web.Http.SelfHost; using DotNetOpenAuth.Messaging; using DotNetOpenAuth.OpenId.Provider; using log4net; @@ -37,20 +43,9 @@ namespace DotNetOpenAuth.OpenIdOfflineProvider { private const string UserIdentifierPath = "/user/"; /// <summary> - /// The <see cref="OpenIdProvider"/> instance that processes incoming requests. - /// </summary> - private OpenIdProvider provider = new OpenIdProvider(new StandardProviderApplicationStore()); - - /// <summary> /// The HTTP listener that acts as the OpenID Provider socket. /// </summary> - private HttpHost httpHost; - - /// <summary> - /// Initializes a new instance of the <see cref="HostedProvider"/> class. - /// </summary> - internal HostedProvider() { - } + private HttpSelfHostServer hostServer; /// <summary> /// Gets a value indicating whether this instance is running. @@ -59,30 +54,13 @@ namespace DotNetOpenAuth.OpenIdOfflineProvider { /// <c>true</c> if this instance is running; otherwise, <c>false</c>. /// </value> internal bool IsRunning { - get { return this.httpHost != null; } + get { return this.hostServer != null; } } /// <summary> - /// Gets the <see cref="OpenIdProvider"/> instance that processes incoming requests. - /// </summary> - internal OpenIdProvider Provider { - get { return this.provider; } - } - - /// <summary> - /// Gets or sets the delegate that handles authentication requests. - /// </summary> - internal Func<HttpRequestBase, HttpListenerResponse, Task> ProcessRequestAsync { get; set; } - - /// <summary> /// Gets the provider endpoint. /// </summary> - internal Uri ProviderEndpoint { - get { - Assumes.True(this.IsRunning); - return new Uri(this.httpHost.BaseUri, ProviderPath); - } - } + internal Uri ProviderEndpoint { get; private set; } /// <summary> /// Gets the base URI that all user identities must start with. @@ -90,7 +68,7 @@ namespace DotNetOpenAuth.OpenIdOfflineProvider { internal Uri UserIdentityPageBase { get { Assumes.True(this.IsRunning); - return new Uri(this.httpHost.BaseUri, UserIdentifierPath); + return new Uri(this.ProviderEndpoint, UserIdentifierPath); } } @@ -100,7 +78,7 @@ namespace DotNetOpenAuth.OpenIdOfflineProvider { internal Uri OPIdentifier { get { Assumes.True(this.IsRunning); - return new Uri(this.httpHost.BaseUri, OPIdentifierPath); + return new Uri(this.ProviderEndpoint, OPIdentifierPath); } } @@ -114,17 +92,40 @@ namespace DotNetOpenAuth.OpenIdOfflineProvider { /// <summary> /// Starts the provider. /// </summary> - internal void StartProvider() { - this.httpHost = HttpHost.CreateHost(this.RequestHandlerAsync); + internal async Task StartProviderAsync(HttpMessageHandler providerEndpointHandler) { + Requires.NotNull(providerEndpointHandler, "providerEndpointHandler"); + Verify.Operation(this.hostServer == null, "Server already started."); + + int port = 45235; + var baseUri = new UriBuilder("http", "localhost", port); + var configuration = new HttpSelfHostConfiguration(baseUri.Uri); + try { + var hostServer = new HttpSelfHostServer(configuration, new Handler(this, providerEndpointHandler)); + await hostServer.OpenAsync(); + this.hostServer = hostServer; + } catch (AddressAccessDeniedException ex) { + // If this throws an exception, use an elevated command prompt and execute: + // netsh http add urlacl url=http://+:45235/ user=YOUR_USERNAME_HERE + string message = string.Format( + CultureInfo.CurrentCulture, + "Use an elevated command prompt and execute: \nnetsh http add urlacl url=http://+:{0}/ user={1}\\{2}", + port, + Environment.UserDomainName, + Environment.UserName); + throw new InvalidOperationException(message, ex); + } + + this.ProviderEndpoint = new Uri(baseUri.Uri, ProviderPath); } /// <summary> /// Stops the provider. /// </summary> - internal void StopProvider() { - if (this.httpHost != null) { - this.httpHost.Dispose(); - this.httpHost = null; + internal async Task StopProviderAsync() { + if (this.hostServer != null) { + await this.hostServer.CloseAsync(); + this.hostServer.Dispose(); + this.hostServer = null; } } @@ -136,12 +137,7 @@ namespace DotNetOpenAuth.OpenIdOfflineProvider { /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param> protected virtual void Dispose(bool disposing) { if (disposing) { - var host = this.httpHost as IDisposable; - if (host != null) { - host.Dispose(); - } - - this.httpHost = null; + this.hostServer.Dispose(); } } @@ -206,51 +202,34 @@ namespace DotNetOpenAuth.OpenIdOfflineProvider { extensions); } - /// <summary> - /// Handles incoming HTTP requests. - /// </summary> - /// <param name="context">The HttpListener context.</param> - /// <returns> - /// A task that completes with the asynchronous operation. - /// </returns> - private async Task RequestHandlerAsync(HttpListenerContext context) { - Requires.NotNull(context, "context"); - Requires.NotNull(context.Response.OutputStream, "context.Response.OutputStream"); - Requires.NotNull(this.ProcessRequestAsync, "this.ProcessRequestAsync"); - - Stream outputStream = context.Response.OutputStream; - Assumes.True(outputStream != null); // CC static verification shortcoming. + private class Handler : DelegatingHandler { + private HostedProvider host; - UriBuilder providerEndpointBuilder = new UriBuilder(); - providerEndpointBuilder.Scheme = Uri.UriSchemeHttp; - providerEndpointBuilder.Host = "localhost"; - providerEndpointBuilder.Port = context.Request.Url.Port; - providerEndpointBuilder.Path = ProviderPath; - Uri providerEndpoint = providerEndpointBuilder.Uri; + internal Handler(HostedProvider host, HttpMessageHandler innerHandler) + : base(innerHandler) { + Requires.NotNull(host, "host"); - if (context.Request.Url.AbsolutePath == ProviderPath) { - HttpRequestBase requestInfo = HttpRequestInfo.Create(context.Request); - await this.ProcessRequestAsync(requestInfo, context.Response); - } else if (context.Request.Url.AbsolutePath.StartsWith(UserIdentifierPath, StringComparison.Ordinal)) { - using (StreamWriter sw = new StreamWriter(outputStream)) { - context.Response.StatusCode = (int)HttpStatusCode.OK; + this.host = host; + } + protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) { + Uri providerEndpoint = new Uri(request.RequestUri, ProviderPath); + if (request.RequestUri.AbsolutePath == ProviderPath) { + return await base.SendAsync(request, cancellationToken); + } else if (request.RequestUri.AbsolutePath.StartsWith(UserIdentifierPath, StringComparison.Ordinal)) { string localId = null; // string.Format("http://localhost:{0}/user", context.Request.Url.Port); - string html = GenerateHtmlDiscoveryDocument(providerEndpoint, localId); - sw.WriteLine(html); - } - context.Response.OutputStream.Close(); - } else if (context.Request.Url == this.OPIdentifier) { - context.Response.ContentType = "application/xrds+xml"; - context.Response.StatusCode = (int)HttpStatusCode.OK; - App.Logger.Info("Discovery on OP Identifier detected."); - using (StreamWriter sw = new StreamWriter(outputStream)) { - sw.Write(GenerateXrdsOPIdentifierDocument(providerEndpoint, Enumerable.Empty<string>())); + return new HttpResponseMessage() { + RequestMessage = request, + Content = new StringContent(GenerateHtmlDiscoveryDocument(providerEndpoint, localId), Encoding.UTF8, "text/html"), + }; + } else if (request.RequestUri == this.host.OPIdentifier) { + App.Logger.Info("Discovery on OP Identifier detected."); + return new HttpResponseMessage() { + Content = new StringContent(GenerateXrdsOPIdentifierDocument(providerEndpoint, Enumerable.Empty<string>()), Encoding.UTF8, "application/xrds+xml"), + }; + } else { + return new HttpResponseMessage(HttpStatusCode.NotFound); } - context.Response.OutputStream.Close(); - } else { - context.Response.StatusCode = (int)HttpStatusCode.NotFound; - context.Response.OutputStream.Close(); } } } diff --git a/samples/OpenIdOfflineProvider/HttpHost.cs b/samples/OpenIdOfflineProvider/HttpHost.cs deleted file mode 100644 index 335d677..0000000 --- a/samples/OpenIdOfflineProvider/HttpHost.cs +++ /dev/null @@ -1,143 +0,0 @@ -//----------------------------------------------------------------------- -// <copyright file="HttpHost.cs" company="Outercurve Foundation"> -// Copyright (c) Outercurve Foundation. All rights reserved. -// </copyright> -//----------------------------------------------------------------------- - -namespace DotNetOpenAuth.OpenIdOfflineProvider { - using System; - using System.Globalization; - using System.IO; - using System.Net; - using System.Threading; - using System.Threading.Tasks; - using DotNetOpenAuth.Messaging; - using DotNetOpenAuth.OpenId.Provider; - using Validation; - - /// <summary> - /// An HTTP Listener that dispatches incoming requests for handling. - /// </summary> - internal class HttpHost : IDisposable { - /// <summary> - /// The HttpListener that waits for incoming requests. - /// </summary> - private readonly HttpListener listener; - - /// <summary> - /// The thread that listens for incoming HTTP requests and dispatches them - /// to the <see cref="handler"/>. - /// </summary> - private Thread listenerThread; - - /// <summary> - /// The handler for incoming HTTP requests. - /// </summary> - private RequestHandlerAsync handler; - - /// <summary> - /// Initializes a new instance of the <see cref="HttpHost"/> class. - /// </summary> - /// <param name="handler">The handler for incoming HTTP requests.</param> - private HttpHost(RequestHandlerAsync handler) { - Requires.NotNull(handler, "handler"); - - this.Port = 45235; - this.handler = handler; - Random r = new Random(); - tryAgain: - try { - this.listener = new HttpListener(); - this.listener.Prefixes.Add(string.Format(CultureInfo.InvariantCulture, "http://localhost:{0}/", this.Port)); - this.listener.Start(); - } catch (HttpListenerException ex) { - if (ex.Message.Contains("conflicts")) { - this.Port += r.Next(1, 20); - goto tryAgain; - } - throw; - } - - this.ProcessRequestsAsync(); - } - - /// <summary> - /// The request handler delegate. - /// </summary> - /// <param name="context">Information on the incoming HTTP request.</param> - /// <returns>A task that completes with the async operation.</returns> - internal delegate Task RequestHandlerAsync(HttpListenerContext context); - - /// <summary> - /// Gets the port that HTTP requests are being listened for on. - /// </summary> - public int Port { get; private set; } - - /// <summary> - /// Gets the base URI for all incoming web requests that will be received. - /// </summary> - public Uri BaseUri { - get { return new Uri("http://localhost:" + this.Port.ToString() + "/"); } - } - - /// <summary> - /// Creates the HTTP host. - /// </summary> - /// <param name="handler">The handler for incoming HTTP requests.</param> - /// <returns>The instantiated host.</returns> - public static HttpHost CreateHost(RequestHandlerAsync handler) { - Requires.NotNull(handler, "handler"); - - return new HttpHost(handler); - } - - #region IDisposable Members - - /// <summary> - /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. - /// </summary> - public void Dispose() { - this.Dispose(true); - GC.SuppressFinalize(this); - } - - /// <summary> - /// Releases unmanaged and - optionally - managed resources - /// </summary> - /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param> - protected virtual void Dispose(bool disposing) { - if (disposing) { - this.listener.Close(); - this.listenerThread.Join(1000); - this.listenerThread.Abort(); - } - } - - #endregion - - /// <summary> - /// The HTTP listener thread body. - /// </summary> - /// <returns> - /// A task that completes with the asynchronous operation. - /// </returns> - private async Task ProcessRequestsAsync() { - Assumes.True(this.listener != null); - - while (true) { - try { - HttpListenerContext context = await this.listener.GetContextAsync(); - await this.handler(context); - } catch (HttpListenerException ex) { - if (this.listener.IsListening) { - App.Logger.Error("Unexpected exception.", ex); - } else { - // the listener is probably being shut down - App.Logger.Warn("HTTP listener is closing down.", ex); - break; - } - } - } - } - } -} diff --git a/samples/OpenIdOfflineProvider/MainWindow.xaml.cs b/samples/OpenIdOfflineProvider/MainWindow.xaml.cs index f9faee3..a64bd87 100644 --- a/samples/OpenIdOfflineProvider/MainWindow.xaml.cs +++ b/samples/OpenIdOfflineProvider/MainWindow.xaml.cs @@ -12,6 +12,7 @@ namespace DotNetOpenAuth.OpenIdOfflineProvider { using System.IO; using System.Linq; using System.Net; + using System.Net.Http; using System.Net.Http.Headers; using System.Runtime.InteropServices; using System.Text; @@ -54,13 +55,12 @@ namespace DotNetOpenAuth.OpenIdOfflineProvider { /// </summary> public MainWindow() { this.InitializeComponent(); - this.hostedProvider.ProcessRequestAsync = this.ProcessRequestAsync; TextWriterAppender boxLogger = log4net.LogManager.GetRepository().GetAppenders().OfType<TextWriterAppender>().FirstOrDefault(a => a.Name == "TextBoxAppender"); if (boxLogger != null) { boxLogger.Writer = new TextBoxTextWriter(this.logBox); } - this.startProvider(); + this.StartProviderAsync(); } #region IDisposable Members @@ -94,7 +94,7 @@ namespace DotNetOpenAuth.OpenIdOfflineProvider { /// </summary> /// <param name="e">The <see cref="System.ComponentModel.CancelEventArgs"/> instance containing the event data.</param> protected override void OnClosing(System.ComponentModel.CancelEventArgs e) { - this.stopProvider(); + this.StopProviderAsync(); base.OnClosing(e); } @@ -124,85 +124,34 @@ namespace DotNetOpenAuth.OpenIdOfflineProvider { } /// <summary> - /// Processes an incoming request at the OpenID Provider endpoint. + /// Starts the provider. /// </summary> - /// <param name="requestInfo">The request info.</param> - /// <param name="response">The response.</param> - /// <returns> - /// A task that completes with the asynchronous operation. - /// </returns> - private async Task ProcessRequestAsync(HttpRequestBase requestInfo, HttpListenerResponse response) { - IRequest request = await this.hostedProvider.Provider.GetRequestAsync(requestInfo, CancellationToken.None); - if (request == null) { - App.Logger.Error("A request came in that did not carry an OpenID message."); - response.ContentType = "text/html"; - response.StatusCode = (int)HttpStatusCode.BadRequest; - using (StreamWriter sw = new StreamWriter(response.OutputStream)) { - sw.WriteLine("<html><body>This is an OpenID Provider endpoint.</body></html>"); - } - return; + private async Task StartProviderAsync() { + Exception exception = null; + try { + await this.hostedProvider.StartProviderAsync(new Handler(this)); + } catch (InvalidOperationException ex) { + exception = ex; } - this.Dispatcher.Invoke(async delegate { - if (!request.IsResponseReady) { - var authRequest = request as IAuthenticationRequest; - if (authRequest != null) { - switch (this.checkidRequestList.SelectedIndex) { - case 0: - if (authRequest.IsDirectedIdentity) { - string userIdentityPageBase = this.hostedProvider.UserIdentityPageBase.AbsoluteUri; - if (this.capitalizedHostName.IsChecked.Value) { - userIdentityPageBase = (this.hostedProvider.UserIdentityPageBase.Scheme + Uri.SchemeDelimiter + this.hostedProvider.UserIdentityPageBase.Authority).ToUpperInvariant() + this.hostedProvider.UserIdentityPageBase.PathAndQuery; - } - string leafPath = "directedidentity"; - if (this.directedIdentityTrailingPeriodsCheckbox.IsChecked.Value) { - leafPath += "."; - } - authRequest.ClaimedIdentifier = Identifier.Parse(userIdentityPageBase + leafPath, true); - authRequest.LocalIdentifier = authRequest.ClaimedIdentifier; - } - authRequest.IsAuthenticated = true; - break; - case 1: - authRequest.IsAuthenticated = false; - break; - case 2: - IntPtr oldForegroundWindow = NativeMethods.GetForegroundWindow(); - bool stoleFocus = NativeMethods.SetForegroundWindow(this); - await CheckIdWindow.ProcessAuthenticationAsync(this.hostedProvider, authRequest); - if (stoleFocus) { - NativeMethods.SetForegroundWindow(oldForegroundWindow); - } - break; - } - } + if (exception != null) { + if (MessageBox.Show(exception.Message, "Configuration error", MessageBoxButton.OKCancel, MessageBoxImage.Error) + == MessageBoxResult.OK) { + await this.StartProviderAsync(); + return; + } else { + this.Close(); } - }); - - var responseMessage = await this.hostedProvider.Provider.PrepareResponseAsync(request, CancellationToken.None); - response.StatusCode = (int)responseMessage.StatusCode; - ApplyHeadersToResponse(responseMessage.Headers, response); - if (responseMessage.Content != null) { - if (responseMessage.Content.Headers.ContentLength.HasValue) { - response.ContentLength64 = responseMessage.Content.Headers.ContentLength.Value; - } - await responseMessage.Content.CopyToAsync(response.OutputStream); } - } - /// <summary> - /// Starts the provider. - /// </summary> - private void startProvider() { - this.hostedProvider.StartProvider(); this.opIdentifierLabel.Content = this.hostedProvider.OPIdentifier; } /// <summary> /// Stops the provider. /// </summary> - private void stopProvider() { - this.hostedProvider.StopProvider(); + private async Task StopProviderAsync() { + await this.hostedProvider.StopProviderAsync(); this.opIdentifierLabel.Content = string.Empty; } @@ -227,5 +176,67 @@ namespace DotNetOpenAuth.OpenIdOfflineProvider { private void ClearLogButton_Click(object sender, RoutedEventArgs e) { this.logBox.Clear(); } + + private class Handler : HttpMessageHandler { + private readonly MainWindow owner; + + private readonly IOpenIdApplicationStore store = new StandardProviderApplicationStore(); + + internal Handler(MainWindow owner) { + Requires.NotNull(owner, "owner"); + this.owner = owner; + } + + protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage requestMessage, CancellationToken cancellationToken) { + var provider = new OpenIdProvider(store); + IRequest request = await provider.GetRequestAsync(requestMessage, cancellationToken); + if (request == null) { + App.Logger.Error("A request came in that did not carry an OpenID message."); + return new HttpResponseMessage(HttpStatusCode.BadRequest) { + Content = new StringContent("<html><body>This is an OpenID Provider endpoint.</body></html>", Encoding.UTF8, "text/html"), + }; + } + + return await await this.owner.Dispatcher.InvokeAsync(async delegate { + if (!request.IsResponseReady) { + var authRequest = request as IAuthenticationRequest; + if (authRequest != null) { + switch (this.owner.checkidRequestList.SelectedIndex) { + case 0: + if (authRequest.IsDirectedIdentity) { + string userIdentityPageBase = this.owner.hostedProvider.UserIdentityPageBase.AbsoluteUri; + if (this.owner.capitalizedHostName.IsChecked.Value) { + userIdentityPageBase = (this.owner.hostedProvider.UserIdentityPageBase.Scheme + Uri.SchemeDelimiter + this.owner.hostedProvider.UserIdentityPageBase.Authority).ToUpperInvariant() + this.owner.hostedProvider.UserIdentityPageBase.PathAndQuery; + } + string leafPath = "directedidentity"; + if (this.owner.directedIdentityTrailingPeriodsCheckbox.IsChecked.Value) { + leafPath += "."; + } + authRequest.ClaimedIdentifier = Identifier.Parse(userIdentityPageBase + leafPath, true); + authRequest.LocalIdentifier = authRequest.ClaimedIdentifier; + } + authRequest.IsAuthenticated = true; + break; + case 1: + authRequest.IsAuthenticated = false; + break; + case 2: + IntPtr oldForegroundWindow = NativeMethods.GetForegroundWindow(); + bool stoleFocus = NativeMethods.SetForegroundWindow(this.owner); + await CheckIdWindow.ProcessAuthenticationAsync(this.owner.hostedProvider, authRequest, cancellationToken); + if (stoleFocus) { + NativeMethods.SetForegroundWindow(oldForegroundWindow); + } + break; + } + } + } + + var responseMessage = await provider.PrepareResponseAsync(request, cancellationToken); + return responseMessage; + }); + } + } + } } diff --git a/samples/OpenIdOfflineProvider/OpenIdOfflineProvider.csproj b/samples/OpenIdOfflineProvider/OpenIdOfflineProvider.csproj index 2d8fd74..ca851e8 100644 --- a/samples/OpenIdOfflineProvider/OpenIdOfflineProvider.csproj +++ b/samples/OpenIdOfflineProvider/OpenIdOfflineProvider.csproj @@ -65,13 +65,19 @@ <SpecificVersion>False</SpecificVersion> <HintPath>..\..\src\packages\log4net.2.0.0\lib\net40-full\log4net.dll</HintPath> </Reference> + <Reference Include="Newtonsoft.Json"> + <HintPath>..\..\src\packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll</HintPath> + </Reference> <Reference Include="System" /> <Reference Include="System.Core"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> <Reference Include="System.Net.Http" /> <Reference Include="System.Net.Http.WebRequest" /> + <Reference Include="System.ServiceModel" /> <Reference Include="System.Web" /> + <Reference Include="System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" /> + <Reference Include="System.Web.Http.SelfHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" /> <Reference Include="System.Xml.Linq"> <RequiredTargetFramework>3.5</RequiredTargetFramework> </Reference> @@ -127,7 +133,6 @@ <DependentUpon>CheckIdWindow.xaml</DependentUpon> </Compile> <Compile Include="HostedProvider.cs" /> - <Compile Include="HttpHost.cs" /> <Compile Include="NativeMethods.cs" /> <Compile Include="Properties\AssemblyInfo.cs"> <SubType>Code</SubType> diff --git a/samples/OpenIdOfflineProvider/packages.config b/samples/OpenIdOfflineProvider/packages.config index 2f4e283..e6e4ef3 100644 --- a/samples/OpenIdOfflineProvider/packages.config +++ b/samples/OpenIdOfflineProvider/packages.config @@ -2,5 +2,6 @@ <packages> <package id="log4net" version="2.0.0" targetFramework="net45" /> <package id="Microsoft.Net.Http" version="2.0.20710.0" targetFramework="net45" /> + <package id="Newtonsoft.Json" version="4.5.11" targetFramework="net45" /> <package id="Validation" version="2.0.2.13022" targetFramework="net45" /> </packages>
\ No newline at end of file |