//-----------------------------------------------------------------------
//
// Copyright (c) Andrew Arnott. All rights reserved.
//
//-----------------------------------------------------------------------
namespace DotNetOpenAuth.OpenIdOfflineProvider.Controllers {
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http;
using Validation;
public class UserController : ApiController {
public HttpResponseMessage Get(string id) {
string localId = null; // string.Format("http://localhost:{0}/user", context.Request.Url.Port);
var opEndpoint = this.Url.Link("default", new { controller = "provider" });
var opEndpointUri = new Uri(opEndpoint);
return new HttpResponseMessage() {
Content = new StringContent(GenerateHtmlDiscoveryDocument(opEndpointUri, localId), Encoding.UTF8, "text/html"),
};
}
///
/// Generates HTML for an identity page.
///
/// The provider endpoint.
/// The local id.
/// The HTML document to return to the RP.
private static string GenerateHtmlDiscoveryDocument(Uri providerEndpoint, string localId) {
Requires.NotNull(providerEndpoint, "providerEndpoint");
const string DelegatedHtmlDiscoveryFormat = @"