瀏覽代碼

[Authentication] Imported v1.0

feature/authentication
Robin Thoni 9 年之前
父節點
當前提交
ffa61dba23
共有 76 個檔案被更改,包括 27001 行新增0 行删除
  1. 28
    0
      Authentication-test/App_Start/BundleConfig.cs
  2. 13
    0
      Authentication-test/App_Start/FilterConfig.cs
  3. 23
    0
      Authentication-test/App_Start/RouteConfig.cs
  4. 24
    0
      Authentication-test/App_Start/WebApiConfig.cs
  5. 39
    0
      Authentication-test/Areas/HelpPage/ApiDescriptionExtensions.cs
  6. 51
    0
      Authentication-test/Areas/HelpPage/App_Start/HelpPageConfig.cs
  7. 45
    0
      Authentication-test/Areas/HelpPage/Controllers/HelpController.cs
  8. 89
    0
      Authentication-test/Areas/HelpPage/HelpPage.css
  9. 26
    0
      Authentication-test/Areas/HelpPage/HelpPageAreaRegistration.cs
  10. 247
    0
      Authentication-test/Areas/HelpPage/HelpPageConfigurationExtensions.cs
  11. 43
    0
      Authentication-test/Areas/HelpPage/Models/HelpPageApiModel.cs
  12. 372
    0
      Authentication-test/Areas/HelpPage/SampleGeneration/HelpPageSampleGenerator.cs
  13. 178
    0
      Authentication-test/Areas/HelpPage/SampleGeneration/HelpPageSampleKey.cs
  14. 41
    0
      Authentication-test/Areas/HelpPage/SampleGeneration/ImageSample.cs
  15. 37
    0
      Authentication-test/Areas/HelpPage/SampleGeneration/InvalidSample.cs
  16. 456
    0
      Authentication-test/Areas/HelpPage/SampleGeneration/ObjectGenerator.cs
  17. 11
    0
      Authentication-test/Areas/HelpPage/SampleGeneration/SampleDirection.cs
  18. 37
    0
      Authentication-test/Areas/HelpPage/SampleGeneration/TextSample.cs
  19. 25
    0
      Authentication-test/Areas/HelpPage/Views/Help/Api.cshtml
  20. 41
    0
      Authentication-test/Areas/HelpPage/Views/Help/DisplayTemplates/ApiGroup.cshtml
  21. 51
    0
      Authentication-test/Areas/HelpPage/Views/Help/DisplayTemplates/HelpPageApiModel.cshtml
  22. 4
    0
      Authentication-test/Areas/HelpPage/Views/Help/DisplayTemplates/ImageSample.cshtml
  23. 13
    0
      Authentication-test/Areas/HelpPage/Views/Help/DisplayTemplates/InvalidSample.cshtml
  24. 44
    0
      Authentication-test/Areas/HelpPage/Views/Help/DisplayTemplates/Parameters.cshtml
  25. 30
    0
      Authentication-test/Areas/HelpPage/Views/Help/DisplayTemplates/Samples.cshtml
  26. 6
    0
      Authentication-test/Areas/HelpPage/Views/Help/DisplayTemplates/TextSample.cshtml
  27. 41
    0
      Authentication-test/Areas/HelpPage/Views/Help/Index.cshtml
  28. 12
    0
      Authentication-test/Areas/HelpPage/Views/Shared/_Layout.cshtml
  29. 62
    0
      Authentication-test/Areas/HelpPage/Views/Web.config
  30. 4
    0
      Authentication-test/Areas/HelpPage/Views/_ViewStart.cshtml
  31. 143
    0
      Authentication-test/Areas/HelpPage/XmlDocumentationProvider.cs
  32. 235
    0
      Authentication-test/Authentication-test.csproj
  33. 42
    0
      Authentication-test/Content/Site.css
  34. 6816
    0
      Authentication-test/Content/bootstrap.css
  35. 20
    0
      Authentication-test/Content/bootstrap.min.css
  36. 18
    0
      Authentication-test/Controllers/HomeController.cs
  37. 39
    0
      Authentication-test/Controllers/ValuesController.cs
  38. 1
    0
      Authentication-test/Global.asax
  39. 23
    0
      Authentication-test/Global.asax.cs
  40. 149
    0
      Authentication-test/Project_Readme.html
  41. 35
    0
      Authentication-test/Properties/AssemblyInfo.cs
  42. 二進制
      Authentication-test/Scripts/_references.js
  43. 2014
    0
      Authentication-test/Scripts/bootstrap.js
  44. 21
    0
      Authentication-test/Scripts/bootstrap.min.js
  45. 2671
    0
      Authentication-test/Scripts/jquery-1.10.2.intellisense.js
  46. 9803
    0
      Authentication-test/Scripts/jquery-1.10.2.js
  47. 23
    0
      Authentication-test/Scripts/jquery-1.10.2.min.js
  48. 1
    0
      Authentication-test/Scripts/jquery-1.10.2.min.map
  49. 1416
    0
      Authentication-test/Scripts/modernizr-2.6.2.js
  50. 340
    0
      Authentication-test/Scripts/respond.js
  51. 20
    0
      Authentication-test/Scripts/respond.min.js
  52. 24
    0
      Authentication-test/Views/Home/Index.cshtml
  53. 17
    0
      Authentication-test/Views/Shared/Error.cshtml
  54. 41
    0
      Authentication-test/Views/Shared/_Layout.cshtml
  55. 35
    0
      Authentication-test/Views/Web.config
  56. 3
    0
      Authentication-test/Views/_ViewStart.cshtml
  57. 30
    0
      Authentication-test/Web.Debug.config
  58. 31
    0
      Authentication-test/Web.Release.config
  59. 49
    0
      Authentication-test/Web.config
  60. 二進制
      Authentication-test/favicon.ico
  61. 二進制
      Authentication-test/fonts/glyphicons-halflings-regular.eot
  62. 228
    0
      Authentication-test/fonts/glyphicons-halflings-regular.svg
  63. 二進制
      Authentication-test/fonts/glyphicons-halflings-regular.ttf
  64. 二進制
      Authentication-test/fonts/glyphicons-halflings-regular.woff
  65. 20
    0
      Authentication-test/packages.config
  66. 79
    0
      Authentication/Authentication.csproj
  67. 16
    0
      Authentication/Authentication.nuspec
  68. 37
    0
      Authentication/Business/Attributes/AuthFilter.cs
  69. 152
    0
      Authentication/Business/AuthProvider.cs
  70. 77
    0
      Authentication/Business/JWT/PasswordHash.cs
  71. 50
    0
      Authentication/Business/JWT/TokenManager.cs
  72. 106
    0
      Authentication/Business/JWT/TokenValidationHandler.cs
  73. 24
    0
      Authentication/DBO/UserDboAuth.cs
  74. 36
    0
      Authentication/Properties/AssemblyInfo.cs
  75. 7
    0
      Authentication/packages.config
  76. 16
    0
      NuGet-3ie.sln

+ 28
- 0
Authentication-test/App_Start/BundleConfig.cs 查看文件

@@ -0,0 +1,28 @@
1
+using System.Web;
2
+using System.Web.Optimization;
3
+
4
+namespace Authentication_test
5
+{
6
+    public class BundleConfig
7
+    {
8
+        // For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
9
+        public static void RegisterBundles(BundleCollection bundles)
10
+        {
11
+            bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
12
+                        "~/Scripts/jquery-{version}.js"));
13
+
14
+            // Use the development version of Modernizr to develop with and learn from. Then, when you're
15
+            // ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
16
+            bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
17
+                        "~/Scripts/modernizr-*"));
18
+
19
+            bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
20
+                      "~/Scripts/bootstrap.js",
21
+                      "~/Scripts/respond.js"));
22
+
23
+            bundles.Add(new StyleBundle("~/Content/css").Include(
24
+                      "~/Content/bootstrap.css",
25
+                      "~/Content/site.css"));
26
+        }
27
+    }
28
+}

+ 13
- 0
Authentication-test/App_Start/FilterConfig.cs 查看文件

@@ -0,0 +1,13 @@
1
+using System.Web;
2
+using System.Web.Mvc;
3
+
4
+namespace Authentication_test
5
+{
6
+    public class FilterConfig
7
+    {
8
+        public static void RegisterGlobalFilters(GlobalFilterCollection filters)
9
+        {
10
+            filters.Add(new HandleErrorAttribute());
11
+        }
12
+    }
13
+}

+ 23
- 0
Authentication-test/App_Start/RouteConfig.cs 查看文件

@@ -0,0 +1,23 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Web;
5
+using System.Web.Mvc;
6
+using System.Web.Routing;
7
+
8
+namespace Authentication_test
9
+{
10
+    public class RouteConfig
11
+    {
12
+        public static void RegisterRoutes(RouteCollection routes)
13
+        {
14
+            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
15
+
16
+            routes.MapRoute(
17
+                name: "Default",
18
+                url: "{controller}/{action}/{id}",
19
+                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
20
+            );
21
+        }
22
+    }
23
+}

+ 24
- 0
Authentication-test/App_Start/WebApiConfig.cs 查看文件

@@ -0,0 +1,24 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Web.Http;
5
+
6
+namespace Authentication_test
7
+{
8
+    public static class WebApiConfig
9
+    {
10
+        public static void Register(HttpConfiguration config)
11
+        {
12
+            // Web API configuration and services
13
+
14
+            // Web API routes
15
+            config.MapHttpAttributeRoutes();
16
+
17
+            config.Routes.MapHttpRoute(
18
+                name: "DefaultApi",
19
+                routeTemplate: "api/{controller}/{id}",
20
+                defaults: new { id = RouteParameter.Optional }
21
+            );
22
+        }
23
+    }
24
+}

+ 39
- 0
Authentication-test/Areas/HelpPage/ApiDescriptionExtensions.cs 查看文件

@@ -0,0 +1,39 @@
1
+using System;
2
+using System.Text;
3
+using System.Web;
4
+using System.Web.Http.Description;
5
+
6
+namespace Authentication_test.Areas.HelpPage
7
+{
8
+    public static class ApiDescriptionExtensions
9
+    {
10
+        /// <summary>
11
+        /// Generates an URI-friendly ID for the <see cref="ApiDescription"/>. E.g. "Get-Values-id_name" instead of "GetValues/{id}?name={name}"
12
+        /// </summary>
13
+        /// <param name="description">The <see cref="ApiDescription"/>.</param>
14
+        /// <returns>The ID as a string.</returns>
15
+        public static string GetFriendlyId(this ApiDescription description)
16
+        {
17
+            string path = description.RelativePath;
18
+            string[] urlParts = path.Split('?');
19
+            string localPath = urlParts[0];
20
+            string queryKeyString = null;
21
+            if (urlParts.Length > 1)
22
+            {
23
+                string query = urlParts[1];
24
+                string[] queryKeys = HttpUtility.ParseQueryString(query).AllKeys;
25
+                queryKeyString = String.Join("_", queryKeys);
26
+            }
27
+
28
+            StringBuilder friendlyPath = new StringBuilder();
29
+            friendlyPath.AppendFormat("{0}-{1}",
30
+                description.HttpMethod.Method,
31
+                localPath.Replace("/", "-").Replace("{", String.Empty).Replace("}", String.Empty));
32
+            if (queryKeyString != null)
33
+            {
34
+                friendlyPath.AppendFormat("_{0}", queryKeyString);
35
+            }
36
+            return friendlyPath.ToString();
37
+        }
38
+    }
39
+}

+ 51
- 0
Authentication-test/Areas/HelpPage/App_Start/HelpPageConfig.cs 查看文件

@@ -0,0 +1,51 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Net.Http.Headers;
4
+using System.Web;
5
+using System.Web.Http;
6
+
7
+namespace Authentication_test.Areas.HelpPage
8
+{
9
+    /// <summary>
10
+    /// Use this class to customize the Help Page.
11
+    /// For example you can set a custom <see cref="System.Web.Http.Description.IDocumentationProvider"/> to supply the documentation
12
+    /// or you can provide the samples for the requests/responses.
13
+    /// </summary>
14
+    public static class HelpPageConfig
15
+    {
16
+        public static void Register(HttpConfiguration config)
17
+        {
18
+            //// Uncomment the following to use the documentation from XML documentation file.
19
+            //config.SetDocumentationProvider(new XmlDocumentationProvider(HttpContext.Current.Server.MapPath("~/App_Data/XmlDocument.xml")));
20
+
21
+            //// Uncomment the following to use "sample string" as the sample for all actions that have string as the body parameter or return type.
22
+            //// Also, the string arrays will be used for IEnumerable<string>. The sample objects will be serialized into different media type 
23
+            //// formats by the available formatters.
24
+            //config.SetSampleObjects(new Dictionary<Type, object>
25
+            //{
26
+            //    {typeof(string), "sample string"},
27
+            //    {typeof(IEnumerable<string>), new string[]{"sample 1", "sample 2"}}
28
+            //});
29
+
30
+            //// Uncomment the following to use "[0]=foo&[1]=bar" directly as the sample for all actions that support form URL encoded format
31
+            //// and have IEnumerable<string> as the body parameter or return type.
32
+            //config.SetSampleForType("[0]=foo&[1]=bar", new MediaTypeHeaderValue("application/x-www-form-urlencoded"), typeof(IEnumerable<string>));
33
+
34
+            //// Uncomment the following to use "1234" directly as the request sample for media type "text/plain" on the controller named "Values"
35
+            //// and action named "Put".
36
+            //config.SetSampleRequest("1234", new MediaTypeHeaderValue("text/plain"), "Values", "Put");
37
+
38
+            //// Uncomment the following to use the image on "../images/aspNetHome.png" directly as the response sample for media type "image/png"
39
+            //// on the controller named "Values" and action named "Get" with parameter "id".
40
+            //config.SetSampleResponse(new ImageSample("../images/aspNetHome.png"), new MediaTypeHeaderValue("image/png"), "Values", "Get", "id");
41
+
42
+            //// Uncomment the following to correct the sample request when the action expects an HttpRequestMessage with ObjectContent<string>.
43
+            //// The sample will be generated as if the controller named "Values" and action named "Get" were having string as the body parameter.
44
+            //config.SetActualRequestType(typeof(string), "Values", "Get");
45
+
46
+            //// Uncomment the following to correct the sample response when the action returns an HttpResponseMessage with ObjectContent<string>.
47
+            //// The sample will be generated as if the controller named "Values" and action named "Post" were returning a string.
48
+            //config.SetActualResponseType(typeof(string), "Values", "Post");
49
+        }
50
+    }
51
+}

+ 45
- 0
Authentication-test/Areas/HelpPage/Controllers/HelpController.cs 查看文件

@@ -0,0 +1,45 @@
1
+using System;
2
+using System.Web.Http;
3
+using System.Web.Mvc;
4
+using Authentication_test.Areas.HelpPage.Models;
5
+
6
+namespace Authentication_test.Areas.HelpPage.Controllers
7
+{
8
+    /// <summary>
9
+    /// The controller that will handle requests for the help page.
10
+    /// </summary>
11
+    public class HelpController : Controller
12
+    {
13
+        public HelpController()
14
+            : this(GlobalConfiguration.Configuration)
15
+        {
16
+        }
17
+
18
+        public HelpController(HttpConfiguration config)
19
+        {
20
+            Configuration = config;
21
+        }
22
+
23
+        public HttpConfiguration Configuration { get; private set; }
24
+
25
+        public ActionResult Index()
26
+        {
27
+            ViewBag.DocumentationProvider = Configuration.Services.GetDocumentationProvider();
28
+            return View(Configuration.Services.GetApiExplorer().ApiDescriptions);
29
+        }
30
+
31
+        public ActionResult Api(string apiId)
32
+        {
33
+            if (!String.IsNullOrEmpty(apiId))
34
+            {
35
+                HelpPageApiModel apiModel = Configuration.GetHelpPageApiModel(apiId);
36
+                if (apiModel != null)
37
+                {
38
+                    return View(apiModel);
39
+                }
40
+            }
41
+
42
+            return View("Error");
43
+        }
44
+    }
45
+}

+ 89
- 0
Authentication-test/Areas/HelpPage/HelpPage.css 查看文件

@@ -0,0 +1,89 @@
1
+pre.wrapped {
2
+    white-space: -moz-pre-wrap;
3
+    white-space: -pre-wrap;
4
+    white-space: -o-pre-wrap;
5
+    white-space: pre-wrap;
6
+}
7
+
8
+.warning-message-container {
9
+    margin-top: 20px;
10
+    padding: 0 10px;
11
+    color: #525252;
12
+    background: #EFDCA9; 
13
+    border: 1px solid #CCCCCC;
14
+}
15
+
16
+.help-page-table {
17
+    width: 100%;
18
+    border-collapse: collapse;
19
+    text-align: left;
20
+    margin: 0px 0px 20px 0px;
21
+    border-top: 2px solid #D4D4D4;
22
+}
23
+
24
+.help-page-table th {
25
+    text-align: left;
26
+    font-weight: bold;
27
+    border-bottom: 2px solid #D4D4D4;
28
+    padding: 8px 6px 8px 6px;
29
+}
30
+
31
+.help-page-table td {
32
+    border-bottom: 2px solid #D4D4D4;
33
+    padding: 15px 8px 15px 8px;
34
+    vertical-align: top;
35
+}
36
+
37
+.help-page-table pre, .help-page-table p {
38
+    margin: 0px;
39
+    padding: 0px;
40
+    font-family: inherit;
41
+    font-size: 100%;
42
+}
43
+
44
+.help-page-table tbody tr:hover td {
45
+    background-color: #F3F3F3;
46
+}
47
+
48
+a:hover {
49
+    background-color: transparent;
50
+}
51
+
52
+.sample-header {
53
+    border: 2px solid #D4D4D4;
54
+    background: #76B8DB;
55
+    color: #FFFFFF;
56
+    padding: 8px 15px;
57
+    border-bottom: none;
58
+    display: inline-block;
59
+    margin: 10px 0px 0px 0px;
60
+}
61
+
62
+.sample-content {
63
+    display: block;
64
+    border-width: 0;
65
+    padding: 15px 20px;
66
+    background: #FFFFFF;
67
+    border: 2px solid #D4D4D4;
68
+    margin: 0px 0px 10px 0px;
69
+}
70
+
71
+.api-name {
72
+    width: 40%;
73
+}
74
+
75
+.api-documentation {
76
+    width: 60%;
77
+}
78
+
79
+.parameter-name {
80
+    width: 20%;
81
+}
82
+
83
+.parameter-documentation {
84
+    width: 50%;
85
+}
86
+
87
+.parameter-source {
88
+    width: 30%;
89
+}

+ 26
- 0
Authentication-test/Areas/HelpPage/HelpPageAreaRegistration.cs 查看文件

@@ -0,0 +1,26 @@
1
+using System.Web.Http;
2
+using System.Web.Mvc;
3
+
4
+namespace Authentication_test.Areas.HelpPage
5
+{
6
+    public class HelpPageAreaRegistration : AreaRegistration
7
+    {
8
+        public override string AreaName
9
+        {
10
+            get
11
+            {
12
+                return "HelpPage";
13
+            }
14
+        }
15
+
16
+        public override void RegisterArea(AreaRegistrationContext context)
17
+        {
18
+            context.MapRoute(
19
+                "HelpPage_Default",
20
+                "Help/{action}/{apiId}",
21
+                new { controller = "Help", action = "Index", apiId = UrlParameter.Optional });
22
+
23
+            HelpPageConfig.Register(GlobalConfiguration.Configuration);
24
+        }
25
+    }
26
+}

+ 247
- 0
Authentication-test/Areas/HelpPage/HelpPageConfigurationExtensions.cs 查看文件

@@ -0,0 +1,247 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Collections.ObjectModel;
4
+using System.Diagnostics.CodeAnalysis;
5
+using System.Globalization;
6
+using System.Linq;
7
+using System.Net.Http.Headers;
8
+using System.Web.Http;
9
+using System.Web.Http.Description;
10
+using Authentication_test.Areas.HelpPage.Models;
11
+
12
+namespace Authentication_test.Areas.HelpPage
13
+{
14
+    public static class HelpPageConfigurationExtensions
15
+    {
16
+        private const string ApiModelPrefix = "MS_HelpPageApiModel_";
17
+
18
+        /// <summary>
19
+        /// Sets the documentation provider for help page.
20
+        /// </summary>
21
+        /// <param name="config">The <see cref="HttpConfiguration"/>.</param>
22
+        /// <param name="documentationProvider">The documentation provider.</param>
23
+        public static void SetDocumentationProvider(this HttpConfiguration config, IDocumentationProvider documentationProvider)
24
+        {
25
+            config.Services.Replace(typeof(IDocumentationProvider), documentationProvider);
26
+        }
27
+
28
+        /// <summary>
29
+        /// Sets the objects that will be used by the formatters to produce sample requests/responses.
30
+        /// </summary>
31
+        /// <param name="config">The <see cref="HttpConfiguration"/>.</param>
32
+        /// <param name="sampleObjects">The sample objects.</param>
33
+        public static void SetSampleObjects(this HttpConfiguration config, IDictionary<Type, object> sampleObjects)
34
+        {
35
+            config.GetHelpPageSampleGenerator().SampleObjects = sampleObjects;
36
+        }
37
+
38
+        /// <summary>
39
+        /// Sets the sample request directly for the specified media type and action.
40
+        /// </summary>
41
+        /// <param name="config">The <see cref="HttpConfiguration"/>.</param>
42
+        /// <param name="sample">The sample request.</param>
43
+        /// <param name="mediaType">The media type.</param>
44
+        /// <param name="controllerName">Name of the controller.</param>
45
+        /// <param name="actionName">Name of the action.</param>
46
+        public static void SetSampleRequest(this HttpConfiguration config, object sample, MediaTypeHeaderValue mediaType, string controllerName, string actionName)
47
+        {
48
+            config.GetHelpPageSampleGenerator().ActionSamples.Add(new HelpPageSampleKey(mediaType, SampleDirection.Request, controllerName, actionName, new[] { "*" }), sample);
49
+        }
50
+
51
+        /// <summary>
52
+        /// Sets the sample request directly for the specified media type and action with parameters.
53
+        /// </summary>
54
+        /// <param name="config">The <see cref="HttpConfiguration"/>.</param>
55
+        /// <param name="sample">The sample request.</param>
56
+        /// <param name="mediaType">The media type.</param>
57
+        /// <param name="controllerName">Name of the controller.</param>
58
+        /// <param name="actionName">Name of the action.</param>
59
+        /// <param name="parameterNames">The parameter names.</param>
60
+        public static void SetSampleRequest(this HttpConfiguration config, object sample, MediaTypeHeaderValue mediaType, string controllerName, string actionName, params string[] parameterNames)
61
+        {
62
+            config.GetHelpPageSampleGenerator().ActionSamples.Add(new HelpPageSampleKey(mediaType, SampleDirection.Request, controllerName, actionName, parameterNames), sample);
63
+        }
64
+
65
+        /// <summary>
66
+        /// Sets the sample request directly for the specified media type of the action.
67
+        /// </summary>
68
+        /// <param name="config">The <see cref="HttpConfiguration"/>.</param>
69
+        /// <param name="sample">The sample response.</param>
70
+        /// <param name="mediaType">The media type.</param>
71
+        /// <param name="controllerName">Name of the controller.</param>
72
+        /// <param name="actionName">Name of the action.</param>
73
+        public static void SetSampleResponse(this HttpConfiguration config, object sample, MediaTypeHeaderValue mediaType, string controllerName, string actionName)
74
+        {
75
+            config.GetHelpPageSampleGenerator().ActionSamples.Add(new HelpPageSampleKey(mediaType, SampleDirection.Response, controllerName, actionName, new[] { "*" }), sample);
76
+        }
77
+
78
+        /// <summary>
79
+        /// Sets the sample response directly for the specified media type of the action with specific parameters.
80
+        /// </summary>
81
+        /// <param name="config">The <see cref="HttpConfiguration"/>.</param>
82
+        /// <param name="sample">The sample response.</param>
83
+        /// <param name="mediaType">The media type.</param>
84
+        /// <param name="controllerName">Name of the controller.</param>
85
+        /// <param name="actionName">Name of the action.</param>
86
+        /// <param name="parameterNames">The parameter names.</param>
87
+        public static void SetSampleResponse(this HttpConfiguration config, object sample, MediaTypeHeaderValue mediaType, string controllerName, string actionName, params string[] parameterNames)
88
+        {
89
+            config.GetHelpPageSampleGenerator().ActionSamples.Add(new HelpPageSampleKey(mediaType, SampleDirection.Response, controllerName, actionName, parameterNames), sample);
90
+        }
91
+
92
+        /// <summary>
93
+        /// Sets the sample directly for all actions with the specified type and media type.
94
+        /// </summary>
95
+        /// <param name="config">The <see cref="HttpConfiguration"/>.</param>
96
+        /// <param name="sample">The sample.</param>
97
+        /// <param name="mediaType">The media type.</param>
98
+        /// <param name="type">The parameter type or return type of an action.</param>
99
+        public static void SetSampleForType(this HttpConfiguration config, object sample, MediaTypeHeaderValue mediaType, Type type)
100
+        {
101
+            config.GetHelpPageSampleGenerator().ActionSamples.Add(new HelpPageSampleKey(mediaType, type), sample);
102
+        }
103
+
104
+        /// <summary>
105
+        /// Specifies the actual type of <see cref="System.Net.Http.ObjectContent{T}"/> passed to the <see cref="System.Net.Http.HttpRequestMessage"/> in an action. 
106
+        /// The help page will use this information to produce more accurate request samples.
107
+        /// </summary>
108
+        /// <param name="config">The <see cref="HttpConfiguration"/>.</param>
109
+        /// <param name="type">The type.</param>
110
+        /// <param name="controllerName">Name of the controller.</param>
111
+        /// <param name="actionName">Name of the action.</param>
112
+        public static void SetActualRequestType(this HttpConfiguration config, Type type, string controllerName, string actionName)
113
+        {
114
+            config.GetHelpPageSampleGenerator().ActualHttpMessageTypes.Add(new HelpPageSampleKey(SampleDirection.Request, controllerName, actionName, new[] { "*" }), type);
115
+        }
116
+
117
+        /// <summary>
118
+        /// Specifies the actual type of <see cref="System.Net.Http.ObjectContent{T}"/> passed to the <see cref="System.Net.Http.HttpRequestMessage"/> in an action. 
119
+        /// The help page will use this information to produce more accurate request samples.
120
+        /// </summary>
121
+        /// <param name="config">The <see cref="HttpConfiguration"/>.</param>
122
+        /// <param name="type">The type.</param>
123
+        /// <param name="controllerName">Name of the controller.</param>
124
+        /// <param name="actionName">Name of the action.</param>
125
+        /// <param name="parameterNames">The parameter names.</param>
126
+        public static void SetActualRequestType(this HttpConfiguration config, Type type, string controllerName, string actionName, params string[] parameterNames)
127
+        {
128
+            config.GetHelpPageSampleGenerator().ActualHttpMessageTypes.Add(new HelpPageSampleKey(SampleDirection.Request, controllerName, actionName, parameterNames), type);
129
+        }
130
+
131
+        /// <summary>
132
+        /// Specifies the actual type of <see cref="System.Net.Http.ObjectContent{T}"/> returned as part of the <see cref="System.Net.Http.HttpRequestMessage"/> in an action. 
133
+        /// The help page will use this information to produce more accurate response samples.
134
+        /// </summary>
135
+        /// <param name="config">The <see cref="HttpConfiguration"/>.</param>
136
+        /// <param name="type">The type.</param>
137
+        /// <param name="controllerName">Name of the controller.</param>
138
+        /// <param name="actionName">Name of the action.</param>
139
+        public static void SetActualResponseType(this HttpConfiguration config, Type type, string controllerName, string actionName)
140
+        {
141
+            config.GetHelpPageSampleGenerator().ActualHttpMessageTypes.Add(new HelpPageSampleKey(SampleDirection.Response, controllerName, actionName, new[] { "*" }), type);
142
+        }
143
+
144
+        /// <summary>
145
+        /// Specifies the actual type of <see cref="System.Net.Http.ObjectContent{T}"/> returned as part of the <see cref="System.Net.Http.HttpRequestMessage"/> in an action. 
146
+        /// The help page will use this information to produce more accurate response samples.
147
+        /// </summary>
148
+        /// <param name="config">The <see cref="HttpConfiguration"/>.</param>
149
+        /// <param name="type">The type.</param>
150
+        /// <param name="controllerName">Name of the controller.</param>
151
+        /// <param name="actionName">Name of the action.</param>
152
+        /// <param name="parameterNames">The parameter names.</param>
153
+        public static void SetActualResponseType(this HttpConfiguration config, Type type, string controllerName, string actionName, params string[] parameterNames)
154
+        {
155
+            config.GetHelpPageSampleGenerator().ActualHttpMessageTypes.Add(new HelpPageSampleKey(SampleDirection.Response, controllerName, actionName, parameterNames), type);
156
+        }
157
+
158
+        /// <summary>
159
+        /// Gets the help page sample generator.
160
+        /// </summary>
161
+        /// <param name="config">The <see cref="HttpConfiguration"/>.</param>
162
+        /// <returns>The help page sample generator.</returns>
163
+        public static HelpPageSampleGenerator GetHelpPageSampleGenerator(this HttpConfiguration config)
164
+        {
165
+            return (HelpPageSampleGenerator)config.Properties.GetOrAdd(
166
+                typeof(HelpPageSampleGenerator),
167
+                k => new HelpPageSampleGenerator());
168
+        }
169
+
170
+        /// <summary>
171
+        /// Sets the help page sample generator.
172
+        /// </summary>
173
+        /// <param name="config">The <see cref="HttpConfiguration"/>.</param>
174
+        /// <param name="sampleGenerator">The help page sample generator.</param>
175
+        public static void SetHelpPageSampleGenerator(this HttpConfiguration config, HelpPageSampleGenerator sampleGenerator)
176
+        {
177
+            config.Properties.AddOrUpdate(
178
+                typeof(HelpPageSampleGenerator),
179
+                k => sampleGenerator,
180
+                (k, o) => sampleGenerator);
181
+        }
182
+
183
+        /// <summary>
184
+        /// Gets the model that represents an API displayed on the help page. The model is initialized on the first call and cached for subsequent calls.
185
+        /// </summary>
186
+        /// <param name="config">The <see cref="HttpConfiguration"/>.</param>
187
+        /// <param name="apiDescriptionId">The <see cref="ApiDescription"/> ID.</param>
188
+        /// <returns>
189
+        /// An <see cref="HelpPageApiModel"/>
190
+        /// </returns>
191
+        public static HelpPageApiModel GetHelpPageApiModel(this HttpConfiguration config, string apiDescriptionId)
192
+        {
193
+            object model;
194
+            string modelId = ApiModelPrefix + apiDescriptionId;
195
+            if (!config.Properties.TryGetValue(modelId, out model))
196
+            {
197
+                Collection<ApiDescription> apiDescriptions = config.Services.GetApiExplorer().ApiDescriptions;
198
+                ApiDescription apiDescription = apiDescriptions.FirstOrDefault(api => String.Equals(api.GetFriendlyId(), apiDescriptionId, StringComparison.OrdinalIgnoreCase));
199
+                if (apiDescription != null)
200
+                {
201
+                    HelpPageSampleGenerator sampleGenerator = config.GetHelpPageSampleGenerator();
202
+                    model = GenerateApiModel(apiDescription, sampleGenerator);
203
+                    config.Properties.TryAdd(modelId, model);
204
+                }
205
+            }
206
+
207
+            return (HelpPageApiModel)model;
208
+        }
209
+
210
+        [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "The exception is recorded as ErrorMessages.")]
211
+        private static HelpPageApiModel GenerateApiModel(ApiDescription apiDescription, HelpPageSampleGenerator sampleGenerator)
212
+        {
213
+            HelpPageApiModel apiModel = new HelpPageApiModel();
214
+            apiModel.ApiDescription = apiDescription;
215
+
216
+            try
217
+            {
218
+                foreach (var item in sampleGenerator.GetSampleRequests(apiDescription))
219
+                {
220
+                    apiModel.SampleRequests.Add(item.Key, item.Value);
221
+                    LogInvalidSampleAsError(apiModel, item.Value);
222
+                }
223
+
224
+                foreach (var item in sampleGenerator.GetSampleResponses(apiDescription))
225
+                {
226
+                    apiModel.SampleResponses.Add(item.Key, item.Value);
227
+                    LogInvalidSampleAsError(apiModel, item.Value);
228
+                }
229
+            }
230
+            catch (Exception e)
231
+            {
232
+                apiModel.ErrorMessages.Add(String.Format(CultureInfo.CurrentCulture, "An exception has occurred while generating the sample. Exception Message: {0}", e.Message));
233
+            }
234
+
235
+            return apiModel;
236
+        }
237
+
238
+        private static void LogInvalidSampleAsError(HelpPageApiModel apiModel, object sample)
239
+        {
240
+            InvalidSample invalidSample = sample as InvalidSample;
241
+            if (invalidSample != null)
242
+            {
243
+                apiModel.ErrorMessages.Add(invalidSample.ErrorMessage);
244
+            }
245
+        }
246
+    }
247
+}

+ 43
- 0
Authentication-test/Areas/HelpPage/Models/HelpPageApiModel.cs 查看文件

@@ -0,0 +1,43 @@
1
+using System.Collections.Generic;
2
+using System.Collections.ObjectModel;
3
+using System.Net.Http.Headers;
4
+using System.Web.Http.Description;
5
+
6
+namespace Authentication_test.Areas.HelpPage.Models
7
+{
8
+    /// <summary>
9
+    /// The model that represents an API displayed on the help page.
10
+    /// </summary>
11
+    public class HelpPageApiModel
12
+    {
13
+        /// <summary>
14
+        /// Initializes a new instance of the <see cref="HelpPageApiModel"/> class.
15
+        /// </summary>
16
+        public HelpPageApiModel()
17
+        {
18
+            SampleRequests = new Dictionary<MediaTypeHeaderValue, object>();
19
+            SampleResponses = new Dictionary<MediaTypeHeaderValue, object>();
20
+            ErrorMessages = new Collection<string>();
21
+        }
22
+
23
+        /// <summary>
24
+        /// Gets or sets the <see cref="ApiDescription"/> that describes the API.
25
+        /// </summary>
26
+        public ApiDescription ApiDescription { get; set; }
27
+
28
+        /// <summary>
29
+        /// Gets the sample requests associated with the API.
30
+        /// </summary>
31
+        public IDictionary<MediaTypeHeaderValue, object> SampleRequests { get; private set; }
32
+
33
+        /// <summary>
34
+        /// Gets the sample responses associated with the API.
35
+        /// </summary>
36
+        public IDictionary<MediaTypeHeaderValue, object> SampleResponses { get; private set; }
37
+
38
+        /// <summary>
39
+        /// Gets the error messages associated with this model.
40
+        /// </summary>
41
+        public Collection<string> ErrorMessages { get; private set; }
42
+    }
43
+}

+ 372
- 0
Authentication-test/Areas/HelpPage/SampleGeneration/HelpPageSampleGenerator.cs 查看文件

@@ -0,0 +1,372 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Collections.ObjectModel;
4
+using System.ComponentModel;
5
+using System.Diagnostics.CodeAnalysis;
6
+using System.Globalization;
7
+using System.IO;
8
+using System.Linq;
9
+using System.Net.Http;
10
+using System.Net.Http.Formatting;
11
+using System.Net.Http.Headers;
12
+using System.Web.Http.Description;
13
+using System.Xml.Linq;
14
+using Newtonsoft.Json;
15
+
16
+namespace Authentication_test.Areas.HelpPage
17
+{
18
+    /// <summary>
19
+    /// This class will generate the samples for the help page.
20
+    /// </summary>
21
+    public class HelpPageSampleGenerator
22
+    {
23
+        /// <summary>
24
+        /// Initializes a new instance of the <see cref="HelpPageSampleGenerator"/> class.
25
+        /// </summary>
26
+        public HelpPageSampleGenerator()
27
+        {
28
+            ActualHttpMessageTypes = new Dictionary<HelpPageSampleKey, Type>();
29
+            ActionSamples = new Dictionary<HelpPageSampleKey, object>();
30
+            SampleObjects = new Dictionary<Type, object>();
31
+        }
32
+
33
+        /// <summary>
34
+        /// Gets CLR types that are used as the content of <see cref="HttpRequestMessage"/> or <see cref="HttpResponseMessage"/>.
35
+        /// </summary>
36
+        public IDictionary<HelpPageSampleKey, Type> ActualHttpMessageTypes { get; internal set; }
37
+
38
+        /// <summary>
39
+        /// Gets the objects that are used directly as samples for certain actions.
40
+        /// </summary>
41
+        public IDictionary<HelpPageSampleKey, object> ActionSamples { get; internal set; }
42
+
43
+        /// <summary>
44
+        /// Gets the objects that are serialized as samples by the supported formatters.
45
+        /// </summary>
46
+        public IDictionary<Type, object> SampleObjects { get; internal set; }
47
+
48
+        /// <summary>
49
+        /// Gets the request body samples for a given <see cref="ApiDescription"/>.
50
+        /// </summary>
51
+        /// <param name="api">The <see cref="ApiDescription"/>.</param>
52
+        /// <returns>The samples keyed by media type.</returns>
53
+        public IDictionary<MediaTypeHeaderValue, object> GetSampleRequests(ApiDescription api)
54
+        {
55
+            return GetSample(api, SampleDirection.Request);
56
+        }
57
+
58
+        /// <summary>
59
+        /// Gets the response body samples for a given <see cref="ApiDescription"/>.
60
+        /// </summary>
61
+        /// <param name="api">The <see cref="ApiDescription"/>.</param>
62
+        /// <returns>The samples keyed by media type.</returns>
63
+        public IDictionary<MediaTypeHeaderValue, object> GetSampleResponses(ApiDescription api)
64
+        {
65
+            return GetSample(api, SampleDirection.Response);
66
+        }
67
+
68
+        /// <summary>
69
+        /// Gets the request or response body samples.
70
+        /// </summary>
71
+        /// <param name="api">The <see cref="ApiDescription"/>.</param>
72
+        /// <param name="sampleDirection">The value indicating whether the sample is for a request or for a response.</param>
73
+        /// <returns>The samples keyed by media type.</returns>
74
+        public virtual IDictionary<MediaTypeHeaderValue, object> GetSample(ApiDescription api, SampleDirection sampleDirection)
75
+        {
76
+            if (api == null)
77
+            {
78
+                throw new ArgumentNullException("api");
79
+            }
80
+            string controllerName = api.ActionDescriptor.ControllerDescriptor.ControllerName;
81
+            string actionName = api.ActionDescriptor.ActionName;
82
+            IEnumerable<string> parameterNames = api.ParameterDescriptions.Select(p => p.Name);
83
+            Collection<MediaTypeFormatter> formatters;
84
+            Type type = ResolveType(api, controllerName, actionName, parameterNames, sampleDirection, out formatters);
85
+            var samples = new Dictionary<MediaTypeHeaderValue, object>();
86
+
87
+            // Use the samples provided directly for actions
88
+            var actionSamples = GetAllActionSamples(controllerName, actionName, parameterNames, sampleDirection);
89
+            foreach (var actionSample in actionSamples)
90
+            {
91
+                samples.Add(actionSample.Key.MediaType, WrapSampleIfString(actionSample.Value));
92
+            }
93
+
94
+            // Do the sample generation based on formatters only if an action doesn't return an HttpResponseMessage.
95
+            // Here we cannot rely on formatters because we don't know what's in the HttpResponseMessage, it might not even use formatters.
96
+            if (type != null && !typeof(HttpResponseMessage).IsAssignableFrom(type))
97
+            {
98
+                object sampleObject = GetSampleObject(type);
99
+                foreach (var formatter in formatters)
100
+                {
101
+                    foreach (MediaTypeHeaderValue mediaType in formatter.SupportedMediaTypes)
102
+                    {
103
+                        if (!samples.ContainsKey(mediaType))
104
+                        {
105
+                            object sample = GetActionSample(controllerName, actionName, parameterNames, type, formatter, mediaType, sampleDirection);
106
+
107
+                            // If no sample found, try generate sample using formatter and sample object
108
+                            if (sample == null && sampleObject != null)
109
+                            {
110
+                                sample = WriteSampleObjectUsingFormatter(formatter, sampleObject, type, mediaType);
111
+                            }
112
+
113
+                            samples.Add(mediaType, WrapSampleIfString(sample));
114
+                        }
115
+                    }
116
+                }
117
+            }
118
+
119
+            return samples;
120
+        }
121
+
122
+        /// <summary>
123
+        /// Search for samples that are provided directly through <see cref="ActionSamples"/>.
124
+        /// </summary>
125
+        /// <param name="controllerName">Name of the controller.</param>
126
+        /// <param name="actionName">Name of the action.</param>
127
+        /// <param name="parameterNames">The parameter names.</param>
128
+        /// <param name="type">The CLR type.</param>
129
+        /// <param name="formatter">The formatter.</param>
130
+        /// <param name="mediaType">The media type.</param>
131
+        /// <param name="sampleDirection">The value indicating whether the sample is for a request or for a response.</param>
132
+        /// <returns>The sample that matches the parameters.</returns>
133
+        public virtual object GetActionSample(string controllerName, string actionName, IEnumerable<string> parameterNames, Type type, MediaTypeFormatter formatter, MediaTypeHeaderValue mediaType, SampleDirection sampleDirection)
134
+        {
135
+            object sample;
136
+
137
+            // First, try get sample provided for a specific mediaType, controllerName, actionName and parameterNames.
138
+            // If not found, try get the sample provided for a specific mediaType, controllerName and actionName regardless of the parameterNames
139
+            // If still not found, try get the sample provided for a specific type and mediaType 
140
+            if (ActionSamples.TryGetValue(new HelpPageSampleKey(mediaType, sampleDirection, controllerName, actionName, parameterNames), out sample) ||
141
+                ActionSamples.TryGetValue(new HelpPageSampleKey(mediaType, sampleDirection, controllerName, actionName, new[] { "*" }), out sample) ||
142
+                ActionSamples.TryGetValue(new HelpPageSampleKey(mediaType, type), out sample))
143
+            {
144
+                return sample;
145
+            }
146
+
147
+            return null;
148
+        }
149
+
150
+        /// <summary>
151
+        /// Gets the sample object that will be serialized by the formatters. 
152
+        /// First, it will look at the <see cref="SampleObjects"/>. If no sample object is found, it will try to create one using <see cref="ObjectGenerator"/>.
153
+        /// </summary>
154
+        /// <param name="type">The type.</param>
155
+        /// <returns>The sample object.</returns>
156
+        public virtual object GetSampleObject(Type type)
157
+        {
158
+            object sampleObject;
159
+
160
+            if (!SampleObjects.TryGetValue(type, out sampleObject))
161
+            {
162
+                // Try create a default sample object
163
+                ObjectGenerator objectGenerator = new ObjectGenerator();
164
+                sampleObject = objectGenerator.GenerateObject(type);
165
+            }
166
+
167
+            return sampleObject;
168
+        }
169
+
170
+        /// <summary>
171
+        /// Resolves the type of the action parameter or return value when <see cref="HttpRequestMessage"/> or <see cref="HttpResponseMessage"/> is used.
172
+        /// </summary>
173
+        /// <param name="api">The <see cref="ApiDescription"/>.</param>
174
+        /// <param name="controllerName">Name of the controller.</param>
175
+        /// <param name="actionName">Name of the action.</param>
176
+        /// <param name="parameterNames">The parameter names.</param>
177
+        /// <param name="sampleDirection">The value indicating whether the sample is for a request or a response.</param>
178
+        /// <param name="formatters">The formatters.</param>
179
+        [SuppressMessage("Microsoft.Design", "CA1021:AvoidOutParameters", Justification = "This is only used in advanced scenarios.")]
180
+        public virtual Type ResolveType(ApiDescription api, string controllerName, string actionName, IEnumerable<string> parameterNames, SampleDirection sampleDirection, out Collection<MediaTypeFormatter> formatters)
181
+        {
182
+            if (!Enum.IsDefined(typeof(SampleDirection), sampleDirection))
183
+            {
184
+                throw new InvalidEnumArgumentException("sampleDirection", (int)sampleDirection, typeof(SampleDirection));
185
+            }
186
+            if (api == null)
187
+            {
188
+                throw new ArgumentNullException("api");
189
+            }
190
+            Type type;
191
+            if (ActualHttpMessageTypes.TryGetValue(new HelpPageSampleKey(sampleDirection, controllerName, actionName, parameterNames), out type) ||
192
+                ActualHttpMessageTypes.TryGetValue(new HelpPageSampleKey(sampleDirection, controllerName, actionName, new[] { "*" }), out type))
193
+            {
194
+                // Re-compute the supported formatters based on type
195
+                Collection<MediaTypeFormatter> newFormatters = new Collection<MediaTypeFormatter>();
196
+                foreach (var formatter in api.ActionDescriptor.Configuration.Formatters)
197
+                {
198
+                    if (IsFormatSupported(sampleDirection, formatter, type))
199
+                    {
200
+                        newFormatters.Add(formatter);
201
+                    }
202
+                }
203
+                formatters = newFormatters;
204
+            }
205
+            else
206
+            {
207
+                switch (sampleDirection)
208
+                {
209
+                    case SampleDirection.Request:
210
+                        ApiParameterDescription requestBodyParameter = api.ParameterDescriptions.FirstOrDefault(p => p.Source == ApiParameterSource.FromBody);
211
+                        type = requestBodyParameter == null ? null : requestBodyParameter.ParameterDescriptor.ParameterType;
212
+                        formatters = api.SupportedRequestBodyFormatters;
213
+                        break;
214
+                    case SampleDirection.Response:
215
+                    default:
216
+                        type = api.ResponseDescription.ResponseType ?? api.ResponseDescription.DeclaredType;
217
+                        formatters = api.SupportedResponseFormatters;
218
+                        break;
219
+                }
220
+            }
221
+
222
+            return type;
223
+        }
224
+
225
+        /// <summary>
226
+        /// Writes the sample object using formatter.
227
+        /// </summary>
228
+        /// <param name="formatter">The formatter.</param>
229
+        /// <param name="value">The value.</param>
230
+        /// <param name="type">The type.</param>
231
+        /// <param name="mediaType">Type of the media.</param>
232
+        /// <returns></returns>
233
+        [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "The exception is recorded as InvalidSample.")]
234
+        public virtual object WriteSampleObjectUsingFormatter(MediaTypeFormatter formatter, object value, Type type, MediaTypeHeaderValue mediaType)
235
+        {
236
+            if (formatter == null)
237
+            {
238
+                throw new ArgumentNullException("formatter");
239
+            }
240
+            if (mediaType == null)
241
+            {
242
+                throw new ArgumentNullException("mediaType");
243
+            }
244
+
245
+            object sample = String.Empty;
246
+            MemoryStream ms = null;
247
+            HttpContent content = null;
248
+            try
249
+            {
250
+                if (formatter.CanWriteType(type))
251
+                {
252
+                    ms = new MemoryStream();
253
+                    content = new ObjectContent(type, value, formatter, mediaType);
254
+                    formatter.WriteToStreamAsync(type, value, ms, content, null).Wait();
255
+                    ms.Position = 0;
256
+                    StreamReader reader = new StreamReader(ms);
257
+                    string serializedSampleString = reader.ReadToEnd();
258
+                    if (mediaType.MediaType.ToUpperInvariant().Contains("XML"))
259
+                    {
260
+                        serializedSampleString = TryFormatXml(serializedSampleString);
261
+                    }
262
+                    else if (mediaType.MediaType.ToUpperInvariant().Contains("JSON"))
263
+                    {
264
+                        serializedSampleString = TryFormatJson(serializedSampleString);
265
+                    }
266
+
267
+                    sample = new TextSample(serializedSampleString);
268
+                }
269
+                else
270
+                {
271
+                    sample = new InvalidSample(String.Format(
272
+                        CultureInfo.CurrentCulture,
273
+                        "Failed to generate the sample for media type '{0}'. Cannot use formatter '{1}' to write type '{2}'.",
274
+                        mediaType,
275
+                        formatter.GetType().Name,
276
+                        type.Name));
277
+                }
278
+            }
279
+            catch (Exception e)
280
+            {
281
+                sample = new InvalidSample(String.Format(
282
+                    CultureInfo.CurrentCulture,
283
+                    "An exception has occurred while using the formatter '{0}' to generate sample for media type '{1}'. Exception message: {2}",
284
+                    formatter.GetType().Name,
285
+                    mediaType.MediaType,
286
+                    e.Message));
287
+            }
288
+            finally
289
+            {
290
+                if (ms != null)
291
+                {
292
+                    ms.Dispose();
293
+                }
294
+                if (content != null)
295
+                {
296
+                    content.Dispose();
297
+                }
298
+            }
299
+
300
+            return sample;
301
+        }
302
+
303
+        [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Handling the failure by returning the original string.")]
304
+        private static string TryFormatJson(string str)
305
+        {
306
+            try
307
+            {
308
+                object parsedJson = JsonConvert.DeserializeObject(str);
309
+                return JsonConvert.SerializeObject(parsedJson, Formatting.Indented);
310
+            }
311
+            catch
312
+            {
313
+                // can't parse JSON, return the original string
314
+                return str;
315
+            }
316
+        }
317
+
318
+        [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Handling the failure by returning the original string.")]
319
+        private static string TryFormatXml(string str)
320
+        {
321
+            try
322
+            {
323
+                XDocument xml = XDocument.Parse(str);
324
+                return xml.ToString();
325
+            }
326
+            catch
327
+            {
328
+                // can't parse XML, return the original string
329
+                return str;
330
+            }
331
+        }
332
+
333
+        private static bool IsFormatSupported(SampleDirection sampleDirection, MediaTypeFormatter formatter, Type type)
334
+        {
335
+            switch (sampleDirection)
336
+            {
337
+                case SampleDirection.Request:
338
+                    return formatter.CanReadType(type);
339
+                case SampleDirection.Response:
340
+                    return formatter.CanWriteType(type);
341
+            }
342
+            return false;
343
+        }
344
+
345
+        private IEnumerable<KeyValuePair<HelpPageSampleKey, object>> GetAllActionSamples(string controllerName, string actionName, IEnumerable<string> parameterNames, SampleDirection sampleDirection)
346
+        {
347
+            HashSet<string> parameterNamesSet = new HashSet<string>(parameterNames, StringComparer.OrdinalIgnoreCase);
348
+            foreach (var sample in ActionSamples)
349
+            {
350
+                HelpPageSampleKey sampleKey = sample.Key;
351
+                if (String.Equals(controllerName, sampleKey.ControllerName, StringComparison.OrdinalIgnoreCase) &&
352
+                    String.Equals(actionName, sampleKey.ActionName, StringComparison.OrdinalIgnoreCase) &&
353
+                    (sampleKey.ParameterNames.SetEquals(new[] { "*" }) || parameterNamesSet.SetEquals(sampleKey.ParameterNames)) &&
354
+                    sampleDirection == sampleKey.SampleDirection)
355
+                {
356
+                    yield return sample;
357
+                }
358
+            }
359
+        }
360
+
361
+        private static object WrapSampleIfString(object sample)
362
+        {
363
+            string stringSample = sample as string;
364
+            if (stringSample != null)
365
+            {
366
+                return new TextSample(stringSample);
367
+            }
368
+
369
+            return sample;
370
+        }
371
+    }
372
+}

+ 178
- 0
Authentication-test/Areas/HelpPage/SampleGeneration/HelpPageSampleKey.cs 查看文件

@@ -0,0 +1,178 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.ComponentModel;
4
+using System.Net.Http.Headers;
5
+
6
+namespace Authentication_test.Areas.HelpPage
7
+{
8
+    /// <summary>
9
+    /// This is used to identify the place where the sample should be applied.
10
+    /// </summary>
11
+    public class HelpPageSampleKey
12
+    {
13
+        /// <summary>
14
+        /// Creates a new <see cref="HelpPageSampleKey"/> based on media type and CLR type.
15
+        /// </summary>
16
+        /// <param name="mediaType">The media type.</param>
17
+        /// <param name="type">The CLR type.</param>
18
+        public HelpPageSampleKey(MediaTypeHeaderValue mediaType, Type type)
19
+        {
20
+            if (mediaType == null)
21
+            {
22
+                throw new ArgumentNullException("mediaType");
23
+            }
24
+            if (type == null)
25
+            {
26
+                throw new ArgumentNullException("type");
27
+            }
28
+            ControllerName = String.Empty;
29
+            ActionName = String.Empty;
30
+            ParameterNames = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
31
+            ParameterType = type;
32
+            MediaType = mediaType;
33
+        }
34
+
35
+        /// <summary>
36
+        /// Creates a new <see cref="HelpPageSampleKey"/> based on <see cref="SampleDirection"/>, controller name, action name and parameter names.
37
+        /// </summary>
38
+        /// <param name="sampleDirection">The <see cref="SampleDirection"/>.</param>
39
+        /// <param name="controllerName">Name of the controller.</param>
40
+        /// <param name="actionName">Name of the action.</param>
41
+        /// <param name="parameterNames">The parameter names.</param>
42
+        public HelpPageSampleKey(SampleDirection sampleDirection, string controllerName, string actionName, IEnumerable<string> parameterNames)
43
+        {
44
+            if (!Enum.IsDefined(typeof(SampleDirection), sampleDirection))
45
+            {
46
+                throw new InvalidEnumArgumentException("sampleDirection", (int)sampleDirection, typeof(SampleDirection));
47
+            }
48
+            if (controllerName == null)
49
+            {
50
+                throw new ArgumentNullException("controllerName");
51
+            }
52
+            if (actionName == null)
53
+            {
54
+                throw new ArgumentNullException("actionName");
55
+            }
56
+            if (parameterNames == null)
57
+            {
58
+                throw new ArgumentNullException("parameterNames");
59
+            }
60
+            ControllerName = controllerName;
61
+            ActionName = actionName;
62
+            ParameterNames = new HashSet<string>(parameterNames, StringComparer.OrdinalIgnoreCase);
63
+            SampleDirection = sampleDirection;
64
+        }
65
+
66
+        /// <summary>
67
+        /// Creates a new <see cref="HelpPageSampleKey"/> based on media type, <see cref="SampleDirection"/>, controller name, action name and parameter names.
68
+        /// </summary>
69
+        /// <param name="mediaType">The media type.</param>
70
+        /// <param name="sampleDirection">The <see cref="SampleDirection"/>.</param>
71
+        /// <param name="controllerName">Name of the controller.</param>
72
+        /// <param name="actionName">Name of the action.</param>
73
+        /// <param name="parameterNames">The parameter names.</param>
74
+        public HelpPageSampleKey(MediaTypeHeaderValue mediaType, SampleDirection sampleDirection, string controllerName, string actionName, IEnumerable<string> parameterNames)
75
+        {
76
+            if (mediaType == null)
77
+            {
78
+                throw new ArgumentNullException("mediaType");
79
+            }
80
+            if (!Enum.IsDefined(typeof(SampleDirection), sampleDirection))
81
+            {
82
+                throw new InvalidEnumArgumentException("sampleDirection", (int)sampleDirection, typeof(SampleDirection));
83
+            }
84
+            if (controllerName == null)
85
+            {
86
+                throw new ArgumentNullException("controllerName");
87
+            }
88
+            if (actionName == null)
89
+            {
90
+                throw new ArgumentNullException("actionName");
91
+            }
92
+            if (parameterNames == null)
93
+            {
94
+                throw new ArgumentNullException("parameterNames");
95
+            }
96
+            ControllerName = controllerName;
97
+            ActionName = actionName;
98
+            MediaType = mediaType;
99
+            ParameterNames = new HashSet<string>(parameterNames, StringComparer.OrdinalIgnoreCase);
100
+            SampleDirection = sampleDirection;
101
+        }
102
+
103
+        /// <summary>
104
+        /// Gets the name of the controller.
105
+        /// </summary>
106
+        /// <value>
107
+        /// The name of the controller.
108
+        /// </value>
109
+        public string ControllerName { get; private set; }
110
+
111
+        /// <summary>
112
+        /// Gets the name of the action.
113
+        /// </summary>
114
+        /// <value>
115
+        /// The name of the action.
116
+        /// </value>
117
+        public string ActionName { get; private set; }
118
+
119
+        /// <summary>
120
+        /// Gets the media type.
121
+        /// </summary>
122
+        /// <value>
123
+        /// The media type.
124
+        /// </value>
125
+        public MediaTypeHeaderValue MediaType { get; private set; }
126
+
127
+        /// <summary>
128
+        /// Gets the parameter names.
129
+        /// </summary>
130
+        public HashSet<string> ParameterNames { get; private set; }
131
+
132
+        public Type ParameterType { get; private set; }
133
+
134
+        /// <summary>
135
+        /// Gets the <see cref="SampleDirection"/>.
136
+        /// </summary>
137
+        public SampleDirection? SampleDirection { get; private set; }
138
+
139
+        public override bool Equals(object obj)
140
+        {
141
+            HelpPageSampleKey otherKey = obj as HelpPageSampleKey;
142
+            if (otherKey == null)
143
+            {
144
+                return false;
145
+            }
146
+
147
+            return String.Equals(ControllerName, otherKey.ControllerName, StringComparison.OrdinalIgnoreCase) &&
148
+                String.Equals(ActionName, otherKey.ActionName, StringComparison.OrdinalIgnoreCase) &&
149
+                (MediaType == otherKey.MediaType || (MediaType != null && MediaType.Equals(otherKey.MediaType))) &&
150
+                ParameterType == otherKey.ParameterType &&
151
+                SampleDirection == otherKey.SampleDirection &&
152
+                ParameterNames.SetEquals(otherKey.ParameterNames);
153
+        }
154
+
155
+        public override int GetHashCode()
156
+        {
157
+            int hashCode = ControllerName.ToUpperInvariant().GetHashCode() ^ ActionName.ToUpperInvariant().GetHashCode();
158
+            if (MediaType != null)
159
+            {
160
+                hashCode ^= MediaType.GetHashCode();
161
+            }
162
+            if (SampleDirection != null)
163
+            {
164
+                hashCode ^= SampleDirection.GetHashCode();
165
+            }
166
+            if (ParameterType != null)
167
+            {
168
+                hashCode ^= ParameterType.GetHashCode();
169
+            }
170
+            foreach (string parameterName in ParameterNames)
171
+            {
172
+                hashCode ^= parameterName.ToUpperInvariant().GetHashCode();
173
+            }
174
+
175
+            return hashCode;
176
+        }
177
+    }
178
+}

+ 41
- 0
Authentication-test/Areas/HelpPage/SampleGeneration/ImageSample.cs 查看文件

@@ -0,0 +1,41 @@
1
+using System;
2
+
3
+namespace Authentication_test.Areas.HelpPage
4
+{
5
+    /// <summary>
6
+    /// This represents an image sample on the help page. There's a display template named ImageSample associated with this class.
7
+    /// </summary>
8
+    public class ImageSample
9
+    {
10
+        /// <summary>
11
+        /// Initializes a new instance of the <see cref="ImageSample"/> class.
12
+        /// </summary>
13
+        /// <param name="src">The URL of an image.</param>
14
+        public ImageSample(string src)
15
+        {
16
+            if (src == null)
17
+            {
18
+                throw new ArgumentNullException("src");
19
+            }
20
+            Src = src;
21
+        }
22
+
23
+        public string Src { get; private set; }
24
+
25
+        public override bool Equals(object obj)
26
+        {
27
+            ImageSample other = obj as ImageSample;
28
+            return other != null && Src == other.Src;
29
+        }
30
+
31
+        public override int GetHashCode()
32
+        {
33
+            return Src.GetHashCode();
34
+        }
35
+
36
+        public override string ToString()
37
+        {
38
+            return Src;
39
+        }
40
+    }
41
+}

+ 37
- 0
Authentication-test/Areas/HelpPage/SampleGeneration/InvalidSample.cs 查看文件

@@ -0,0 +1,37 @@
1
+using System;
2
+
3
+namespace Authentication_test.Areas.HelpPage
4
+{
5
+    /// <summary>
6
+    /// This represents an invalid sample on the help page. There's a display template named InvalidSample associated with this class.
7
+    /// </summary>
8
+    public class InvalidSample
9
+    {
10
+        public InvalidSample(string errorMessage)
11
+        {
12
+            if (errorMessage == null)
13
+            {
14
+                throw new ArgumentNullException("errorMessage");
15
+            }
16
+            ErrorMessage = errorMessage;
17
+        }
18
+
19
+        public string ErrorMessage { get; private set; }
20
+
21
+        public override bool Equals(object obj)
22
+        {
23
+            InvalidSample other = obj as InvalidSample;
24
+            return other != null && ErrorMessage == other.ErrorMessage;
25
+        }
26
+
27
+        public override int GetHashCode()
28
+        {
29
+            return ErrorMessage.GetHashCode();
30
+        }
31
+
32
+        public override string ToString()
33
+        {
34
+            return ErrorMessage;
35
+        }
36
+    }
37
+}

+ 456
- 0
Authentication-test/Areas/HelpPage/SampleGeneration/ObjectGenerator.cs 查看文件

@@ -0,0 +1,456 @@
1
+using System;
2
+using System.Collections;
3
+using System.Collections.Generic;
4
+using System.Diagnostics.CodeAnalysis;
5
+using System.Globalization;
6
+using System.Linq;
7
+using System.Reflection;
8
+
9
+namespace Authentication_test.Areas.HelpPage
10
+{
11
+    /// <summary>
12
+    /// This class will create an object of a given type and populate it with sample data.
13
+    /// </summary>
14
+    public class ObjectGenerator
15
+    {
16
+        private const int DefaultCollectionSize = 3;
17
+        private readonly SimpleTypeObjectGenerator SimpleObjectGenerator = new SimpleTypeObjectGenerator();
18
+
19
+        /// <summary>
20
+        /// Generates an object for a given type. The type needs to be public, have a public default constructor and settable public properties/fields. Currently it supports the following types:
21
+        /// Simple types: <see cref="int"/>, <see cref="string"/>, <see cref="Enum"/>, <see cref="DateTime"/>, <see cref="Uri"/>, etc.
22
+        /// Complex types: POCO types.
23
+        /// Nullables: <see cref="Nullable{T}"/>.
24
+        /// Arrays: arrays of simple types or complex types.
25
+        /// Key value pairs: <see cref="KeyValuePair{TKey,TValue}"/>
26
+        /// Tuples: <see cref="Tuple{T1}"/>, <see cref="Tuple{T1,T2}"/>, etc
27
+        /// Dictionaries: <see cref="IDictionary{TKey,TValue}"/> or anything deriving from <see cref="IDictionary{TKey,TValue}"/>.
28
+        /// Collections: <see cref="IList{T}"/>, <see cref="IEnumerable{T}"/>, <see cref="ICollection{T}"/>, <see cref="IList"/>, <see cref="IEnumerable"/>, <see cref="ICollection"/> or anything deriving from <see cref="ICollection{T}"/> or <see cref="IList"/>.
29
+        /// Queryables: <see cref="IQueryable"/>, <see cref="IQueryable{T}"/>.
30
+        /// </summary>
31
+        /// <param name="type">The type.</param>
32
+        /// <returns>An object of the given type.</returns>
33
+        public object GenerateObject(Type type)
34
+        {
35
+            return GenerateObject(type, new Dictionary<Type, object>());
36
+        }
37
+
38
+        [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Here we just want to return null if anything goes wrong.")]
39
+        private object GenerateObject(Type type, Dictionary<Type, object> createdObjectReferences)
40
+        {
41
+            try
42
+            {
43
+                if (SimpleTypeObjectGenerator.CanGenerateObject(type))
44
+                {
45
+                    return SimpleObjectGenerator.GenerateObject(type);
46
+                }
47
+
48
+                if (type.IsArray)
49
+                {
50
+                    return GenerateArray(type, DefaultCollectionSize, createdObjectReferences);
51
+                }
52
+
53
+                if (type.IsGenericType)
54
+                {
55
+                    return GenerateGenericType(type, DefaultCollectionSize, createdObjectReferences);
56
+                }
57
+
58
+                if (type == typeof(IDictionary))
59
+                {
60
+                    return GenerateDictionary(typeof(Hashtable), DefaultCollectionSize, createdObjectReferences);
61
+                }
62
+
63
+                if (typeof(IDictionary).IsAssignableFrom(type))
64
+                {
65
+                    return GenerateDictionary(type, DefaultCollectionSize, createdObjectReferences);
66
+                }
67
+
68
+                if (type == typeof(IList) ||
69
+                    type == typeof(IEnumerable) ||
70
+                    type == typeof(ICollection))
71
+                {
72
+                    return GenerateCollection(typeof(ArrayList), DefaultCollectionSize, createdObjectReferences);
73
+                }
74
+
75
+                if (typeof(IList).IsAssignableFrom(type))
76
+                {
77
+                    return GenerateCollection(type, DefaultCollectionSize, createdObjectReferences);
78
+                }
79
+
80
+                if (type == typeof(IQueryable))
81
+                {
82
+                    return GenerateQueryable(type, DefaultCollectionSize, createdObjectReferences);
83
+                }
84
+
85
+                if (type.IsEnum)
86
+                {
87
+                    return GenerateEnum(type);
88
+                }
89
+
90
+                if (type.IsPublic || type.IsNestedPublic)
91
+                {
92
+                    return GenerateComplexObject(type, createdObjectReferences);
93
+                }
94
+            }
95
+            catch
96
+            {
97
+                // Returns null if anything fails
98
+                return null;
99
+            }
100
+
101
+            return null;
102
+        }
103
+
104
+        private static object GenerateGenericType(Type type, int collectionSize, Dictionary<Type, object> createdObjectReferences)
105
+        {
106
+            Type genericTypeDefinition = type.GetGenericTypeDefinition();
107
+            if (genericTypeDefinition == typeof(Nullable<>))
108
+            {
109
+                return GenerateNullable(type, createdObjectReferences);
110
+            }
111
+
112
+            if (genericTypeDefinition == typeof(KeyValuePair<,>))
113
+            {
114
+                return GenerateKeyValuePair(type, createdObjectReferences);
115
+            }
116
+
117
+            if (IsTuple(genericTypeDefinition))
118
+            {
119
+                return GenerateTuple(type, createdObjectReferences);
120
+            }
121
+
122
+            Type[] genericArguments = type.GetGenericArguments();
123
+            if (genericArguments.Length == 1)
124
+            {
125
+                if (genericTypeDefinition == typeof(IList<>) ||
126
+                    genericTypeDefinition == typeof(IEnumerable<>) ||
127
+                    genericTypeDefinition == typeof(ICollection<>))
128
+                {
129
+                    Type collectionType = typeof(List<>).MakeGenericType(genericArguments);
130
+                    return GenerateCollection(collectionType, collectionSize, createdObjectReferences);
131
+                }
132
+
133
+                if (genericTypeDefinition == typeof(IQueryable<>))
134
+                {
135
+                    return GenerateQueryable(type, collectionSize, createdObjectReferences);
136
+                }
137
+
138
+                Type closedCollectionType = typeof(ICollection<>).MakeGenericType(genericArguments[0]);
139
+                if (closedCollectionType.IsAssignableFrom(type))
140
+                {
141
+                    return GenerateCollection(type, collectionSize, createdObjectReferences);
142
+                }
143
+            }
144
+
145
+            if (genericArguments.Length == 2)
146
+            {
147
+                if (genericTypeDefinition == typeof(IDictionary<,>))
148
+                {
149
+                    Type dictionaryType = typeof(Dictionary<,>).MakeGenericType(genericArguments);
150
+                    return GenerateDictionary(dictionaryType, collectionSize, createdObjectReferences);
151
+                }
152
+
153
+                Type closedDictionaryType = typeof(IDictionary<,>).MakeGenericType(genericArguments[0], genericArguments[1]);
154
+                if (closedDictionaryType.IsAssignableFrom(type))
155
+                {
156
+                    return GenerateDictionary(type, collectionSize, createdObjectReferences);
157
+                }
158
+            }
159
+
160
+            if (type.IsPublic || type.IsNestedPublic)
161
+            {
162
+                return GenerateComplexObject(type, createdObjectReferences);
163
+            }
164
+
165
+            return null;
166
+        }
167
+
168
+        private static object GenerateTuple(Type type, Dictionary<Type, object> createdObjectReferences)
169
+        {
170
+            Type[] genericArgs = type.GetGenericArguments();
171
+            object[] parameterValues = new object[genericArgs.Length];
172
+            bool failedToCreateTuple = true;
173
+            ObjectGenerator objectGenerator = new ObjectGenerator();
174
+            for (int i = 0; i < genericArgs.Length; i++)
175
+            {
176
+                parameterValues[i] = objectGenerator.GenerateObject(genericArgs[i], createdObjectReferences);
177
+                failedToCreateTuple &= parameterValues[i] == null;
178
+            }
179
+            if (failedToCreateTuple)
180
+            {
181
+                return null;
182
+            }
183
+            object result = Activator.CreateInstance(type, parameterValues);
184
+            return result;
185
+        }
186
+
187
+        private static bool IsTuple(Type genericTypeDefinition)
188
+        {
189
+            return genericTypeDefinition == typeof(Tuple<>) ||
190
+                genericTypeDefinition == typeof(Tuple<,>) ||
191
+                genericTypeDefinition == typeof(Tuple<,,>) ||
192
+                genericTypeDefinition == typeof(Tuple<,,,>) ||
193
+                genericTypeDefinition == typeof(Tuple<,,,,>) ||
194
+                genericTypeDefinition == typeof(Tuple<,,,,,>) ||
195
+                genericTypeDefinition == typeof(Tuple<,,,,,,>) ||
196
+                genericTypeDefinition == typeof(Tuple<,,,,,,,>);
197
+        }
198
+
199
+        private static object GenerateKeyValuePair(Type keyValuePairType, Dictionary<Type, object> createdObjectReferences)
200
+        {
201
+            Type[] genericArgs = keyValuePairType.GetGenericArguments();
202
+            Type typeK = genericArgs[0];
203
+            Type typeV = genericArgs[1];
204
+            ObjectGenerator objectGenerator = new ObjectGenerator();
205
+            object keyObject = objectGenerator.GenerateObject(typeK, createdObjectReferences);
206
+            object valueObject = objectGenerator.GenerateObject(typeV, createdObjectReferences);
207
+            if (keyObject == null && valueObject == null)
208
+            {
209
+                // Failed to create key and values
210
+                return null;
211
+            }
212
+            object result = Activator.CreateInstance(keyValuePairType, keyObject, valueObject);
213
+            return result;
214
+        }
215
+
216
+        private static object GenerateArray(Type arrayType, int size, Dictionary<Type, object> createdObjectReferences)
217
+        {
218
+            Type type = arrayType.GetElementType();
219
+            Array result = Array.CreateInstance(type, size);
220
+            bool areAllElementsNull = true;
221
+            ObjectGenerator objectGenerator = new ObjectGenerator();
222
+            for (int i = 0; i < size; i++)
223
+            {
224
+                object element = objectGenerator.GenerateObject(type, createdObjectReferences);
225
+                result.SetValue(element, i);
226
+                areAllElementsNull &= element == null;
227
+            }
228
+
229
+            if (areAllElementsNull)
230
+            {
231
+                return null;
232
+            }
233
+
234
+            return result;
235
+        }
236
+
237
+        private static object GenerateDictionary(Type dictionaryType, int size, Dictionary<Type, object> createdObjectReferences)
238
+        {
239
+            Type typeK = typeof(object);
240
+            Type typeV = typeof(object);
241
+            if (dictionaryType.IsGenericType)
242
+            {
243
+                Type[] genericArgs = dictionaryType.GetGenericArguments();
244
+                typeK = genericArgs[0];
245
+                typeV = genericArgs[1];
246
+            }
247
+
248
+            object result = Activator.CreateInstance(dictionaryType);
249
+            MethodInfo addMethod = dictionaryType.GetMethod("Add") ?? dictionaryType.GetMethod("TryAdd");
250
+            MethodInfo containsMethod = dictionaryType.GetMethod("Contains") ?? dictionaryType.GetMethod("ContainsKey");
251
+            ObjectGenerator objectGenerator = new ObjectGenerator();
252
+            for (int i = 0; i < size; i++)
253
+            {
254
+                object newKey = objectGenerator.GenerateObject(typeK, createdObjectReferences);
255
+                if (newKey == null)
256
+                {
257
+                    // Cannot generate a valid key
258
+                    return null;
259
+                }
260
+
261
+                bool containsKey = (bool)containsMethod.Invoke(result, new object[] { newKey });
262
+                if (!containsKey)
263
+                {
264
+                    object newValue = objectGenerator.GenerateObject(typeV, createdObjectReferences);
265
+                    addMethod.Invoke(result, new object[] { newKey, newValue });
266
+                }
267
+            }
268
+
269
+            return result;
270
+        }
271
+
272
+        private static object GenerateEnum(Type enumType)
273
+        {
274
+            Array possibleValues = Enum.GetValues(enumType);
275
+            if (possibleValues.Length > 0)
276
+            {
277
+                return possibleValues.GetValue(0);
278
+            }
279
+            return null;
280
+        }
281
+
282
+        private static object GenerateQueryable(Type queryableType, int size, Dictionary<Type, object> createdObjectReferences)
283
+        {
284
+            bool isGeneric = queryableType.IsGenericType;
285
+            object list;
286
+            if (isGeneric)
287
+            {
288
+                Type listType = typeof(List<>).MakeGenericType(queryableType.GetGenericArguments());
289
+                list = GenerateCollection(listType, size, createdObjectReferences);
290
+            }
291
+            else
292
+            {
293
+                list = GenerateArray(typeof(object[]), size, createdObjectReferences);
294
+            }
295
+            if (list == null)
296
+            {
297
+                return null;
298
+            }
299
+            if (isGeneric)
300
+            {
301
+                Type argumentType = typeof(IEnumerable<>).MakeGenericType(queryableType.GetGenericArguments());
302
+                MethodInfo asQueryableMethod = typeof(Queryable).GetMethod("AsQueryable", new[] { argumentType });
303
+                return asQueryableMethod.Invoke(null, new[] { list });
304
+            }
305
+
306
+            return Queryable.AsQueryable((IEnumerable)list);
307
+        }
308
+
309
+        private static object GenerateCollection(Type collectionType, int size, Dictionary<Type, object> createdObjectReferences)
310
+        {
311
+            Type type = collectionType.IsGenericType ?
312
+                collectionType.GetGenericArguments()[0] :
313
+                typeof(object);
314
+            object result = Activator.CreateInstance(collectionType);
315
+            MethodInfo addMethod = collectionType.GetMethod("Add");
316
+            bool areAllElementsNull = true;
317
+            ObjectGenerator objectGenerator = new ObjectGenerator();
318
+            for (int i = 0; i < size; i++)
319
+            {
320
+                object element = objectGenerator.GenerateObject(type, createdObjectReferences);
321
+                addMethod.Invoke(result, new object[] { element });
322
+                areAllElementsNull &= element == null;
323
+            }
324
+
325
+            if (areAllElementsNull)
326
+            {
327
+                return null;
328
+            }
329
+
330
+            return result;
331
+        }
332
+
333
+        private static object GenerateNullable(Type nullableType, Dictionary<Type, object> createdObjectReferences)
334
+        {
335
+            Type type = nullableType.GetGenericArguments()[0];
336
+            ObjectGenerator objectGenerator = new ObjectGenerator();
337
+            return objectGenerator.GenerateObject(type, createdObjectReferences);
338
+        }
339
+
340
+        private static object GenerateComplexObject(Type type, Dictionary<Type, object> createdObjectReferences)
341
+        {
342
+            object result = null;
343
+
344
+            if (createdObjectReferences.TryGetValue(type, out result))
345
+            {
346
+                // The object has been created already, just return it. This will handle the circular reference case.
347
+                return result;
348
+            }
349
+
350
+            if (type.IsValueType)
351
+            {
352
+                result = Activator.CreateInstance(type);
353
+            }
354
+            else
355
+            {
356
+                ConstructorInfo defaultCtor = type.GetConstructor(Type.EmptyTypes);
357
+                if (defaultCtor == null)
358
+                {
359
+                    // Cannot instantiate the type because it doesn't have a default constructor
360
+                    return null;
361
+                }
362
+
363
+                result = defaultCtor.Invoke(new object[0]);
364
+            }
365
+            createdObjectReferences.Add(type, result);
366
+            SetPublicProperties(type, result, createdObjectReferences);
367
+            SetPublicFields(type, result, createdObjectReferences);
368
+            return result;
369
+        }
370
+
371
+        private static void SetPublicProperties(Type type, object obj, Dictionary<Type, object> createdObjectReferences)
372
+        {
373
+            PropertyInfo[] properties = type.GetProperties(BindingFlags.Public | BindingFlags.Instance);
374
+            ObjectGenerator objectGenerator = new ObjectGenerator();
375
+            foreach (PropertyInfo property in properties)
376
+            {
377
+                if (property.CanWrite)
378
+                {
379
+                    object propertyValue = objectGenerator.GenerateObject(property.PropertyType, createdObjectReferences);
380
+                    property.SetValue(obj, propertyValue, null);
381
+                }
382
+            }
383
+        }
384
+
385
+        private static void SetPublicFields(Type type, object obj, Dictionary<Type, object> createdObjectReferences)
386
+        {
387
+            FieldInfo[] fields = type.GetFields(BindingFlags.Public | BindingFlags.Instance);
388
+            ObjectGenerator objectGenerator = new ObjectGenerator();
389
+            foreach (FieldInfo field in fields)
390
+            {
391
+                object fieldValue = objectGenerator.GenerateObject(field.FieldType, createdObjectReferences);
392
+                field.SetValue(obj, fieldValue);
393
+            }
394
+        }
395
+
396
+        private class SimpleTypeObjectGenerator
397
+        {
398
+            private long _index = 0;
399
+            private static readonly Dictionary<Type, Func<long, object>> DefaultGenerators = InitializeGenerators();
400
+
401
+            [SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity", Justification = "These are simple type factories and cannot be split up.")]
402
+            private static Dictionary<Type, Func<long, object>> InitializeGenerators()
403
+            {
404
+                return new Dictionary<Type, Func<long, object>>
405
+                {
406
+                    { typeof(Boolean), index => true },
407
+                    { typeof(Byte), index => (Byte)64 },
408
+                    { typeof(Char), index => (Char)65 },
409
+                    { typeof(DateTime), index => DateTime.Now },
410
+                    { typeof(DateTimeOffset), index => new DateTimeOffset(DateTime.Now) },
411
+                    { typeof(DBNull), index => DBNull.Value },
412
+                    { typeof(Decimal), index => (Decimal)index },
413
+                    { typeof(Double), index => (Double)(index + 0.1) },
414
+                    { typeof(Guid), index => Guid.NewGuid() },
415
+                    { typeof(Int16), index => (Int16)(index % Int16.MaxValue) },
416
+                    { typeof(Int32), index => (Int32)(index % Int32.MaxValue) },
417
+                    { typeof(Int64), index => (Int64)index },
418
+                    { typeof(Object), index => new object() },
419
+                    { typeof(SByte), index => (SByte)64 },
420
+                    { typeof(Single), index => (Single)(index + 0.1) },
421
+                    { 
422
+                        typeof(String), index =>
423
+                        {
424
+                            return String.Format(CultureInfo.CurrentCulture, "sample string {0}", index);
425
+                        }
426
+                    },
427
+                    { 
428
+                        typeof(TimeSpan), index =>
429
+                        {
430
+                            return TimeSpan.FromTicks(1234567);
431
+                        }
432
+                    },
433
+                    { typeof(UInt16), index => (UInt16)(index % UInt16.MaxValue) },
434
+                    { typeof(UInt32), index => (UInt32)(index % UInt32.MaxValue) },
435
+                    { typeof(UInt64), index => (UInt64)index },
436
+                    { 
437
+                        typeof(Uri), index =>
438
+                        {
439
+                            return new Uri(String.Format(CultureInfo.CurrentCulture, "http://webapihelppage{0}.com", index));
440
+                        }
441
+                    },
442
+                };
443
+            }
444
+
445
+            public static bool CanGenerateObject(Type type)
446
+            {
447
+                return DefaultGenerators.ContainsKey(type);
448
+            }
449
+
450
+            public object GenerateObject(Type type)
451
+            {
452
+                return DefaultGenerators[type](++_index);
453
+            }
454
+        }
455
+    }
456
+}

+ 11
- 0
Authentication-test/Areas/HelpPage/SampleGeneration/SampleDirection.cs 查看文件

@@ -0,0 +1,11 @@
1
+namespace Authentication_test.Areas.HelpPage
2
+{
3
+    /// <summary>
4
+    /// Indicates whether the sample is used for request or response
5
+    /// </summary>
6
+    public enum SampleDirection
7
+    {
8
+        Request = 0,
9
+        Response
10
+    }
11
+}

+ 37
- 0
Authentication-test/Areas/HelpPage/SampleGeneration/TextSample.cs 查看文件

@@ -0,0 +1,37 @@
1
+using System;
2
+
3
+namespace Authentication_test.Areas.HelpPage
4
+{
5
+    /// <summary>
6
+    /// This represents a preformatted text sample on the help page. There's a display template named TextSample associated with this class.
7
+    /// </summary>
8
+    public class TextSample
9
+    {
10
+        public TextSample(string text)
11
+        {
12
+            if (text == null)
13
+            {
14
+                throw new ArgumentNullException("text");
15
+            }
16
+            Text = text;
17
+        }
18
+
19
+        public string Text { get; private set; }
20
+
21
+        public override bool Equals(object obj)
22
+        {
23
+            TextSample other = obj as TextSample;
24
+            return other != null && Text == other.Text;
25
+        }
26
+
27
+        public override int GetHashCode()
28
+        {
29
+            return Text.GetHashCode();
30
+        }
31
+
32
+        public override string ToString()
33
+        {
34
+            return Text;
35
+        }
36
+    }
37
+}

+ 25
- 0
Authentication-test/Areas/HelpPage/Views/Help/Api.cshtml 查看文件

@@ -0,0 +1,25 @@
1
+@using System.Web.Http
2
+@using Authentication_test.Areas.HelpPage.Models
3
+@model HelpPageApiModel
4
+
5
+@{
6
+    var description = Model.ApiDescription;
7
+    ViewBag.Title = description.HttpMethod.Method + " " + description.RelativePath;
8
+}
9
+
10
+<div id="body">
11
+    <section class="featured">
12
+        <div class="content-wrapper">
13
+            <p>
14
+                @Html.ActionLink("Help Page Home", "Index")
15
+            </p>
16
+        </div>
17
+    </section>
18
+    <section class="content-wrapper main-content clear-fix">
19
+        @Html.DisplayFor(m => Model)
20
+    </section>
21
+</div>
22
+
23
+@section Scripts {
24
+    <link type="text/css" href="~/Areas/HelpPage/HelpPage.css" rel="stylesheet" />
25
+}

+ 41
- 0
Authentication-test/Areas/HelpPage/Views/Help/DisplayTemplates/ApiGroup.cshtml 查看文件

@@ -0,0 +1,41 @@
1
+@using System.Web.Http
2
+@using System.Web.Http.Controllers
3
+@using System.Web.Http.Description
4
+@using Authentication_test.Areas.HelpPage
5
+@using Authentication_test.Areas.HelpPage.Models
6
+@model IGrouping<HttpControllerDescriptor, ApiDescription>
7
+
8
+@{
9
+    var controllerDocumentation = ViewBag.DocumentationProvider != null ? 
10
+        ViewBag.DocumentationProvider.GetDocumentation(Model.Key) : 
11
+        null;
12
+}
13
+
14
+<h2 id="@Model.Key">@Model.Key.ControllerName</h2>
15
+@if (!String.IsNullOrEmpty(controllerDocumentation))
16
+{
17
+    <p>@controllerDocumentation</p>
18
+}
19
+<table class="help-page-table">
20
+    <thead>
21
+        <tr><th>API</th><th>Description</th></tr>
22
+    </thead>
23
+    <tbody>
24
+    @foreach (var api in Model)
25
+    {
26
+        <tr>
27
+            <td class="api-name"><a href="@Url.Action("Api", "Help", new { apiId = api.GetFriendlyId() })">@api.HttpMethod.Method @api.RelativePath</a></td>
28
+            <td class="api-documentation">
29
+            @if (api.Documentation != null)
30
+            {
31
+                <p>@api.Documentation</p>
32
+            }
33
+            else
34
+            {
35
+                <p>No documentation available.</p>
36
+            }
37
+            </td>
38
+        </tr>
39
+    }
40
+    </tbody>
41
+</table>

+ 51
- 0
Authentication-test/Areas/HelpPage/Views/Help/DisplayTemplates/HelpPageApiModel.cshtml 查看文件

@@ -0,0 +1,51 @@
1
+@using System.Web.Http
2
+@using Authentication_test.Areas.HelpPage.Models
3
+@model HelpPageApiModel
4
+
5
+@{ 
6
+    var description = Model.ApiDescription;
7
+    bool hasParameters = description.ParameterDescriptions.Count > 0;
8
+    bool hasRequestSamples = Model.SampleRequests.Count > 0;
9
+    bool hasResponseSamples = Model.SampleResponses.Count > 0;
10
+}
11
+<h1>@description.HttpMethod.Method @description.RelativePath</h1>
12
+<div>
13
+    @if (description.Documentation != null)
14
+    {
15
+        <p>@description.Documentation</p>
16
+    }
17
+    else
18
+    {
19
+        <p>No documentation available.</p>
20
+    }
21
+
22
+    @if (hasParameters || hasRequestSamples)
23
+    {
24
+        <h2>Request Information</h2>
25
+        if (hasParameters)
26
+        {
27
+            <h3>Parameters</h3>
28
+            @Html.DisplayFor(apiModel => apiModel.ApiDescription.ParameterDescriptions, "Parameters")
29
+        }
30
+        if (hasRequestSamples)
31
+        {
32
+            <h3>Request body formats</h3>
33
+            @Html.DisplayFor(apiModel => apiModel.SampleRequests, "Samples")
34
+        }
35
+    } 
36
+
37
+    @if (hasResponseSamples)
38
+    {
39
+        <h2>Response Information</h2>
40
+        if (description.ResponseDescription.Documentation != null)
41
+        {
42
+            <p>@description.ResponseDescription.Documentation</p>
43
+        }
44
+        else
45
+        {
46
+            <p>No documentation available.</p>
47
+        }
48
+        <h3>Response body formats</h3>
49
+        @Html.DisplayFor(apiModel => apiModel.SampleResponses, "Samples")
50
+    }
51
+</div>

+ 4
- 0
Authentication-test/Areas/HelpPage/Views/Help/DisplayTemplates/ImageSample.cshtml 查看文件

@@ -0,0 +1,4 @@
1
+@using Authentication_test.Areas.HelpPage
2
+@model ImageSample
3
+
4
+<img src="@Model.Src" />

+ 13
- 0
Authentication-test/Areas/HelpPage/Views/Help/DisplayTemplates/InvalidSample.cshtml 查看文件

@@ -0,0 +1,13 @@
1
+@using Authentication_test.Areas.HelpPage
2
+@model InvalidSample
3
+
4
+@if (HttpContext.Current.IsDebuggingEnabled)
5
+{
6
+    <div class="warning-message-container">
7
+        <p>@Model.ErrorMessage</p>
8
+    </div>
9
+}
10
+else
11
+{
12
+    <p>Sample not available.</p>
13
+}

+ 44
- 0
Authentication-test/Areas/HelpPage/Views/Help/DisplayTemplates/Parameters.cshtml 查看文件

@@ -0,0 +1,44 @@
1
+@using System.Collections.ObjectModel
2
+@using System.Web.Http.Description
3
+@using System.Threading
4
+@model Collection<ApiParameterDescription>
5
+
6
+<table class="help-page-table">
7
+    <thead>
8
+    <tr><th>Name</th><th>Description</th><th>Additional information</th></tr>
9
+    </thead>
10
+    <tbody>
11
+    @foreach (ApiParameterDescription parameter in Model)
12
+    {
13
+        string parameterDocumentation = parameter.Documentation != null ?
14
+            parameter.Documentation :
15
+            "No documentation available.";
16
+
17
+        // Don't show CancellationToken because it's a special parameter
18
+        if (parameter.ParameterDescriptor == null || 
19
+            (parameter.ParameterDescriptor != null &&
20
+            !typeof(CancellationToken).IsAssignableFrom(parameter.ParameterDescriptor.ParameterType)))
21
+        {
22
+            <tr>
23
+                <td class="parameter-name"><b>@parameter.Name</b></td>
24
+                <td class="parameter-documentation"><pre>@parameterDocumentation</pre></td>
25
+                <td class="parameter-source">
26
+                    @switch (parameter.Source)
27
+                    {
28
+                        case ApiParameterSource.FromBody:
29
+                            <p>Define this parameter in the request <b>body</b>.</p>
30
+                            break;
31
+                        case ApiParameterSource.FromUri:
32
+                            <p>Define this parameter in the request <b>URI</b>.</p>
33
+                            break;
34
+                        case ApiParameterSource.Unknown:
35
+                        default:
36
+                            <p>None.</p>
37
+                            break;
38
+                    }
39
+                </td>
40
+            </tr>
41
+        }
42
+    }
43
+    </tbody>
44
+</table>

+ 30
- 0
Authentication-test/Areas/HelpPage/Views/Help/DisplayTemplates/Samples.cshtml 查看文件

@@ -0,0 +1,30 @@
1
+@using System.Net.Http.Headers
2
+@model Dictionary<MediaTypeHeaderValue, object>
3
+
4
+@{
5
+    // Group the samples into a single tab if they are the same.
6
+    Dictionary<string, object> samples = Model.GroupBy(pair => pair.Value).ToDictionary(
7
+        pair => String.Join(", ", pair.Select(m => m.Key.ToString()).ToArray()), 
8
+        pair => pair.Key);
9
+    var mediaTypes = samples.Keys;
10
+}
11
+<div>
12
+    @foreach (var mediaType in mediaTypes)
13
+    {
14
+        <h4 class="sample-header">@mediaType</h4>
15
+        <div class="sample-content">
16
+            <span><b>Sample:</b></span>
17
+            @{
18
+                var sample = samples[mediaType];
19
+                if (sample == null)
20
+                {
21
+                    <p>Sample not available.</p>
22
+                }
23
+                else
24
+                {
25
+                    @Html.DisplayFor(s => sample);
26
+                }
27
+            }
28
+        </div>
29
+    }
30
+</div>

+ 6
- 0
Authentication-test/Areas/HelpPage/Views/Help/DisplayTemplates/TextSample.cshtml 查看文件

@@ -0,0 +1,6 @@
1
+@using Authentication_test.Areas.HelpPage
2
+@model TextSample
3
+
4
+<pre class="wrapped">
5
+@Model.Text
6
+</pre>

+ 41
- 0
Authentication-test/Areas/HelpPage/Views/Help/Index.cshtml 查看文件

@@ -0,0 +1,41 @@
1
+@using System.Web.Http
2
+@using System.Web.Http.Controllers
3
+@using System.Web.Http.Description
4
+@using System.Collections.ObjectModel
5
+@using Authentication_test.Areas.HelpPage.Models
6
+@model Collection<ApiDescription>
7
+
8
+@{
9
+    ViewBag.Title = "ASP.NET Web API Help Page";
10
+
11
+    // Group APIs by controller
12
+    ILookup<HttpControllerDescriptor, ApiDescription> apiGroups = Model.ToLookup(api => api.ActionDescriptor.ControllerDescriptor);
13
+}
14
+
15
+<header>
16
+    <div class="content-wrapper">
17
+        <div class="float-left">
18
+            <h1>@ViewBag.Title</h1>
19
+        </div>
20
+    </div>
21
+</header>
22
+<div id="body">
23
+    <section class="featured">
24
+        <div class="content-wrapper">
25
+            <h2>Introduction</h2>
26
+            <p>
27
+                Provide a general description of your APIs here.
28
+            </p>
29
+        </div>
30
+    </section>
31
+    <section class="content-wrapper main-content clear-fix">
32
+        @foreach (var group in apiGroups)
33
+        {
34
+            @Html.DisplayFor(m => group, "ApiGroup")
35
+        }
36
+    </section>
37
+</div>
38
+
39
+@section Scripts {
40
+    <link type="text/css" href="~/Areas/HelpPage/HelpPage.css" rel="stylesheet" />
41
+}

+ 12
- 0
Authentication-test/Areas/HelpPage/Views/Shared/_Layout.cshtml 查看文件

@@ -0,0 +1,12 @@
1
+<!DOCTYPE html>
2
+<html>
3
+<head>
4
+    <meta charset="utf-8" />
5
+    <meta name="viewport" content="width=device-width" />
6
+    <title>@ViewBag.Title</title>
7
+    @RenderSection("scripts", required: false)
8
+</head>
9
+<body>
10
+    @RenderBody()
11
+</body>
12
+</html>

+ 62
- 0
Authentication-test/Areas/HelpPage/Views/Web.config 查看文件

@@ -0,0 +1,62 @@
1
+<?xml version="1.0"?>
2
+
3
+<configuration>
4
+  <configSections>
5
+    <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
6
+      <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
7
+      <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
8
+    </sectionGroup>
9
+  </configSections>
10
+
11
+  <system.web.webPages.razor>
12
+    <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
13
+    <pages pageBaseType="System.Web.Mvc.WebViewPage">
14
+      <namespaces>
15
+        <add namespace="System.Web.Mvc" />
16
+        <add namespace="System.Web.Mvc.Ajax" />
17
+        <add namespace="System.Web.Mvc.Html" />
18
+        <add namespace="System.Web.Routing" />
19
+      </namespaces>
20
+    </pages>
21
+  </system.web.webPages.razor>
22
+
23
+  <appSettings>
24
+    <add key="webpages:Enabled" value="false" />
25
+  </appSettings>
26
+
27
+  <system.web>
28
+    <httpHandlers>
29
+      <add path="*" verb="*" type="System.Web.HttpNotFoundHandler"/>
30
+    </httpHandlers>
31
+    <compilation debug="true">
32
+      <assemblies>
33
+        <add assembly="System.Net.Http, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
34
+      </assemblies>
35
+    </compilation>
36
+    <!--
37
+        Enabling request validation in view pages would cause validation to occur
38
+        after the input has already been processed by the controller. By default
39
+        MVC performs request validation before a controller processes the input.
40
+        To change this behavior apply the ValidateInputAttribute to a
41
+        controller or action.
42
+    -->
43
+    <pages
44
+        validateRequest="false"
45
+        pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
46
+        pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
47
+        userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
48
+      <controls>
49
+        <add assembly="System.Web.Mvc, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
50
+      </controls>
51
+    </pages>
52
+  </system.web>
53
+
54
+  <system.webServer>
55
+    <validation validateIntegratedModeConfiguration="false" />
56
+
57
+    <handlers>
58
+      <remove name="BlockViewHandler"/>
59
+      <add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
60
+    </handlers>
61
+  </system.webServer>
62
+</configuration>

+ 4
- 0
Authentication-test/Areas/HelpPage/Views/_ViewStart.cshtml 查看文件

@@ -0,0 +1,4 @@
1
+@{
2
+    // Change the Layout path below to blend the look and feel of the help page with your existing web pages
3
+    Layout = "~/Views/Shared/_Layout.cshtml";
4
+}

+ 143
- 0
Authentication-test/Areas/HelpPage/XmlDocumentationProvider.cs 查看文件

@@ -0,0 +1,143 @@
1
+using System;
2
+using System.Globalization;
3
+using System.Linq;
4
+using System.Reflection;
5
+using System.Web.Http.Controllers;
6
+using System.Web.Http.Description;
7
+using System.Xml.XPath;
8
+
9
+namespace Authentication_test.Areas.HelpPage
10
+{
11
+    /// <summary>
12
+    /// A custom <see cref="IDocumentationProvider"/> that reads the API documentation from an XML documentation file.
13
+    /// </summary>
14
+    public class XmlDocumentationProvider : IDocumentationProvider
15
+    {
16
+        private XPathNavigator _documentNavigator;
17
+        private const string TypeExpression = "/doc/members/member[@name='T:{0}']";
18
+        private const string MethodExpression = "/doc/members/member[@name='M:{0}']";
19
+        private const string ParameterExpression = "param[@name='{0}']";
20
+
21
+        /// <summary>
22
+        /// Initializes a new instance of the <see cref="XmlDocumentationProvider"/> class.
23
+        /// </summary>
24
+        /// <param name="documentPath">The physical path to XML document.</param>
25
+        public XmlDocumentationProvider(string documentPath)
26
+        {
27
+            if (documentPath == null)
28
+            {
29
+                throw new ArgumentNullException("documentPath");
30
+            }
31
+            XPathDocument xpath = new XPathDocument(documentPath);
32
+            _documentNavigator = xpath.CreateNavigator();
33
+        }
34
+
35
+        public string GetDocumentation(HttpControllerDescriptor controllerDescriptor)
36
+        {
37
+            XPathNavigator typeNode = GetTypeNode(controllerDescriptor);
38
+            return GetTagValue(typeNode, "summary");
39
+        }
40
+
41
+        public virtual string GetDocumentation(HttpActionDescriptor actionDescriptor)
42
+        {
43
+            XPathNavigator methodNode = GetMethodNode(actionDescriptor);
44
+            return GetTagValue(methodNode, "summary");
45
+        }
46
+
47
+        public virtual string GetDocumentation(HttpParameterDescriptor parameterDescriptor)
48
+        {
49
+            ReflectedHttpParameterDescriptor reflectedParameterDescriptor = parameterDescriptor as ReflectedHttpParameterDescriptor;
50
+            if (reflectedParameterDescriptor != null)
51
+            {
52
+                XPathNavigator methodNode = GetMethodNode(reflectedParameterDescriptor.ActionDescriptor);
53
+                if (methodNode != null)
54
+                {
55
+                    string parameterName = reflectedParameterDescriptor.ParameterInfo.Name;
56
+                    XPathNavigator parameterNode = methodNode.SelectSingleNode(String.Format(CultureInfo.InvariantCulture, ParameterExpression, parameterName));
57
+                    if (parameterNode != null)
58
+                    {
59
+                        return parameterNode.Value.Trim();
60
+                    }
61
+                }
62
+            }
63
+
64
+            return null;
65
+        }
66
+
67
+        public string GetResponseDocumentation(HttpActionDescriptor actionDescriptor)
68
+        {
69
+            XPathNavigator methodNode = GetMethodNode(actionDescriptor);
70
+            return GetTagValue(methodNode, "returns");
71
+        }
72
+
73
+        private XPathNavigator GetMethodNode(HttpActionDescriptor actionDescriptor)
74
+        {
75
+            ReflectedHttpActionDescriptor reflectedActionDescriptor = actionDescriptor as ReflectedHttpActionDescriptor;
76
+            if (reflectedActionDescriptor != null)
77
+            {
78
+                string selectExpression = String.Format(CultureInfo.InvariantCulture, MethodExpression, GetMemberName(reflectedActionDescriptor.MethodInfo));
79
+                return _documentNavigator.SelectSingleNode(selectExpression);
80
+            }
81
+
82
+            return null;
83
+        }
84
+
85
+        private static string GetMemberName(MethodInfo method)
86
+        {
87
+            string name = String.Format(CultureInfo.InvariantCulture, "{0}.{1}", method.DeclaringType.FullName, method.Name);
88
+            ParameterInfo[] parameters = method.GetParameters();
89
+            if (parameters.Length != 0)
90
+            {
91
+                string[] parameterTypeNames = parameters.Select(param => GetTypeName(param.ParameterType)).ToArray();
92
+                name += String.Format(CultureInfo.InvariantCulture, "({0})", String.Join(",", parameterTypeNames));
93
+            }
94
+
95
+            return name;
96
+        }
97
+
98
+        private static string GetTagValue(XPathNavigator parentNode, string tagName)
99
+        {
100
+            if (parentNode != null)
101
+            {
102
+                XPathNavigator node = parentNode.SelectSingleNode(tagName);
103
+                if (node != null)
104
+                {
105
+                    return node.Value.Trim();
106
+                }
107
+            }
108
+
109
+            return null;
110
+        }
111
+
112
+        private static string GetTypeName(Type type)
113
+        {
114
+            if (type.IsGenericType)
115
+            {
116
+                // Format the generic type name to something like: Generic{System.Int32,System.String}
117
+                Type genericType = type.GetGenericTypeDefinition();
118
+                Type[] genericArguments = type.GetGenericArguments();
119
+                string typeName = genericType.FullName;
120
+
121
+                // Trim the generic parameter counts from the name
122
+                typeName = typeName.Substring(0, typeName.IndexOf('`'));
123
+                string[] argumentTypeNames = genericArguments.Select(t => GetTypeName(t)).ToArray();
124
+                return String.Format(CultureInfo.InvariantCulture, "{0}{{{1}}}", typeName, String.Join(",", argumentTypeNames));
125
+            }
126
+
127
+            return type.FullName;
128
+        }
129
+
130
+        private XPathNavigator GetTypeNode(HttpControllerDescriptor controllerDescriptor)
131
+        {
132
+            Type controllerType = controllerDescriptor.ControllerType;
133
+            string controllerTypeName = controllerType.FullName;
134
+            if (controllerType.IsNested)
135
+            {
136
+                // Changing the nested type name from OuterType+InnerType to OuterType.InnerType to match the XML documentation syntax.
137
+                controllerTypeName = controllerTypeName.Replace("+", ".");
138
+            }
139
+            string selectExpression = String.Format(CultureInfo.InvariantCulture, TypeExpression, controllerTypeName);
140
+            return _documentNavigator.SelectSingleNode(selectExpression);
141
+        }
142
+    }
143
+}

+ 235
- 0
Authentication-test/Authentication-test.csproj 查看文件

@@ -0,0 +1,235 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4
+  <PropertyGroup>
5
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7
+    <ProductVersion>
8
+    </ProductVersion>
9
+    <SchemaVersion>2.0</SchemaVersion>
10
+    <ProjectGuid>{236E3095-DCCC-4460-AEE5-7A6BB126DC04}</ProjectGuid>
11
+    <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
12
+    <OutputType>Library</OutputType>
13
+    <AppDesignerFolder>Properties</AppDesignerFolder>
14
+    <RootNamespace>Authentication_test</RootNamespace>
15
+    <AssemblyName>Authentication-test</AssemblyName>
16
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
17
+    <MvcBuildViews>false</MvcBuildViews>
18
+    <UseIISExpress>true</UseIISExpress>
19
+    <IISExpressSSLPort />
20
+    <IISExpressAnonymousAuthentication />
21
+    <IISExpressWindowsAuthentication />
22
+    <IISExpressUseClassicPipelineMode />
23
+  </PropertyGroup>
24
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
25
+    <DebugSymbols>true</DebugSymbols>
26
+    <DebugType>full</DebugType>
27
+    <Optimize>false</Optimize>
28
+    <OutputPath>bin\</OutputPath>
29
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
30
+    <ErrorReport>prompt</ErrorReport>
31
+    <WarningLevel>4</WarningLevel>
32
+  </PropertyGroup>
33
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
34
+    <DebugType>pdbonly</DebugType>
35
+    <Optimize>true</Optimize>
36
+    <OutputPath>bin\</OutputPath>
37
+    <DefineConstants>TRACE</DefineConstants>
38
+    <ErrorReport>prompt</ErrorReport>
39
+    <WarningLevel>4</WarningLevel>
40
+  </PropertyGroup>
41
+  <ItemGroup>
42
+    <Reference Include="Microsoft.CSharp" />
43
+    <Reference Include="System" />
44
+    <Reference Include="System.Data" />
45
+    <Reference Include="System.Data.Entity" />
46
+    <Reference Include="System.Drawing" />
47
+    <Reference Include="System.Web.Entity" />
48
+    <Reference Include="System.Web.ApplicationServices" />
49
+    <Reference Include="System.ComponentModel.DataAnnotations" />
50
+    <Reference Include="System.Core" />
51
+    <Reference Include="System.Data.DataSetExtensions" />
52
+    <Reference Include="System.Xml.Linq" />
53
+    <Reference Include="System.Web" />
54
+    <Reference Include="System.Web.Abstractions" />
55
+    <Reference Include="System.Web.Routing" />
56
+    <Reference Include="System.Xml" />
57
+    <Reference Include="System.Configuration" />
58
+    <Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
59
+      <Private>True</Private>
60
+      <HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
61
+    </Reference>
62
+    <Reference Include="Newtonsoft.Json">
63
+      <HintPath>..\packages\Newtonsoft.Json.5.0.6\lib\net45\Newtonsoft.Json.dll</HintPath>
64
+    </Reference>
65
+    <Reference Include="System.Net.Http">
66
+    </Reference>
67
+    <Reference Include="System.Net.Http.Formatting, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
68
+      <HintPath>..\packages\Microsoft.AspNet.WebApi.Client.5.0.0\lib\net45\System.Net.Http.Formatting.dll</HintPath>
69
+    </Reference>
70
+    <Reference Include="System.Net.Http.WebRequest">
71
+    </Reference>
72
+    <Reference Include="System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
73
+      <Private>True</Private>
74
+      <HintPath>..\packages\Microsoft.AspNet.WebPages.3.0.0\lib\net45\System.Web.Helpers.dll</HintPath>
75
+    </Reference>
76
+    <Reference Include="System.Web.Http, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
77
+      <HintPath>..\packages\Microsoft.AspNet.WebApi.Core.5.0.0\lib\net45\System.Web.Http.dll</HintPath>
78
+    </Reference>
79
+    <Reference Include="System.Web.Http.WebHost, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
80
+      <HintPath>..\packages\Microsoft.AspNet.WebApi.WebHost.5.0.0\lib\net45\System.Web.Http.WebHost.dll</HintPath>
81
+    </Reference>
82
+    <Reference Include="System.Web.Mvc, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
83
+      <Private>True</Private>
84
+      <HintPath>..\packages\Microsoft.AspNet.Mvc.5.0.0\lib\net45\System.Web.Mvc.dll</HintPath>
85
+    </Reference>
86
+    <Reference Include="System.Web.Optimization">
87
+      <HintPath>..\packages\Microsoft.AspNet.Web.Optimization.1.1.1\lib\net40\System.Web.Optimization.dll</HintPath>
88
+    </Reference>
89
+    <Reference Include="System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
90
+      <Private>True</Private>
91
+      <HintPath>..\packages\Microsoft.AspNet.Razor.3.0.0\lib\net45\System.Web.Razor.dll</HintPath>
92
+    </Reference>
93
+    <Reference Include="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
94
+      <Private>True</Private>
95
+      <HintPath>..\packages\Microsoft.AspNet.WebPages.3.0.0\lib\net45\System.Web.WebPages.dll</HintPath>
96
+    </Reference>
97
+    <Reference Include="System.Web.WebPages.Deployment, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
98
+      <Private>True</Private>
99
+      <HintPath>..\packages\Microsoft.AspNet.WebPages.3.0.0\lib\net45\System.Web.WebPages.Deployment.dll</HintPath>
100
+    </Reference>
101
+    <Reference Include="System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
102
+      <Private>True</Private>
103
+      <HintPath>..\packages\Microsoft.AspNet.WebPages.3.0.0\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
104
+    </Reference>
105
+    <Reference Include="WebGrease">
106
+      <Private>True</Private>
107
+      <HintPath>..\packages\WebGrease.1.5.2\lib\WebGrease.dll</HintPath>
108
+    </Reference>
109
+    <Reference Include="Antlr3.Runtime">
110
+      <Private>True</Private>
111
+      <HintPath>..\packages\Antlr.3.4.1.9004\lib\Antlr3.Runtime.dll</HintPath>
112
+    </Reference>
113
+  </ItemGroup>
114
+  <ItemGroup>
115
+    <Folder Include="App_Data\" />
116
+    <Folder Include="DataAcces\" />
117
+    <Folder Include="Models\" />
118
+  </ItemGroup>
119
+  <ItemGroup>
120
+    <Compile Include="App_Start\BundleConfig.cs" />
121
+    <Compile Include="App_Start\FilterConfig.cs" />
122
+    <Compile Include="App_Start\RouteConfig.cs" />
123
+    <Compile Include="App_Start\WebApiConfig.cs" />
124
+    <Compile Include="Areas\HelpPage\ApiDescriptionExtensions.cs" />
125
+    <Compile Include="Areas\HelpPage\App_Start\HelpPageConfig.cs" />
126
+    <Compile Include="Areas\HelpPage\Controllers\HelpController.cs" />
127
+    <Compile Include="Areas\HelpPage\HelpPageAreaRegistration.cs" />
128
+    <Compile Include="Areas\HelpPage\HelpPageConfigurationExtensions.cs" />
129
+    <Compile Include="Areas\HelpPage\Models\HelpPageApiModel.cs" />
130
+    <Compile Include="Areas\HelpPage\SampleGeneration\HelpPageSampleGenerator.cs" />
131
+    <Compile Include="Areas\HelpPage\SampleGeneration\HelpPageSampleKey.cs" />
132
+    <Compile Include="Areas\HelpPage\SampleGeneration\ImageSample.cs" />
133
+    <Compile Include="Areas\HelpPage\SampleGeneration\InvalidSample.cs" />
134
+    <Compile Include="Areas\HelpPage\SampleGeneration\ObjectGenerator.cs" />
135
+    <Compile Include="Areas\HelpPage\SampleGeneration\SampleDirection.cs" />
136
+    <Compile Include="Areas\HelpPage\SampleGeneration\TextSample.cs" />
137
+    <Compile Include="Areas\HelpPage\XmlDocumentationProvider.cs" />
138
+    <Compile Include="Controllers\HomeController.cs" />
139
+    <Compile Include="Controllers\ValuesController.cs" />
140
+    <Compile Include="Global.asax.cs">
141
+      <DependentUpon>Global.asax</DependentUpon>
142
+    </Compile>
143
+    <Compile Include="Properties\AssemblyInfo.cs" />
144
+  </ItemGroup>
145
+  <ItemGroup>
146
+    <Content Include="Areas\HelpPage\HelpPage.css" />
147
+    <Content Include="Content\bootstrap.css" />
148
+    <Content Include="Content\bootstrap.min.css" />
149
+    <Content Include="favicon.ico" />
150
+    <Content Include="fonts\glyphicons-halflings-regular.svg" />
151
+    <Content Include="Global.asax" />
152
+    <Content Include="Scripts\bootstrap.js" />
153
+    <Content Include="Scripts\bootstrap.min.js" />
154
+    <Content Include="Areas\HelpPage\Views\Web.config" />
155
+    <Content Include="Areas\HelpPage\Views\Shared\_Layout.cshtml" />
156
+    <Content Include="Areas\HelpPage\Views\Help\Index.cshtml" />
157
+    <Content Include="Areas\HelpPage\Views\Help\DisplayTemplates\TextSample.cshtml" />
158
+    <Content Include="Areas\HelpPage\Views\Help\DisplayTemplates\Samples.cshtml" />
159
+    <Content Include="Areas\HelpPage\Views\Help\DisplayTemplates\Parameters.cshtml" />
160
+    <Content Include="Areas\HelpPage\Views\Help\DisplayTemplates\InvalidSample.cshtml" />
161
+    <Content Include="Areas\HelpPage\Views\Help\DisplayTemplates\ImageSample.cshtml" />
162
+    <Content Include="Areas\HelpPage\Views\Help\DisplayTemplates\HelpPageApiModel.cshtml" />
163
+    <Content Include="Areas\HelpPage\Views\Help\DisplayTemplates\ApiGroup.cshtml" />
164
+    <Content Include="Areas\HelpPage\Views\Help\Api.cshtml" />
165
+    <None Include="Scripts\jquery-1.10.2.intellisense.js" />
166
+    <Content Include="Scripts\jquery-1.10.2.js" />
167
+    <Content Include="Scripts\jquery-1.10.2.min.js" />
168
+    <Content Include="Scripts\modernizr-2.6.2.js" />
169
+    <Content Include="Scripts\respond.js" />
170
+    <Content Include="Scripts\respond.min.js" />
171
+    <Content Include="Web.config" />
172
+    <Content Include="Web.Debug.config">
173
+      <DependentUpon>Web.config</DependentUpon>
174
+    </Content>
175
+    <Content Include="Web.Release.config">
176
+      <DependentUpon>Web.config</DependentUpon>
177
+    </Content>
178
+    <Content Include="Areas\HelpPage\Views\_ViewStart.cshtml" />
179
+    <Content Include="Content\Site.css" />
180
+    <Content Include="Scripts\_references.js" />
181
+    <Content Include="Views\Web.config" />
182
+    <Content Include="Views\_ViewStart.cshtml" />
183
+    <Content Include="Views\Home\Index.cshtml" />
184
+    <Content Include="Views\Shared\Error.cshtml" />
185
+    <Content Include="Views\Shared\_Layout.cshtml" />
186
+    <Content Include="Scripts\jquery-1.10.2.min.map" />
187
+  </ItemGroup>
188
+  <ItemGroup>
189
+    <ProjectReference Include="..\Authentication\Authentication.csproj">
190
+      <Project>{D7B2B4CF-B1F2-4D86-89A5-A6C12FC0E327}</Project>
191
+      <Name>Authentication</Name>
192
+    </ProjectReference>
193
+  </ItemGroup>
194
+  <ItemGroup>
195
+    <Content Include="fonts\glyphicons-halflings-regular.woff" />
196
+    <Content Include="fonts\glyphicons-halflings-regular.ttf" />
197
+    <Content Include="fonts\glyphicons-halflings-regular.eot" />
198
+    <Content Include="packages.config" />
199
+    <None Include="Project_Readme.html" />
200
+  </ItemGroup>
201
+  <PropertyGroup>
202
+    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
203
+    <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
204
+  </PropertyGroup>
205
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
206
+  <Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
207
+  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
208
+  <Target Name="MvcBuildViews" AfterTargets="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
209
+    <AspNetCompiler VirtualPath="temp" PhysicalPath="$(WebProjectOutputDir)" />
210
+  </Target>
211
+  <ProjectExtensions>
212
+    <VisualStudio>
213
+      <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
214
+        <WebProjectProperties>
215
+          <UseIIS>True</UseIIS>
216
+          <AutoAssignPort>True</AutoAssignPort>
217
+          <DevelopmentServerPort>57969</DevelopmentServerPort>
218
+          <DevelopmentServerVPath>/</DevelopmentServerVPath>
219
+          <IISUrl>http://localhost:57969/</IISUrl>
220
+          <NTLMAuthentication>False</NTLMAuthentication>
221
+          <UseCustomServer>False</UseCustomServer>
222
+          <CustomServerUrl>
223
+          </CustomServerUrl>
224
+          <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
225
+        </WebProjectProperties>
226
+      </FlavorProperties>
227
+    </VisualStudio>
228
+  </ProjectExtensions>
229
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
230
+       Other similar extension points exist, see Microsoft.Common.targets.
231
+  <Target Name="BeforeBuild">
232
+  </Target>
233
+  <Target Name="AfterBuild">
234
+  </Target> -->
235
+</Project>

+ 42
- 0
Authentication-test/Content/Site.css 查看文件

@@ -0,0 +1,42 @@
1
+body {
2
+    padding-top: 50px;
3
+    padding-bottom: 20px;
4
+}
5
+
6
+/* Set padding to keep content from hitting the edges */
7
+.body-content {
8
+    padding-left: 15px;
9
+    padding-right: 15px;
10
+}
11
+
12
+/* Set width on the form input elements since they're 100% wide by default */
13
+input,
14
+select,
15
+textarea {
16
+    max-width: 280px;
17
+}
18
+
19
+/* styles for validation helpers */
20
+.field-validation-error {
21
+    color: #b94a48;
22
+}
23
+
24
+.field-validation-valid {
25
+    display: none;
26
+}
27
+
28
+input.input-validation-error {
29
+    border: 1px solid #b94a48;
30
+}
31
+
32
+input[type="checkbox"].input-validation-error {
33
+    border: 0 none;
34
+}
35
+
36
+.validation-summary-errors {
37
+    color: #b94a48;
38
+}
39
+
40
+.validation-summary-valid {
41
+    display: none;
42
+}

+ 6816
- 0
Authentication-test/Content/bootstrap.css
文件差異過大導致無法顯示
查看文件


+ 20
- 0
Authentication-test/Content/bootstrap.min.css
文件差異過大導致無法顯示
查看文件


+ 18
- 0
Authentication-test/Controllers/HomeController.cs 查看文件

@@ -0,0 +1,18 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Web;
5
+using System.Web.Mvc;
6
+
7
+namespace Authentication_test.Controllers
8
+{
9
+    public class HomeController : Controller
10
+    {
11
+        public ActionResult Index()
12
+        {
13
+            ViewBag.Title = "Home Page";
14
+
15
+            return View();
16
+        }
17
+    }
18
+}

+ 39
- 0
Authentication-test/Controllers/ValuesController.cs 查看文件

@@ -0,0 +1,39 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Net;
5
+using System.Net.Http;
6
+using System.Web.Http;
7
+
8
+namespace Authentication_test.Controllers
9
+{
10
+    public class ValuesController : ApiController
11
+    {
12
+        // GET api/values
13
+        public IEnumerable<string> Get()
14
+        {
15
+            return new string[] { "value1", "value2" };
16
+        }
17
+
18
+        // GET api/values/5
19
+        public string Get(int id)
20
+        {
21
+            return "value";
22
+        }
23
+
24
+        // POST api/values
25
+        public void Post([FromBody]string value)
26
+        {
27
+        }
28
+
29
+        // PUT api/values/5
30
+        public void Put(int id, [FromBody]string value)
31
+        {
32
+        }
33
+
34
+        // DELETE api/values/5
35
+        public void Delete(int id)
36
+        {
37
+        }
38
+    }
39
+}

+ 1
- 0
Authentication-test/Global.asax 查看文件

@@ -0,0 +1 @@
1
+<%@ Application Codebehind="Global.asax.cs" Inherits="Authentication_test.WebApiApplication" Language="C#" %>

+ 23
- 0
Authentication-test/Global.asax.cs 查看文件

@@ -0,0 +1,23 @@
1
+using System.Web;
2
+using System.Web.Http;
3
+using System.Web.Mvc;
4
+using System.Web.Optimization;
5
+using System.Web.Routing;
6
+using iiie.Authentication.Business.JWT;
7
+
8
+namespace Authentication_test
9
+{
10
+    public class WebApiApplication : HttpApplication
11
+    {
12
+        protected void Application_Start()
13
+        {
14
+            AreaRegistration.RegisterAllAreas();
15
+            GlobalConfiguration.Configure(WebApiConfig.Register);
16
+            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
17
+            RouteConfig.RegisterRoutes(RouteTable.Routes);
18
+            BundleConfig.RegisterBundles(BundleTable.Bundles);
19
+
20
+            GlobalConfiguration.Configuration.MessageHandlers.Add(new TokenValidationHandler());
21
+        }
22
+    }
23
+}

+ 149
- 0
Authentication-test/Project_Readme.html 查看文件

@@ -0,0 +1,149 @@
1
+<!DOCTYPE html>
2
+<html lang="en">
3
+<head>
4
+    <meta charset="utf-8" />
5
+    <title>Your ASP.NET application</title>
6
+    <style>
7
+        body {
8
+            background: #fff;
9
+            color: #505050;
10
+            font: 14px 'Segoe UI', tahoma, arial, helvetica, sans-serif;
11
+            margin: 20px;
12
+            padding: 0;
13
+        }
14
+
15
+        #header {
16
+            background: #efefef;
17
+            padding: 0;
18
+        }
19
+
20
+        h1 {
21
+            font-size: 48px;
22
+            font-weight: normal;
23
+            margin: 0;
24
+            padding: 0 30px;
25
+            line-height: 150px;
26
+        }
27
+
28
+        p {
29
+            font-size: 20px;
30
+            color: #fff;
31
+            background: #969696;
32
+            padding: 0 30px;
33
+            line-height: 50px;
34
+        }
35
+
36
+        #main {
37
+            padding: 5px 30px;
38
+        }
39
+
40
+        .section {
41
+            width: 21.7%;
42
+            float: left;
43
+            margin: 0 0 0 4%;
44
+        }
45
+
46
+            .section h2 {
47
+                font-size: 13px;
48
+                text-transform: uppercase;
49
+                margin: 0;
50
+                border-bottom: 1px solid silver;
51
+                padding-bottom: 12px;
52
+                margin-bottom: 8px;
53
+            }
54
+
55
+            .section.first {
56
+                margin-left: 0;
57
+            }
58
+
59
+                .section.first h2 {
60
+                    font-size: 24px;
61
+                    text-transform: none;
62
+                    margin-bottom: 25px;
63
+                    border: none;
64
+                }
65
+
66
+                .section.first li {
67
+                    border-top: 1px solid silver;
68
+                    padding: 8px 0;
69
+                }
70
+
71
+            .section.last {
72
+                margin-right: 0;
73
+            }
74
+
75
+        ul {
76
+            list-style: none;
77
+            padding: 0;
78
+            margin: 0;
79
+            line-height: 20px;
80
+        }
81
+
82
+        li {
83
+            padding: 4px 0;
84
+        }
85
+
86
+        a {
87
+            color: #267cb2;
88
+            text-decoration: none;
89
+        }
90
+
91
+            a:hover {
92
+                text-decoration: underline;
93
+            }
94
+    </style>
95
+</head>
96
+<body>
97
+
98
+    <div id="header">
99
+        <h1>Your ASP.NET application</h1>
100
+        <p>Congratulations! You've created a project</p>
101
+    </div>
102
+
103
+    <div id="main">
104
+        <div class="section first">
105
+            <h2>This application consists of:</h2>
106
+            <ul>
107
+                <li><a href="http://go.microsoft.com/fwlink/?LinkID=320956">Help Page</a> for documenting your Web APIs</li>
108
+                <li>Theming using <a href="http://go.microsoft.com/fwlink/?LinkID=320754">Bootstrap</a></li>
109
+                <li><a href="http://go.microsoft.com/fwlink/?LinkID=320957">Authentication</a>, if selected, shows how to register and sign in</li>
110
+                <li>ASP.NET features managed using <a href="http://go.microsoft.com/fwlink/?LinkID=320958">NuGet</a></li>
111
+            </ul>
112
+        </div>
113
+
114
+        <div class="section">
115
+            <h2>Customize app</h2>
116
+            <ul>
117
+                <li><a href="http://go.microsoft.com/fwlink/?LinkID=320959">Get started with HTTP services using ASP.NET Web API</a></li>
118
+                <li><a href="http://go.microsoft.com/fwlink/?LinkID=320960">Change the site's theme</a></li>
119
+                <li><a href="http://go.microsoft.com/fwlink/?LinkID=320961">Add more libraries using NuGet</a></li>
120
+                <li><a href="http://go.microsoft.com/fwlink/?LinkID=320962">Configure authentication</a></li>
121
+                <li><a href="http://go.microsoft.com/fwlink/?LinkID=320963">Scaffold an ASP.NET Web API from a model</a></li>
122
+                <li><a href="http://go.microsoft.com/fwlink/?LinkID=320964">Secure your web API</a></li>
123
+                <li><a href="http://go.microsoft.com/fwlink/?LinkID=320965">Access your web API on different devices</a></li>
124
+                <li><a href="http://go.microsoft.com/fwlink/?LinkID=320966">Enable tracing for testing and debugging</a></li>
125
+                <li><a href="http://go.microsoft.com/fwlink/?LinkID=320765">Add real-time web with ASP.NET SignalR</a></li>
126
+                <li><a href="http://go.microsoft.com/fwlink/?LinkID=320766">Add components using Scaffolding</a></li>
127
+                <li><a href="http://go.microsoft.com/fwlink/?LinkID=320768">Share your project</a></li>
128
+            </ul>
129
+        </div>
130
+
131
+        <div class="section">
132
+            <h2>Deploy</h2>
133
+            <ul>
134
+                <li><a href="http://go.microsoft.com/fwlink/?LinkID=320769">Ensure your app is ready for production</a></li>
135
+                <li><a href="http://go.microsoft.com/fwlink/?LinkID=320770">Windows Azure</a></li>
136
+                <li><a href="http://go.microsoft.com/fwlink/?LinkID=320771">Hosting providers</a></li>
137
+            </ul>
138
+        </div>
139
+
140
+        <div class="section last">
141
+            <h2>Get help</h2>
142
+            <ul>
143
+                <li><a href="http://go.microsoft.com/fwlink/?LinkID=320772">Get help</a></li>
144
+                <li><a href="http://go.microsoft.com/fwlink/?LinkID=320773">Get more templates</a></li>
145
+            </ul>
146
+        </div>
147
+    </div>
148
+</body>
149
+</html>

+ 35
- 0
Authentication-test/Properties/AssemblyInfo.cs 查看文件

@@ -0,0 +1,35 @@
1
+using System.Reflection;
2
+using System.Runtime.CompilerServices;
3
+using System.Runtime.InteropServices;
4
+
5
+// General Information about an assembly is controlled through the following
6
+// set of attributes. Change these attribute values to modify the information
7
+// associated with an assembly.
8
+[assembly: AssemblyTitle("Authentication_test")]
9
+[assembly: AssemblyDescription("")]
10
+[assembly: AssemblyConfiguration("")]
11
+[assembly: AssemblyCompany("")]
12
+[assembly: AssemblyProduct("Authentication_test")]
13
+[assembly: AssemblyCopyright("Copyright ©  2015")]
14
+[assembly: AssemblyTrademark("")]
15
+[assembly: AssemblyCulture("")]
16
+
17
+// Setting ComVisible to false makes the types in this assembly not visible
18
+// to COM components.  If you need to access a type in this assembly from
19
+// COM, set the ComVisible attribute to true on that type.
20
+[assembly: ComVisible(false)]
21
+
22
+// The following GUID is for the ID of the typelib if this project is exposed to COM
23
+[assembly: Guid("de142387-7127-486f-bf2a-c8cf0b2be96f")]
24
+
25
+// Version information for an assembly consists of the following four values:
26
+//
27
+//      Major Version
28
+//      Minor Version
29
+//      Build Number
30
+//      Revision
31
+//
32
+// You can specify all the values or you can default the Revision and Build Numbers
33
+// by using the '*' as shown below:
34
+[assembly: AssemblyVersion("1.0.0.0")]
35
+[assembly: AssemblyFileVersion("1.0.0.0")]

二進制
Authentication-test/Scripts/_references.js 查看文件


+ 2014
- 0
Authentication-test/Scripts/bootstrap.js
文件差異過大導致無法顯示
查看文件


+ 21
- 0
Authentication-test/Scripts/bootstrap.min.js
文件差異過大導致無法顯示
查看文件


+ 2671
- 0
Authentication-test/Scripts/jquery-1.10.2.intellisense.js
文件差異過大導致無法顯示
查看文件


+ 9803
- 0
Authentication-test/Scripts/jquery-1.10.2.js
文件差異過大導致無法顯示
查看文件


+ 23
- 0
Authentication-test/Scripts/jquery-1.10.2.min.js
文件差異過大導致無法顯示
查看文件


+ 1
- 0
Authentication-test/Scripts/jquery-1.10.2.min.map
文件差異過大導致無法顯示
查看文件


+ 1416
- 0
Authentication-test/Scripts/modernizr-2.6.2.js
文件差異過大導致無法顯示
查看文件


+ 340
- 0
Authentication-test/Scripts/respond.js 查看文件

@@ -0,0 +1,340 @@
1
+/* NUGET: BEGIN LICENSE TEXT
2
+ *
3
+ * Microsoft grants you the right to use these script files for the sole
4
+ * purpose of either: (i) interacting through your browser with the Microsoft
5
+ * website or online service, subject to the applicable licensing or use
6
+ * terms; or (ii) using the files as included with a Microsoft product subject
7
+ * to that product's license terms. Microsoft reserves all other rights to the
8
+ * files not expressly granted by Microsoft, whether by implication, estoppel
9
+ * or otherwise. Insofar as a script file is dual licensed under GPL,
10
+ * Microsoft neither took the code under GPL nor distributes it thereunder but
11
+ * under the terms set out in this paragraph. All notices and licenses
12
+ * below are for informational purposes only.
13
+ *
14
+ * NUGET: END LICENSE TEXT */
15
+/*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */
16
+/*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */
17
+window.matchMedia = window.matchMedia || (function(doc, undefined){
18
+  
19
+  var bool,
20
+      docElem  = doc.documentElement,
21
+      refNode  = docElem.firstElementChild || docElem.firstChild,
22
+      // fakeBody required for <FF4 when executed in <head>
23
+      fakeBody = doc.createElement('body'),
24
+      div      = doc.createElement('div');
25
+  
26
+  div.id = 'mq-test-1';
27
+  div.style.cssText = "position:absolute;top:-100em";
28
+  fakeBody.style.background = "none";
29
+  fakeBody.appendChild(div);
30
+  
31
+  return function(q){
32
+    
33
+    div.innerHTML = '&shy;<style media="'+q+'"> #mq-test-1 { width: 42px; }</style>';
34
+    
35
+    docElem.insertBefore(fakeBody, refNode);
36
+    bool = div.offsetWidth == 42;  
37
+    docElem.removeChild(fakeBody);
38
+    
39
+    return { matches: bool, media: q };
40
+  };
41
+  
42
+})(document);
43
+
44
+
45
+
46
+
47
+/*! Respond.js v1.2.0: min/max-width media query polyfill. (c) Scott Jehl. MIT/GPLv2 Lic. j.mp/respondjs  */
48
+(function( win ){
49
+	//exposed namespace
50
+	win.respond		= {};
51
+	
52
+	//define update even in native-mq-supporting browsers, to avoid errors
53
+	respond.update	= function(){};
54
+	
55
+	//expose media query support flag for external use
56
+	respond.mediaQueriesSupported	= win.matchMedia && win.matchMedia( "only all" ).matches;
57
+	
58
+	//if media queries are supported, exit here
59
+	if( respond.mediaQueriesSupported ){ return; }
60
+	
61
+	//define vars
62
+	var doc 			= win.document,
63
+		docElem 		= doc.documentElement,
64
+		mediastyles		= [],
65
+		rules			= [],
66
+		appendedEls 	= [],
67
+		parsedSheets 	= {},
68
+		resizeThrottle	= 30,
69
+		head 			= doc.getElementsByTagName( "head" )[0] || docElem,
70
+		base			= doc.getElementsByTagName( "base" )[0],
71
+		links			= head.getElementsByTagName( "link" ),
72
+		requestQueue	= [],
73
+		
74
+		//loop stylesheets, send text content to translate
75
+		ripCSS			= function(){
76
+			var sheets 	= links,
77
+				sl 		= sheets.length,
78
+				i		= 0,
79
+				//vars for loop:
80
+				sheet, href, media, isCSS;
81
+
82
+			for( ; i < sl; i++ ){
83
+				sheet	= sheets[ i ],
84
+				href	= sheet.href,
85
+				media	= sheet.media,
86
+				isCSS	= sheet.rel && sheet.rel.toLowerCase() === "stylesheet";
87
+
88
+				//only links plz and prevent re-parsing
89
+				if( !!href && isCSS && !parsedSheets[ href ] ){
90
+					// selectivizr exposes css through the rawCssText expando
91
+					if (sheet.styleSheet && sheet.styleSheet.rawCssText) {
92
+						translate( sheet.styleSheet.rawCssText, href, media );
93
+						parsedSheets[ href ] = true;
94
+					} else {
95
+						if( (!/^([a-zA-Z:]*\/\/)/.test( href ) && !base)
96
+							|| href.replace( RegExp.$1, "" ).split( "/" )[0] === win.location.host ){
97
+							requestQueue.push( {
98
+								href: href,
99
+								media: media
100
+							} );
101
+						}
102
+					}
103
+				}
104
+			}
105
+			makeRequests();
106
+		},
107
+		
108
+		//recurse through request queue, get css text
109
+		makeRequests	= function(){
110
+			if( requestQueue.length ){
111
+				var thisRequest = requestQueue.shift();
112
+				
113
+				ajax( thisRequest.href, function( styles ){
114
+					translate( styles, thisRequest.href, thisRequest.media );
115
+					parsedSheets[ thisRequest.href ] = true;
116
+					makeRequests();
117
+				} );
118
+			}
119
+		},
120
+		
121
+		//find media blocks in css text, convert to style blocks
122
+		translate			= function( styles, href, media ){
123
+			var qs			= styles.match(  /@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi ),
124
+				ql			= qs && qs.length || 0,
125
+				//try to get CSS path
126
+				href		= href.substring( 0, href.lastIndexOf( "/" )),
127
+				repUrls		= function( css ){
128
+					return css.replace( /(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g, "$1" + href + "$2$3" );
129
+				},
130
+				useMedia	= !ql && media,
131
+				//vars used in loop
132
+				i			= 0,
133
+				j, fullq, thisq, eachq, eql;
134
+
135
+			//if path exists, tack on trailing slash
136
+			if( href.length ){ href += "/"; }	
137
+				
138
+			//if no internal queries exist, but media attr does, use that	
139
+			//note: this currently lacks support for situations where a media attr is specified on a link AND
140
+				//its associated stylesheet has internal CSS media queries.
141
+				//In those cases, the media attribute will currently be ignored.
142
+			if( useMedia ){
143
+				ql = 1;
144
+			}
145
+			
146
+
147
+			for( ; i < ql; i++ ){
148
+				j	= 0;
149
+				
150
+				//media attr
151
+				if( useMedia ){
152
+					fullq = media;
153
+					rules.push( repUrls( styles ) );
154
+				}
155
+				//parse for styles
156
+				else{
157
+					fullq	= qs[ i ].match( /@media *([^\{]+)\{([\S\s]+?)$/ ) && RegExp.$1;
158
+					rules.push( RegExp.$2 && repUrls( RegExp.$2 ) );
159
+				}
160
+				
161
+				eachq	= fullq.split( "," );
162
+				eql		= eachq.length;
163
+					
164
+				for( ; j < eql; j++ ){
165
+					thisq	= eachq[ j ];
166
+					mediastyles.push( { 
167
+						media	: thisq.split( "(" )[ 0 ].match( /(only\s+)?([a-zA-Z]+)\s?/ ) && RegExp.$2 || "all",
168
+						rules	: rules.length - 1,
169
+						hasquery: thisq.indexOf("(") > -1,
170
+						minw	: thisq.match( /\(min\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/ ) && parseFloat( RegExp.$1 ) + ( RegExp.$2 || "" ), 
171
+						maxw	: thisq.match( /\(max\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/ ) && parseFloat( RegExp.$1 ) + ( RegExp.$2 || "" )
172
+					} );
173
+				}	
174
+			}
175
+
176
+			applyMedia();
177
+		},
178
+        	
179
+		lastCall,
180
+		
181
+		resizeDefer,
182
+		
183
+		// returns the value of 1em in pixels
184
+		getEmValue		= function() {
185
+			var ret,
186
+				div = doc.createElement('div'),
187
+				body = doc.body,
188
+				fakeUsed = false;
189
+									
190
+			div.style.cssText = "position:absolute;font-size:1em;width:1em";
191
+					
192
+			if( !body ){
193
+				body = fakeUsed = doc.createElement( "body" );
194
+				body.style.background = "none";
195
+			}
196
+					
197
+			body.appendChild( div );
198
+								
199
+			docElem.insertBefore( body, docElem.firstChild );
200
+								
201
+			ret = div.offsetWidth;
202
+								
203
+			if( fakeUsed ){
204
+				docElem.removeChild( body );
205
+			}
206
+			else {
207
+				body.removeChild( div );
208
+			}
209
+			
210
+			//also update eminpx before returning
211
+			ret = eminpx = parseFloat(ret);
212
+								
213
+			return ret;
214
+		},
215
+		
216
+		//cached container for 1em value, populated the first time it's needed 
217
+		eminpx,
218
+		
219
+		//enable/disable styles
220
+		applyMedia			= function( fromResize ){
221
+			var name		= "clientWidth",
222
+				docElemProp	= docElem[ name ],
223
+				currWidth 	= doc.compatMode === "CSS1Compat" && docElemProp || doc.body[ name ] || docElemProp,
224
+				styleBlocks	= {},
225
+				lastLink	= links[ links.length-1 ],
226
+				now 		= (new Date()).getTime();
227
+
228
+			//throttle resize calls	
229
+			if( fromResize && lastCall && now - lastCall < resizeThrottle ){
230
+				clearTimeout( resizeDefer );
231
+				resizeDefer = setTimeout( applyMedia, resizeThrottle );
232
+				return;
233
+			}
234
+			else {
235
+				lastCall	= now;
236
+			}
237
+										
238
+			for( var i in mediastyles ){
239
+				var thisstyle = mediastyles[ i ],
240
+					min = thisstyle.minw,
241
+					max = thisstyle.maxw,
242
+					minnull = min === null,
243
+					maxnull = max === null,
244
+					em = "em";
245
+				
246
+				if( !!min ){
247
+					min = parseFloat( min ) * ( min.indexOf( em ) > -1 ? ( eminpx || getEmValue() ) : 1 );
248
+				}
249
+				if( !!max ){
250
+					max = parseFloat( max ) * ( max.indexOf( em ) > -1 ? ( eminpx || getEmValue() ) : 1 );
251
+				}
252
+				
253
+				// if there's no media query at all (the () part), or min or max is not null, and if either is present, they're true
254
+				if( !thisstyle.hasquery || ( !minnull || !maxnull ) && ( minnull || currWidth >= min ) && ( maxnull || currWidth <= max ) ){
255
+						if( !styleBlocks[ thisstyle.media ] ){
256
+							styleBlocks[ thisstyle.media ] = [];
257
+						}
258
+						styleBlocks[ thisstyle.media ].push( rules[ thisstyle.rules ] );
259
+				}
260
+			}
261
+			
262
+			//remove any existing respond style element(s)
263
+			for( var i in appendedEls ){
264
+				if( appendedEls[ i ] && appendedEls[ i ].parentNode === head ){
265
+					head.removeChild( appendedEls[ i ] );
266
+				}
267
+			}
268
+			
269
+			//inject active styles, grouped by media type
270
+			for( var i in styleBlocks ){
271
+				var ss		= doc.createElement( "style" ),
272
+					css		= styleBlocks[ i ].join( "\n" );
273
+				
274
+				ss.type = "text/css";	
275
+				ss.media	= i;
276
+				
277
+				//originally, ss was appended to a documentFragment and sheets were appended in bulk.
278
+				//this caused crashes in IE in a number of circumstances, such as when the HTML element had a bg image set, so appending beforehand seems best. Thanks to @dvelyk for the initial research on this one!
279
+				head.insertBefore( ss, lastLink.nextSibling );
280
+				
281
+				if ( ss.styleSheet ){ 
282
+		        	ss.styleSheet.cssText = css;
283
+		        } 
284
+		        else {
285
+					ss.appendChild( doc.createTextNode( css ) );
286
+		        }
287
+		        
288
+				//push to appendedEls to track for later removal
289
+				appendedEls.push( ss );
290
+			}
291
+		},
292
+		//tweaked Ajax functions from Quirksmode
293
+		ajax = function( url, callback ) {
294
+			var req = xmlHttp();
295
+			if (!req){
296
+				return;
297
+			}	
298
+			req.open( "GET", url, true );
299
+			req.onreadystatechange = function () {
300
+				if ( req.readyState != 4 || req.status != 200 && req.status != 304 ){
301
+					return;
302
+				}
303
+				callback( req.responseText );
304
+			}
305
+			if ( req.readyState == 4 ){
306
+				return;
307
+			}
308
+			req.send( null );
309
+		},
310
+		//define ajax obj 
311
+		xmlHttp = (function() {
312
+			var xmlhttpmethod = false;	
313
+			try {
314
+				xmlhttpmethod = new XMLHttpRequest();
315
+			}
316
+			catch( e ){
317
+				xmlhttpmethod = new ActiveXObject( "Microsoft.XMLHTTP" );
318
+			}
319
+			return function(){
320
+				return xmlhttpmethod;
321
+			};
322
+		})();
323
+	
324
+	//translate CSS
325
+	ripCSS();
326
+	
327
+	//expose update for re-running respond later on
328
+	respond.update = ripCSS;
329
+	
330
+	//adjust on resize
331
+	function callMedia(){
332
+		applyMedia( true );
333
+	}
334
+	if( win.addEventListener ){
335
+		win.addEventListener( "resize", callMedia, false );
336
+	}
337
+	else if( win.attachEvent ){
338
+		win.attachEvent( "onresize", callMedia );
339
+	}
340
+})(this);

+ 20
- 0
Authentication-test/Scripts/respond.min.js 查看文件

@@ -0,0 +1,20 @@
1
+/* NUGET: BEGIN LICENSE TEXT
2
+ *
3
+ * Microsoft grants you the right to use these script files for the sole
4
+ * purpose of either: (i) interacting through your browser with the Microsoft
5
+ * website or online service, subject to the applicable licensing or use
6
+ * terms; or (ii) using the files as included with a Microsoft product subject
7
+ * to that product's license terms. Microsoft reserves all other rights to the
8
+ * files not expressly granted by Microsoft, whether by implication, estoppel
9
+ * or otherwise. Insofar as a script file is dual licensed under GPL,
10
+ * Microsoft neither took the code under GPL nor distributes it thereunder but
11
+ * under the terms set out in this paragraph. All notices and licenses
12
+ * below are for informational purposes only.
13
+ *
14
+ * NUGET: END LICENSE TEXT */
15
+/*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */
16
+/*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */
17
+window.matchMedia=window.matchMedia||(function(e,f){var c,a=e.documentElement,b=a.firstElementChild||a.firstChild,d=e.createElement("body"),g=e.createElement("div");g.id="mq-test-1";g.style.cssText="position:absolute;top:-100em";d.style.background="none";d.appendChild(g);return function(h){g.innerHTML='&shy;<style media="'+h+'"> #mq-test-1 { width: 42px; }</style>';a.insertBefore(d,b);c=g.offsetWidth==42;a.removeChild(d);return{matches:c,media:h}}})(document);
18
+
19
+/*! Respond.js v1.2.0: min/max-width media query polyfill. (c) Scott Jehl. MIT/GPLv2 Lic. j.mp/respondjs  */
20
+(function(e){e.respond={};respond.update=function(){};respond.mediaQueriesSupported=e.matchMedia&&e.matchMedia("only all").matches;if(respond.mediaQueriesSupported){return}var w=e.document,s=w.documentElement,i=[],k=[],q=[],o={},h=30,f=w.getElementsByTagName("head")[0]||s,g=w.getElementsByTagName("base")[0],b=f.getElementsByTagName("link"),d=[],a=function(){var D=b,y=D.length,B=0,A,z,C,x;for(;B<y;B++){A=D[B],z=A.href,C=A.media,x=A.rel&&A.rel.toLowerCase()==="stylesheet";if(!!z&&x&&!o[z]){if(A.styleSheet&&A.styleSheet.rawCssText){m(A.styleSheet.rawCssText,z,C);o[z]=true}else{if((!/^([a-zA-Z:]*\/\/)/.test(z)&&!g)||z.replace(RegExp.$1,"").split("/")[0]===e.location.host){d.push({href:z,media:C})}}}}u()},u=function(){if(d.length){var x=d.shift();n(x.href,function(y){m(y,x.href,x.media);o[x.href]=true;u()})}},m=function(I,x,z){var G=I.match(/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi),J=G&&G.length||0,x=x.substring(0,x.lastIndexOf("/")),y=function(K){return K.replace(/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,"$1"+x+"$2$3")},A=!J&&z,D=0,C,E,F,B,H;if(x.length){x+="/"}if(A){J=1}for(;D<J;D++){C=0;if(A){E=z;k.push(y(I))}else{E=G[D].match(/@media *([^\{]+)\{([\S\s]+?)$/)&&RegExp.$1;k.push(RegExp.$2&&y(RegExp.$2))}B=E.split(",");H=B.length;for(;C<H;C++){F=B[C];i.push({media:F.split("(")[0].match(/(only\s+)?([a-zA-Z]+)\s?/)&&RegExp.$2||"all",rules:k.length-1,hasquery:F.indexOf("(")>-1,minw:F.match(/\(min\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:F.match(/\(max\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}}j()},l,r,v=function(){var z,A=w.createElement("div"),x=w.body,y=false;A.style.cssText="position:absolute;font-size:1em;width:1em";if(!x){x=y=w.createElement("body");x.style.background="none"}x.appendChild(A);s.insertBefore(x,s.firstChild);z=A.offsetWidth;if(y){s.removeChild(x)}else{x.removeChild(A)}z=p=parseFloat(z);return z},p,j=function(I){var x="clientWidth",B=s[x],H=w.compatMode==="CSS1Compat"&&B||w.body[x]||B,D={},G=b[b.length-1],z=(new Date()).getTime();if(I&&l&&z-l<h){clearTimeout(r);r=setTimeout(j,h);return}else{l=z}for(var E in i){var K=i[E],C=K.minw,J=K.maxw,A=C===null,L=J===null,y="em";if(!!C){C=parseFloat(C)*(C.indexOf(y)>-1?(p||v()):1)}if(!!J){J=parseFloat(J)*(J.indexOf(y)>-1?(p||v()):1)}if(!K.hasquery||(!A||!L)&&(A||H>=C)&&(L||H<=J)){if(!D[K.media]){D[K.media]=[]}D[K.media].push(k[K.rules])}}for(var E in q){if(q[E]&&q[E].parentNode===f){f.removeChild(q[E])}}for(var E in D){var M=w.createElement("style"),F=D[E].join("\n");M.type="text/css";M.media=E;f.insertBefore(M,G.nextSibling);if(M.styleSheet){M.styleSheet.cssText=F}else{M.appendChild(w.createTextNode(F))}q.push(M)}},n=function(x,z){var y=c();if(!y){return}y.open("GET",x,true);y.onreadystatechange=function(){if(y.readyState!=4||y.status!=200&&y.status!=304){return}z(y.responseText)};if(y.readyState==4){return}y.send(null)},c=(function(){var x=false;try{x=new XMLHttpRequest()}catch(y){x=new ActiveXObject("Microsoft.XMLHTTP")}return function(){return x}})();a();respond.update=a;function t(){j(true)}if(e.addEventListener){e.addEventListener("resize",t,false)}else{if(e.attachEvent){e.attachEvent("onresize",t)}}})(this);

+ 24
- 0
Authentication-test/Views/Home/Index.cshtml 查看文件

@@ -0,0 +1,24 @@
1
+<div class="jumbotron">
2
+    <h1>ASP.NET</h1>
3
+    <p class="lead">ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS, and JavaScript.</p>
4
+    <p><a href="http://asp.net" class="btn btn-primary btn-large">Learn more &raquo;</a></p>
5
+</div>
6
+<div class="row">
7
+    <div class="col-md-4">
8
+        <h2>Getting started</h2>
9
+        <p>ASP.NET Web API is a framework that makes it easy to build HTTP services that reach
10
+        a broad range of clients, including browsers and mobile devices. ASP.NET Web API
11
+        is an ideal platform for building RESTful applications on the .NET Framework.</p>
12
+        <p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301870">Learn more &raquo;</a></p>
13
+    </div>
14
+    <div class="col-md-4">
15
+        <h2>Get more libraries</h2>
16
+        <p>NuGet is a free Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects.</p>
17
+        <p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301871">Learn more &raquo;</a></p>
18
+    </div>
19
+    <div class="col-md-4">
20
+        <h2>Web Hosting</h2>
21
+        <p>You can easily find a web hosting company that offers the right mix of features and price for your applications.</p>
22
+        <p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301872">Learn more &raquo;</a></p>
23
+    </div>
24
+</div>

+ 17
- 0
Authentication-test/Views/Shared/Error.cshtml 查看文件

@@ -0,0 +1,17 @@
1
+@{
2
+    Layout = null;
3
+}
4
+
5
+<!DOCTYPE html>
6
+<html>
7
+<head>
8
+    <meta name="viewport" content="width=device-width" />
9
+    <title>Error</title>
10
+</head>
11
+<body>
12
+    <hgroup>
13
+        <h1>Error.</h1>
14
+        <h2>An error occurred while processing your request.</h2>
15
+    </hgroup>
16
+</body>
17
+</html>

+ 41
- 0
Authentication-test/Views/Shared/_Layout.cshtml 查看文件

@@ -0,0 +1,41 @@
1
+<!DOCTYPE html>
2
+<html>
3
+<head>
4
+    <meta charset="utf-8" />
5
+    <meta name="viewport" content="width=device-width" />
6
+    <title>@ViewBag.Title</title>
7
+    @Styles.Render("~/Content/css")
8
+    @Scripts.Render("~/bundles/modernizr")
9
+</head>
10
+<body>
11
+    <div class="navbar navbar-inverse navbar-fixed-top">
12
+        <div class="container">
13
+            <div class="navbar-header">
14
+                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
15
+                    <span class="icon-bar"></span>
16
+                    <span class="icon-bar"></span>
17
+                    <span class="icon-bar"></span>
18
+                </button>
19
+                @Html.ActionLink("Application name", "Index", "Home", null, new { @class = "navbar-brand" })
20
+            </div>
21
+            <div class="navbar-collapse collapse">
22
+                <ul class="nav navbar-nav">
23
+                    <li>@Html.ActionLink("Home", "Index", "Home", new { area = "" }, null)</li>
24
+                    <li>@Html.ActionLink("API", "Index", "Help", new { area = "" }, null)</li>
25
+                </ul>
26
+            </div>
27
+        </div>
28
+    </div>
29
+    <div class="container body-content">
30
+        @RenderBody()
31
+        <hr />
32
+        <footer>
33
+            <p>&copy; @DateTime.Now.Year - My ASP.NET Application</p>
34
+        </footer>
35
+    </div>
36
+
37
+    @Scripts.Render("~/bundles/jquery")
38
+    @Scripts.Render("~/bundles/bootstrap")
39
+    @RenderSection("scripts", required: false)
40
+</body>
41
+</html>

+ 35
- 0
Authentication-test/Views/Web.config 查看文件

@@ -0,0 +1,35 @@
1
+<?xml version="1.0"?>
2
+
3
+<configuration>
4
+  <configSections>
5
+    <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
6
+      <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
7
+      <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
8
+    </sectionGroup>
9
+  </configSections>
10
+
11
+  <system.web.webPages.razor>
12
+    <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
13
+    <pages pageBaseType="System.Web.Mvc.WebViewPage">
14
+      <namespaces>
15
+        <add namespace="System.Web.Mvc" />
16
+        <add namespace="System.Web.Mvc.Ajax" />
17
+        <add namespace="System.Web.Mvc.Html" />
18
+        <add namespace="System.Web.Optimization"/>
19
+        <add namespace="System.Web.Routing" />
20
+        <add namespace="Authentication_test" />
21
+      </namespaces>
22
+    </pages>
23
+  </system.web.webPages.razor>
24
+
25
+  <appSettings>
26
+    <add key="webpages:Enabled" value="false" />
27
+  </appSettings>
28
+
29
+  <system.webServer>
30
+    <handlers>
31
+      <remove name="BlockViewHandler"/>
32
+      <add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
33
+    </handlers>
34
+  </system.webServer>
35
+</configuration>

+ 3
- 0
Authentication-test/Views/_ViewStart.cshtml 查看文件

@@ -0,0 +1,3 @@
1
+@{
2
+    Layout = "~/Views/Shared/_Layout.cshtml";
3
+}

+ 30
- 0
Authentication-test/Web.Debug.config 查看文件

@@ -0,0 +1,30 @@
1
+<?xml version="1.0"?>
2
+
3
+<!-- For more information on using Web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=301874 -->
4
+
5
+<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
6
+  <!--
7
+    In the example below, the "SetAttributes" transform will change the value of
8
+    "connectionString" to use "ReleaseSQLServer" only when the "Match" locator
9
+    finds an atrribute "name" that has a value of "MyDB".
10
+
11
+    <connectionStrings>
12
+      <add name="MyDB"
13
+        connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True"
14
+        xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
15
+    </connectionStrings>
16
+  -->
17
+  <system.web>
18
+    <!--
19
+      In the example below, the "Replace" transform will replace the entire
20
+      <customErrors> section of your Web.config file.
21
+      Note that because there is only one customErrors section under the
22
+      <system.web> node, there is no need to use the "xdt:Locator" attribute.
23
+
24
+      <customErrors defaultRedirect="GenericError.htm"
25
+        mode="RemoteOnly" xdt:Transform="Replace">
26
+        <error statusCode="500" redirect="InternalError.htm"/>
27
+      </customErrors>
28
+    -->
29
+  </system.web>
30
+</configuration>

+ 31
- 0
Authentication-test/Web.Release.config 查看文件

@@ -0,0 +1,31 @@
1
+<?xml version="1.0"?>
2
+
3
+<!-- For more information on using Web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=301874 -->
4
+
5
+<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
6
+  <!--
7
+    In the example below, the "SetAttributes" transform will change the value of
8
+    "connectionString" to use "ReleaseSQLServer" only when the "Match" locator
9
+    finds an atrribute "name" that has a value of "MyDB".
10
+
11
+    <connectionStrings>
12
+      <add name="MyDB"
13
+        connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True"
14
+        xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
15
+    </connectionStrings>
16
+  -->
17
+  <system.web>
18
+    <compilation xdt:Transform="RemoveAttributes(debug)" />
19
+    <!--
20
+      In the example below, the "Replace" transform will replace the entire
21
+      <customErrors> section of your Web.config file.
22
+      Note that because there is only one customErrors section under the
23
+      <system.web> node, there is no need to use the "xdt:Locator" attribute.
24
+
25
+      <customErrors defaultRedirect="GenericError.htm"
26
+        mode="RemoteOnly" xdt:Transform="Replace">
27
+        <error statusCode="500" redirect="InternalError.htm"/>
28
+      </customErrors>
29
+    -->
30
+  </system.web>
31
+</configuration>

+ 49
- 0
Authentication-test/Web.config 查看文件

@@ -0,0 +1,49 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<!--
3
+  For more information on how to configure your ASP.NET application, please visit
4
+  http://go.microsoft.com/fwlink/?LinkId=301879
5
+  -->
6
+<configuration>
7
+  <appSettings>
8
+    <add key="webpages:Version" value="3.0.0.0" />
9
+    <add key="webpages:Enabled" value="false" />
10
+    <add key="ClientValidationEnabled" value="true" />
11
+    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
12
+  </appSettings>
13
+  <system.web>
14
+    <compilation debug="true" targetFramework="4.5" />
15
+    <httpRuntime targetFramework="4.5" />
16
+  </system.web>
17
+  <system.webServer>
18
+    <handlers>
19
+      <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
20
+      <remove name="OPTIONSVerbHandler" />
21
+      <remove name="TRACEVerbHandler" />
22
+      <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
23
+    </handlers>
24
+  </system.webServer>
25
+  <runtime>
26
+    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
27
+      <dependentAssembly>
28
+        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
29
+        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
30
+      </dependentAssembly>
31
+      <dependentAssembly>
32
+        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
33
+        <bindingRedirect oldVersion="1.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
34
+      </dependentAssembly>
35
+      <dependentAssembly>
36
+        <assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" />
37
+        <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
38
+      </dependentAssembly>
39
+      <dependentAssembly>
40
+        <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
41
+        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
42
+      </dependentAssembly>
43
+      <dependentAssembly>
44
+        <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
45
+        <bindingRedirect oldVersion="1.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
46
+      </dependentAssembly>
47
+    </assemblyBinding>
48
+  </runtime>
49
+</configuration>

二進制
Authentication-test/favicon.ico 查看文件


二進制
Authentication-test/fonts/glyphicons-halflings-regular.eot 查看文件


+ 228
- 0
Authentication-test/fonts/glyphicons-halflings-regular.svg 查看文件

@@ -0,0 +1,228 @@
1
+<?xml version="1.0" standalone="no"?>
2
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
3
+<svg xmlns="http://www.w3.org/2000/svg">
4
+<metadata></metadata>
5
+<defs>
6
+<font id="glyphicons_halflingsregular" horiz-adv-x="1200" >
7
+<font-face units-per-em="1200" ascent="960" descent="-240" />
8
+<missing-glyph horiz-adv-x="500" />
9
+<glyph />
10
+<glyph />
11
+<glyph unicode=" " />
12
+<glyph unicode="*" d="M1100 500h-259l183 -183l-141 -141l-183 183v-259h-200v259l-183 -183l-141 141l183 183h-259v200h259l-183 183l141 141l183 -183v259h200v-259l183 183l141 -141l-183 -183h259v-200z" />
13
+<glyph unicode="+" d="M1100 400h-400v-400h-300v400h-400v300h400v400h300v-400h400v-300z" />
14
+<glyph unicode="&#xa0;" />
15
+<glyph unicode="&#x2000;" horiz-adv-x="652" />
16
+<glyph unicode="&#x2001;" horiz-adv-x="1304" />
17
+<glyph unicode="&#x2002;" horiz-adv-x="652" />
18
+<glyph unicode="&#x2003;" horiz-adv-x="1304" />
19
+<glyph unicode="&#x2004;" horiz-adv-x="434" />
20
+<glyph unicode="&#x2005;" horiz-adv-x="326" />
21
+<glyph unicode="&#x2006;" horiz-adv-x="217" />
22
+<glyph unicode="&#x2007;" horiz-adv-x="217" />
23
+<glyph unicode="&#x2008;" horiz-adv-x="163" />
24
+<glyph unicode="&#x2009;" horiz-adv-x="260" />
25
+<glyph unicode="&#x200a;" horiz-adv-x="72" />
26
+<glyph unicode="&#x202f;" horiz-adv-x="260" />
27
+<glyph unicode="&#x205f;" horiz-adv-x="326" />
28
+<glyph unicode="&#x20ac;" d="M800 500h-300q9 -74 33 -132t52.5 -91t62 -54.5t59 -29t46.5 -7.5q29 0 66 13t75 37t63.5 67.5t25.5 96.5h174q-31 -172 -128 -278q-107 -117 -274 -117q-205 0 -324 158q-36 46 -69 131.5t-45 205.5h-217l100 100h113q0 47 5 100h-218l100 100h135q37 167 112 257 q117 141 297 141q242 0 354 -189q60 -103 66 -209h-181q0 55 -25.5 99t-63.5 68t-75 36.5t-67 12.5q-24 0 -52.5 -10t-62.5 -32t-65.5 -67t-50.5 -107h379l-100 -100h-300q-6 -46 -6 -100h406z" />
29
+<glyph unicode="&#x2212;" d="M1100 700h-900v-300h900v300z" />
30
+<glyph unicode="&#x2601;" d="M178 300h750q120 0 205 86t85 208q0 120 -85 206.5t-205 86.5q-46 0 -90 -14q-44 97 -134.5 156.5t-200.5 59.5q-152 0 -260 -107.5t-108 -260.5q0 -25 2 -37q-66 -14 -108.5 -67.5t-42.5 -122.5q0 -80 56.5 -137t135.5 -57z" />
31
+<glyph unicode="&#x2709;" d="M1200 1100h-1200l600 -603zM300 600l-300 -300v600zM1200 900v-600l-300 300zM800 500l400 -400h-1200l400 400l200 -200z" />
32
+<glyph unicode="&#x270f;" d="M1101 889l99 92q13 13 13 32.5t-13 33.5l-153 153q-15 13 -33 13t-33 -13l-94 -97zM401 189l614 614l-214 214l-614 -614zM-13 -13l333 112l-223 223z" />
33
+<glyph unicode="&#xe000;" horiz-adv-x="500" d="M0 0z" />
34
+<glyph unicode="&#xe001;" d="M700 100h300v-100h-800v100h300v550l-500 550h1200l-500 -550v-550z" />
35
+<glyph unicode="&#xe002;" d="M1000 934v-521q-64 16 -138 -7q-79 -26 -122.5 -83t-25.5 -111q17 -55 85.5 -75.5t147.5 4.5q70 23 111.5 63.5t41.5 95.5v881q0 10 -7 15.5t-17 2.5l-752 -193q-10 -3 -17 -12.5t-7 -19.5v-689q-64 17 -138 -7q-79 -25 -122.5 -82t-25.5 -112t86 -75.5t147 5.5 q65 21 109 69t44 90v606z" />
36
+<glyph unicode="&#xe003;" d="M913 432l300 -300q7 -8 7 -18t-7 -18l-109 -109q-8 -7 -18 -7t-18 7l-300 300q-119 -78 -261 -78q-200 0 -342 142t-142 342t142 342t342 142t342 -142t142 -342q0 -142 -78 -261zM176 693q0 -136 97 -233t234 -97t233.5 96.5t96.5 233.5t-96.5 233.5t-233.5 96.5 t-234 -97t-97 -233z" />
37
+<glyph unicode="&#xe005;" d="M649 949q48 69 109.5 105t121.5 38t118.5 -20.5t102.5 -64t71 -100.5t27 -123q0 -57 -33.5 -117.5t-94 -124.5t-126.5 -127.5t-150 -152.5t-146 -174q-62 85 -145.5 174t-149.5 152.5t-126.5 127.5t-94 124.5t-33.5 117.5q0 64 28 123t73 100.5t104.5 64t119 20.5 t120 -38.5t104.5 -104.5z" />
38
+<glyph unicode="&#xe006;" d="M791 522l145 -449l-384 275l-382 -275l146 447l-388 280h479l146 400h2l146 -400h472zM168 71l2 1z" />
39
+<glyph unicode="&#xe007;" d="M791 522l145 -449l-384 275l-382 -275l146 447l-388 280h479l146 400h2l146 -400h472zM747 331l-74 229l193 140h-235l-77 211l-78 -211h-239l196 -142l-73 -226l192 140zM168 71l2 1z" />
40
+<glyph unicode="&#xe008;" d="M1200 143v-143h-1200v143l400 257v100q-37 0 -68.5 74.5t-31.5 125.5v200q0 124 88 212t212 88t212 -88t88 -212v-200q0 -51 -31.5 -125.5t-68.5 -74.5v-100z" />
41
+<glyph unicode="&#xe009;" d="M1200 1100v-1100h-1200v1100h1200zM200 1000h-100v-100h100v100zM900 1000h-600v-400h600v400zM1100 1000h-100v-100h100v100zM200 800h-100v-100h100v100zM1100 800h-100v-100h100v100zM200 600h-100v-100h100v100zM1100 600h-100v-100h100v100zM900 500h-600v-400h600 v400zM200 400h-100v-100h100v100zM1100 400h-100v-100h100v100zM200 200h-100v-100h100v100zM1100 200h-100v-100h100v100z" />
42
+<glyph unicode="&#xe010;" d="M500 1050v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-400q-21 0 -35.5 14.5t-14.5 35.5v400q0 21 14.5 35.5t35.5 14.5h400q21 0 35.5 -14.5t14.5 -35.5zM1100 1050v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-400q-21 0 -35.5 14.5t-14.5 35.5v400q0 21 14.5 35.5t35.5 14.5h400 q21 0 35.5 -14.5t14.5 -35.5zM500 450v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-400q-21 0 -35.5 14.5t-14.5 35.5v400q0 21 14.5 35.5t35.5 14.5h400q21 0 35.5 -14.5t14.5 -35.5zM1100 450v-400q0 -21 -14.5 -35.5t-35.5 -14.5h-400q-21 0 -35.5 14.5t-14.5 35.5v400 q0 21 14.5 35.5t35.5 14.5h400q21 0 35.5 -14.5t14.5 -35.5z" />
43
+<glyph unicode="&#xe011;" d="M300 1050v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5h200q21 0 35.5 -14.5t14.5 -35.5zM700 1050v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5h200 q21 0 35.5 -14.5t14.5 -35.5zM1100 1050v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5h200q21 0 35.5 -14.5t14.5 -35.5zM300 650v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v200 q0 21 14.5 35.5t35.5 14.5h200q21 0 35.5 -14.5t14.5 -35.5zM700 650v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5h200q21 0 35.5 -14.5t14.5 -35.5zM1100 650v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200 q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5h200q21 0 35.5 -14.5t14.5 -35.5zM300 250v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5h200q21 0 35.5 -14.5t14.5 -35.5zM700 250v-200 q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5h200q21 0 35.5 -14.5t14.5 -35.5zM1100 250v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5h200q21 0 35.5 -14.5 t14.5 -35.5z" />
44
+<glyph unicode="&#xe012;" d="M300 1050v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5h200q21 0 35.5 -14.5t14.5 -35.5zM1200 1050v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-700q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5h700 q21 0 35.5 -14.5t14.5 -35.5zM300 450v200q0 21 -14.5 35.5t-35.5 14.5h-200q-21 0 -35.5 -14.5t-14.5 -35.5v-200q0 -21 14.5 -35.5t35.5 -14.5h200q21 0 35.5 14.5t14.5 35.5zM1200 650v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-700q-21 0 -35.5 14.5t-14.5 35.5v200 q0 21 14.5 35.5t35.5 14.5h700q21 0 35.5 -14.5t14.5 -35.5zM300 250v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5h200q21 0 35.5 -14.5t14.5 -35.5zM1200 250v-200q0 -21 -14.5 -35.5t-35.5 -14.5h-700 q-21 0 -35.5 14.5t-14.5 35.5v200q0 21 14.5 35.5t35.5 14.5h700q21 0 35.5 -14.5t14.5 -35.5z" />
45
+<glyph unicode="&#xe013;" d="M448 34l818 820l-212 212l-607 -607l-206 207l-212 -212z" />
46
+<glyph unicode="&#xe014;" d="M882 106l-282 282l-282 -282l-212 212l282 282l-282 282l212 212l282 -282l282 282l212 -212l-282 -282l282 -282z" />
47
+<glyph unicode="&#xe015;" d="M913 432l300 -300q7 -8 7 -18t-7 -18l-109 -109q-8 -7 -18 -7t-18 7l-300 300q-119 -78 -261 -78q-200 0 -342 142t-142 342t142 342t342 142t342 -142t142 -342q0 -142 -78 -261zM507 363q137 0 233.5 96.5t96.5 233.5t-96.5 233.5t-233.5 96.5t-234 -97t-97 -233 t97 -233t234 -97zM600 800h100v-200h-100v-100h-200v100h-100v200h100v100h200v-100z" />
48
+<glyph unicode="&#xe016;" d="M913 432l300 -299q7 -7 7 -18t-7 -18l-109 -109q-8 -8 -18 -8t-18 8l-300 299q-120 -77 -261 -77q-200 0 -342 142t-142 342t142 342t342 142t342 -142t142 -342q0 -141 -78 -262zM176 694q0 -136 97 -233t234 -97t233.5 97t96.5 233t-96.5 233t-233.5 97t-234 -97 t-97 -233zM300 801v-200h400v200h-400z" />
49
+<glyph unicode="&#xe017;" d="M700 750v400q0 21 -14.5 35.5t-35.5 14.5h-100q-21 0 -35.5 -14.5t-14.5 -35.5v-400q0 -21 14.5 -35.5t35.5 -14.5h100q21 0 35.5 14.5t14.5 35.5zM800 975v166q167 -62 272 -210t105 -331q0 -118 -45.5 -224.5t-123 -184t-184 -123t-224.5 -45.5t-224.5 45.5t-184 123 t-123 184t-45.5 224.5q0 183 105 331t272 210v-166q-103 -55 -165 -155t-62 -220q0 -177 125 -302t302 -125t302 125t125 302q0 120 -62 220t-165 155z" />
50
+<glyph unicode="&#xe018;" d="M1200 1h-200v1200h200v-1200zM900 1h-200v800h200v-800zM600 1h-200v500h200v-500zM300 301h-200v-300h200v300z" />
51
+<glyph unicode="&#xe019;" d="M488 183l38 -151q40 -5 74 -5q27 0 74 5l38 151l6 2q46 13 93 39l5 3l134 -81q56 44 104 105l-80 134l3 5q24 44 39 93l1 6l152 38q5 40 5 74q0 28 -5 73l-152 38l-1 6q-16 51 -39 93l-3 5l80 134q-44 58 -104 105l-134 -81l-5 3q-45 25 -93 39l-6 1l-38 152q-40 5 -74 5 q-27 0 -74 -5l-38 -152l-5 -1q-50 -14 -94 -39l-5 -3l-133 81q-59 -47 -105 -105l80 -134l-3 -5q-25 -47 -38 -93l-2 -6l-151 -38q-6 -48 -6 -73q0 -33 6 -74l151 -38l2 -6q14 -49 38 -93l3 -5l-80 -134q45 -59 105 -105l133 81l5 -3q45 -26 94 -39zM600 815q89 0 152 -63 t63 -151q0 -89 -63 -152t-152 -63t-152 63t-63 152q0 88 63 151t152 63z" />
52
+<glyph unicode="&#xe020;" d="M900 1100h275q10 0 17.5 -7.5t7.5 -17.5v-50q0 -11 -7 -18t-18 -7h-1050q-11 0 -18 7t-7 18v50q0 10 7.5 17.5t17.5 7.5h275v100q0 41 29.5 70.5t70.5 29.5h300q41 0 70.5 -29.5t29.5 -70.5v-100zM800 1100v100h-300v-100h300zM200 900h900v-800q0 -41 -29.5 -71 t-70.5 -30h-700q-41 0 -70.5 30t-29.5 71v800zM300 100h100v700h-100v-700zM500 100h100v700h-100v-700zM700 100h100v700h-100v-700zM900 100h100v700h-100v-700z" />
53
+<glyph unicode="&#xe021;" d="M1301 601h-200v-600h-300v400h-300v-400h-300v600h-200l656 644z" />
54
+<glyph unicode="&#xe022;" d="M600 700h400v-675q0 -11 -7 -18t-18 -7h-850q-11 0 -18 7t-7 18v1150q0 11 7 18t18 7h475v-500zM1000 800h-300v300z" />
55
+<glyph unicode="&#xe023;" d="M600 1196q162 0 299 -80t217 -217t80 -299t-80 -299t-217 -217t-299 -80t-299 80t-217 217t-80 299t80 299t217 217t299 80zM600 1014q-171 0 -292.5 -121.5t-121.5 -292.5t121.5 -292.5t292.5 -121.5t292.5 121.5t121.5 292.5t-121.5 292.5t-292.5 121.5zM600 600h200 v-100h-300v400h100v-300z" />
56
+<glyph unicode="&#xe024;" d="M721 400h-242l-40 -400h-539l431 1200h209l-21 -300h162l-20 300h208l431 -1200h-538zM712 500l-27 300h-170l-27 -300h224z" />
57
+<glyph unicode="&#xe025;" d="M1100 400v-400h-1100v400h490l-290 300h200v500h300v-500h200l-290 -300h490zM988 300h-175v-100h175v100z" />
58
+<glyph unicode="&#xe026;" d="M600 1199q122 0 233 -47.5t191 -127.5t127.5 -191t47.5 -233t-47.5 -233t-127.5 -191t-191 -127.5t-233 -47.5t-233 47.5t-191 127.5t-127.5 191t-47.5 233t47.5 233t127.5 191t191 127.5t233 47.5zM600 1012q-170 0 -291 -121t-121 -291t121 -291t291 -121t291 121 t121 291t-121 291t-291 121zM700 600h150l-250 -300l-250 300h150v300h200v-300z" />
59
+<glyph unicode="&#xe027;" d="M600 1196q162 0 299 -80t217 -217t80 -299t-80 -299t-217 -217t-299 -80t-299 80t-217 217t-80 299t80 299t217 217t299 80zM600 1014q-171 0 -292.5 -121.5t-121.5 -292.5t121.5 -292.5t292.5 -121.5t292.5 121.5t121.5 292.5t-121.5 292.5t-292.5 121.5zM850 600h-150 v-300h-200v300h-150l250 300z" />
60
+<glyph unicode="&#xe028;" d="M0 500l200 700h800q199 -700 200 -700v-475q0 -11 -7 -18t-18 -7h-1150q-11 0 -18 7t-7 18v475zM903 1000h-606l-97 -500h200l50 -200h300l50 200h200z" />
61
+<glyph unicode="&#xe029;" d="M600 1196q162 0 299 -80t217 -217t80 -299t-80 -299t-217 -217t-299 -80t-299 80t-217 217t-80 299t80 299t217 217t299 80zM600 1014q-171 0 -292.5 -121.5t-121.5 -292.5q0 -172 121.5 -293t292.5 -121t292.5 121t121.5 293q0 171 -121.5 292.5t-292.5 121.5zM797 598 l-297 -201v401z" />
62
+<glyph unicode="&#xe030;" d="M1177 600h-150q0 -177 -125 -302t-302 -125t-302 125t-125 302t125 302t302 125q136 0 246 -81l-146 -146h400v400l-145 -145q-157 122 -355 122q-118 0 -224.5 -45.5t-184 -123t-123 -184t-45.5 -224.5t45.5 -224.5t123 -184t184 -123t224.5 -45.5t224.5 45.5t184 123 t123 184t45.5 224.5z" />
63
+<glyph unicode="&#xe031;" d="M700 800l147 147q-112 80 -247 80q-177 0 -302 -125t-125 -302h-150q0 118 45.5 224.5t123 184t184 123t224.5 45.5q198 0 355 -122l145 145v-400h-400zM500 400l-147 -147q112 -80 247 -80q177 0 302 125t125 302h150q0 -118 -45.5 -224.5t-123 -184t-184 -123 t-224.5 -45.5q-198 0 -355 122l-145 -145v400h400z" />
64
+<glyph unicode="&#xe032;" d="M100 1200v-1200h1100v1200h-1100zM1100 100h-900v900h900v-900zM400 800h-100v100h100v-100zM1000 800h-500v100h500v-100zM400 600h-100v100h100v-100zM1000 600h-500v100h500v-100zM400 400h-100v100h100v-100zM1000 400h-500v100h500v-100zM400 200h-100v100h100v-100 zM1000 300h-500v-100h500v100z" />
65
+<glyph unicode="&#xe034;" d="M200 0h-100v1100h100v-1100zM1100 600v500q-40 -81 -101.5 -115.5t-127.5 -29.5t-138 25t-139.5 40t-125.5 25t-103 -29.5t-65 -115.5v-500q60 60 127.5 84t127.5 17.5t122 -23t119 -30t110 -11t103 42t91 120.5z" />
66
+<glyph unicode="&#xe035;" d="M1200 275v300q0 116 -49.5 227t-131 192.5t-192.5 131t-227 49.5t-227 -49.5t-192.5 -131t-131 -192.5t-49.5 -227v-300q0 -11 7 -18t18 -7h50q11 0 18 7t7 18v300q0 127 70.5 231.5t184.5 161.5t245 57t245 -57t184.5 -161.5t70.5 -231.5v-300q0 -11 7 -18t18 -7h50 q11 0 18 7t7 18zM400 480v-460q0 -8 -6 -14t-14 -6h-160q-8 0 -14 6t-6 14v460q0 8 6 14t14 6h160q8 0 14 -6t6 -14zM1000 480v-460q0 -8 -6 -14t-14 -6h-160q-8 0 -14 6t-6 14v460q0 8 6 14t14 6h160q8 0 14 -6t6 -14z" />
67
+<glyph unicode="&#xe036;" d="M0 800v-400h300l300 -200v800l-300 -200h-300zM971 600l141 -141l-71 -71l-141 141l-141 -141l-71 71l141 141l-141 141l71 71l141 -141l141 141l71 -71z" />
68
+<glyph unicode="&#xe037;" d="M0 800v-400h300l300 -200v800l-300 -200h-300zM700 857l69 53q111 -135 111 -310q0 -169 -106 -302l-67 54q86 110 86 248q0 146 -93 257z" />
69
+<glyph unicode="&#xe038;" d="M974 186l6 8q142 178 142 405q0 230 -144 408l-6 8l-83 -64l7 -8q123 -151 123 -344q0 -189 -119 -339l-7 -8zM300 801l300 200v-800l-300 200h-300v400h300zM702 858l69 53q111 -135 111 -310q0 -170 -106 -303l-67 55q86 110 86 248q0 145 -93 257z" />
70
+<glyph unicode="&#xe039;" d="M100 700h400v100h100v100h-100v300h-500v-600h100v100zM1200 700v500h-600v-200h100v-300h200v-300h300v200h-200v100h200zM100 1100h300v-300h-300v300zM800 800v300h300v-300h-300zM200 900h100v100h-100v-100zM900 1000h100v-100h-100v100zM300 600h-100v-100h-200 v-500h500v500h-200v100zM900 200v-100h-200v100h-100v100h100v200h-200v100h300v-300h200v-100h-100zM400 400v-300h-300v300h300zM300 200h-100v100h100v-100zM1100 300h100v-100h-100v100zM600 100h100v-100h-100v100zM1200 100v-100h-300v100h300z" />
71
+<glyph unicode="&#xe040;" d="M100 1200h-100v-1000h100v1000zM300 200h-100v1000h100v-1000zM700 200h-200v1000h200v-1000zM900 200h-100v1000h100v-1000zM1200 1200v-1000h-200v1000h200zM400 100v-100h-300v100h300zM500 91h100v-91h-100v91zM700 91h100v-91h-100v91zM1100 91v-91h-200v91h200z " />
72
+<glyph unicode="&#xe041;" d="M1200 500l-500 -500l-699 700v475q0 10 7.5 17.5t17.5 7.5h474zM320 882q29 29 29 71t-29 71q-30 30 -71.5 30t-71.5 -30q-29 -29 -29 -71t29 -71q30 -30 71.5 -30t71.5 30z" />
73
+<glyph unicode="&#xe042;" d="M1201 500l-500 -500l-699 700v475q0 11 7 18t18 7h474zM1501 500l-500 -500l-50 50l450 450l-700 700h100zM320 882q30 29 30 71t-30 71q-29 30 -71 30t-71 -30q-30 -29 -30 -71t30 -71q29 -30 71 -30t71 30z" />
74
+<glyph unicode="&#xe043;" d="M1200 1200v-1000l-100 -100v1000h-750l-100 -100h750v-1000h-900v1025l175 175h925z" />
75
+<glyph unicode="&#xe045;" d="M947 829l-94 346q-2 11 -10 18t-18 7h-450q-10 0 -18 -7t-10 -18l-94 -346l40 -124h592zM1200 800v-700h-200v200h-800v-200h-200v700h200l100 -200h600l100 200h200zM881 176l38 -152q2 -10 -3.5 -17t-15.5 -7h-600q-10 0 -15.5 7t-3.5 17l38 152q2 10 11.5 17t19.5 7 h500q10 0 19.5 -7t11.5 -17z" />
76
+<glyph unicode="&#xe047;" d="M1200 0v66q-34 1 -74 43q-18 19 -33 42t-21 37l-6 13l-385 998h-93l-399 -1006q-24 -48 -52 -75q-12 -12 -33 -25t-36 -20l-15 -7v-66h365v66q-41 0 -72 11t-49 38t1 71l92 234h391l82 -222q16 -45 -5.5 -88.5t-74.5 -43.5v-66h417zM416 521l178 457l46 -140l116 -317 h-340z" />
77
+<glyph unicode="&#xe048;" d="M100 1199h471q120 0 213 -88t93 -228q0 -55 -11.5 -101.5t-28 -74t-33.5 -47.5t-28 -28l-12 -7q8 -3 21.5 -9t48 -31.5t60.5 -58t47.5 -91.5t21.5 -129q0 -84 -59 -156.5t-142 -111t-162 -38.5h-500v89q41 7 70.5 32.5t29.5 65.5v827q0 28 -1 39.5t-5.5 26t-15.5 21 t-29 14t-49 14.5v70zM400 1079v-379h139q76 0 130 61.5t54 138.5q0 82 -84 130.5t-239 48.5zM400 200h161q89 0 153 48.5t64 132.5q0 90 -62.5 154.5t-156.5 64.5h-159v-400z" />
78
+<glyph unicode="&#xe049;" d="M877 1200l2 -57q-33 -8 -62 -25.5t-46 -37t-29.5 -38t-17.5 -30.5l-5 -12l-128 -825q-10 -52 14 -82t95 -36v-57h-500v57q77 7 134.5 40.5t65.5 80.5l173 849q10 56 -10 74t-91 37q-6 1 -10.5 2.5t-9.5 2.5v57h425z" />
79
+<glyph unicode="&#xe050;" d="M1150 1200h150v-300h-50q0 29 -8 48.5t-18.5 30t-33.5 15t-39.5 5.5t-50.5 1h-200v-850l100 -50v-100h-400v100l100 50v850h-200q-34 0 -50.5 -1t-40 -5.5t-33.5 -15t-18.5 -30t-8.5 -48.5h-49v300h150h700zM100 1000v-800h75l-125 -167l-125 167h75v800h-75l125 167 l125 -167h-75z" />
80
+<glyph unicode="&#xe051;" d="M950 1201h150v-300h-50q0 29 -8 48.5t-18 30t-33.5 15t-40 5.5t-50.5 1h-200v-650l100 -50v-100h-400v100l100 50v650h-200q-34 0 -50.5 -1t-39.5 -5.5t-33.5 -15t-18.5 -30t-8 -48.5h-50v300h150h700zM200 101h800v75l167 -125l-167 -125v75h-800v-75l-167 125l167 125 v-75z" />
81
+<glyph unicode="&#xe052;" d="M700 950v100q0 21 -14.5 35.5t-35.5 14.5h-600q-21 0 -35.5 -14.5t-14.5 -35.5v-100q0 -20 14.5 -35t35.5 -15h600q21 0 35.5 15t14.5 35zM1100 650v100q0 21 -14.5 35.5t-35.5 14.5h-1000q-21 0 -35.5 -14.5t-14.5 -35.5v-100q0 -20 14.5 -35t35.5 -15h1000 q21 0 35.5 15t14.5 35zM900 350v100q0 21 -14.5 35.5t-35.5 14.5h-800q-21 0 -35.5 -14.5t-14.5 -35.5v-100q0 -20 14.5 -35t35.5 -15h800q21 0 35.5 15t14.5 35zM1200 50v100q0 21 -14.5 35.5t-35.5 14.5h-1100q-21 0 -35.5 -14.5t-14.5 -35.5v-100q0 -20 14.5 -35 t35.5 -15h1100q21 0 35.5 15t14.5 35z" />
82
+<glyph unicode="&#xe053;" d="M1000 950v100q0 21 -14.5 35.5t-35.5 14.5h-700q-21 0 -35.5 -14.5t-14.5 -35.5v-100q0 -20 14.5 -35t35.5 -15h700q21 0 35.5 15t14.5 35zM1200 650v100q0 21 -14.5 35.5t-35.5 14.5h-1100q-21 0 -35.5 -14.5t-14.5 -35.5v-100q0 -20 14.5 -35t35.5 -15h1100 q21 0 35.5 15t14.5 35zM1000 350v100q0 21 -14.5 35.5t-35.5 14.5h-700q-21 0 -35.5 -14.5t-14.5 -35.5v-100q0 -20 14.5 -35t35.5 -15h700q21 0 35.5 15t14.5 35zM1200 50v100q0 21 -14.5 35.5t-35.5 14.5h-1100q-21 0 -35.5 -14.5t-14.5 -35.5v-100q0 -20 14.5 -35 t35.5 -15h1100q21 0 35.5 15t14.5 35z" />
83
+<glyph unicode="&#xe054;" d="M500 950v100q0 21 14.5 35.5t35.5 14.5h600q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-600q-21 0 -35.5 15t-14.5 35zM100 650v100q0 21 14.5 35.5t35.5 14.5h1000q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-1000q-21 0 -35.5 15 t-14.5 35zM300 350v100q0 21 14.5 35.5t35.5 14.5h800q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-800q-21 0 -35.5 15t-14.5 35zM0 50v100q0 21 14.5 35.5t35.5 14.5h1100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-1100 q-21 0 -35.5 15t-14.5 35z" />
84
+<glyph unicode="&#xe055;" d="M0 950v100q0 21 14.5 35.5t35.5 14.5h1100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-1100q-21 0 -35.5 15t-14.5 35zM0 650v100q0 21 14.5 35.5t35.5 14.5h1100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-1100q-21 0 -35.5 15 t-14.5 35zM0 350v100q0 21 14.5 35.5t35.5 14.5h1100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-1100q-21 0 -35.5 15t-14.5 35zM0 50v100q0 21 14.5 35.5t35.5 14.5h1100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-1100 q-21 0 -35.5 15t-14.5 35z" />
85
+<glyph unicode="&#xe056;" d="M0 950v100q0 21 14.5 35.5t35.5 14.5h100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-100q-21 0 -35.5 15t-14.5 35zM300 950v100q0 21 14.5 35.5t35.5 14.5h800q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-800q-21 0 -35.5 15 t-14.5 35zM0 650v100q0 21 14.5 35.5t35.5 14.5h100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-100q-21 0 -35.5 15t-14.5 35zM300 650v100q0 21 14.5 35.5t35.5 14.5h800q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-800 q-21 0 -35.5 15t-14.5 35zM0 350v100q0 21 14.5 35.5t35.5 14.5h100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-100q-21 0 -35.5 15t-14.5 35zM300 350v100q0 21 14.5 35.5t35.5 14.5h800q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15 h-800q-21 0 -35.5 15t-14.5 35zM0 50v100q0 21 14.5 35.5t35.5 14.5h100q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15h-100q-21 0 -35.5 15t-14.5 35zM300 50v100q0 21 14.5 35.5t35.5 14.5h800q21 0 35.5 -14.5t14.5 -35.5v-100q0 -20 -14.5 -35t-35.5 -15 h-800q-21 0 -35.5 15t-14.5 35z" />
86
+<glyph unicode="&#xe057;" d="M400 1100h-100v-1100h100v1100zM700 950v100q0 21 -15 35.5t-35 14.5h-100q-21 0 -35.5 -14.5t-14.5 -35.5v-100q0 -20 14.5 -35t35.5 -15h100q20 0 35 15t15 35zM1100 650v100q0 21 -15 35.5t-35 14.5h-500q-21 0 -35.5 -14.5t-14.5 -35.5v-100q0 -20 14.5 -35t35.5 -15 h500q20 0 35 15t15 35zM100 425v75h-201v100h201v75l166 -125zM900 350v100q0 21 -15 35.5t-35 14.5h-300q-21 0 -35.5 -14.5t-14.5 -35.5v-100q0 -20 14.5 -35t35.5 -15h300q20 0 35 15t15 35zM1200 50v100q0 21 -15 35.5t-35 14.5h-600q-21 0 -35.5 -14.5t-14.5 -35.5 v-100q0 -20 14.5 -35t35.5 -15h600q20 0 35 15t15 35z" />
87
+<glyph unicode="&#xe058;" d="M201 950v100q0 21 -15 35.5t-35 14.5h-100q-21 0 -35.5 -14.5t-14.5 -35.5v-100q0 -20 14.5 -35t35.5 -15h100q20 0 35 15t15 35zM801 1100h100v-1100h-100v1100zM601 650v100q0 21 -15 35.5t-35 14.5h-500q-21 0 -35.5 -14.5t-14.5 -35.5v-100q0 -20 14.5 -35t35.5 -15 h500q20 0 35 15t15 35zM1101 425v75h200v100h-200v75l-167 -125zM401 350v100q0 21 -15 35.5t-35 14.5h-300q-21 0 -35.5 -14.5t-14.5 -35.5v-100q0 -20 14.5 -35t35.5 -15h300q20 0 35 15t15 35zM701 50v100q0 21 -15 35.5t-35 14.5h-600q-21 0 -35.5 -14.5t-14.5 -35.5 v-100q0 -20 14.5 -35t35.5 -15h600q20 0 35 15t15 35z" />
88
+<glyph unicode="&#xe059;" d="M900 925v-650q0 -31 -22 -53t-53 -22h-750q-31 0 -53 22t-22 53v650q0 31 22 53t53 22h750q31 0 53 -22t22 -53zM1200 300l-300 300l300 300v-600z" />
89
+<glyph unicode="&#xe060;" d="M1200 1056v-1012q0 -18 -12.5 -31t-31.5 -13h-1112q-18 0 -31 13t-13 31v1012q0 18 13 31t31 13h1112q19 0 31.5 -13t12.5 -31zM1100 1000h-1000v-737l247 182l298 -131l-74 156l293 318l236 -288v500zM476 750q0 -56 -39 -95t-95 -39t-95 39t-39 95t39 95t95 39t95 -39 t39 -95z" />
90
+<glyph unicode="&#xe062;" d="M600 1213q123 0 227 -63t164.5 -169.5t60.5 -229.5t-73 -272q-73 -114 -166.5 -237t-150.5 -189l-57 -66q-10 9 -27 26t-66.5 70.5t-96 109t-104 135.5t-100.5 155q-63 139 -63 262q0 124 60.5 231.5t165 172t226.5 64.5zM599 514q107 0 182.5 75.5t75.5 182.5t-75.5 182 t-182.5 75t-182 -75.5t-75 -181.5q0 -107 75.5 -182.5t181.5 -75.5z" />
91
+<glyph unicode="&#xe063;" d="M600 1199q122 0 233 -47.5t191 -127.5t127.5 -191t47.5 -233t-47.5 -233t-127.5 -191t-191 -127.5t-233 -47.5t-233 47.5t-191 127.5t-127.5 191t-47.5 233t47.5 233t127.5 191t191 127.5t233 47.5zM600 173v854q-176 0 -301.5 -125t-125.5 -302t125.5 -302t301.5 -125z " />
92
+<glyph unicode="&#xe064;" d="M554 1295q21 -71 57.5 -142.5t76 -130.5t83 -118.5t82 -117t70 -116t50 -125.5t18.5 -136q0 -89 -39 -165.5t-102 -126.5t-140 -79.5t-156 -33.5q-114 6 -211.5 53t-161.5 138.5t-64 210.5q0 94 34 186t88.5 172.5t112 159t115 177t87.5 194.5zM455 296q-7 6 -18 17 t-34 48t-33 77q-15 73 -14 143.5t10 122.5l9 51q-92 -110 -119.5 -185t-12.5 -156q14 -82 59.5 -136t136.5 -80z" />
93
+<glyph unicode="&#xe065;" d="M1108 902l113 113l-21 85l-92 28l-113 -113zM1100 625v-225q0 -165 -117.5 -282.5t-282.5 -117.5h-300q-165 0 -282.5 117.5t-117.5 282.5v300q0 165 117.5 282.5t282.5 117.5q366 -6 397 -14l-186 -186h-311q-41 0 -70.5 -29.5t-29.5 -70.5v-500q0 -41 29.5 -70.5 t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5v125zM436 341l161 50l412 412l-114 113l-405 -405z" />
94
+<glyph unicode="&#xe066;" d="M1100 453v-53q0 -165 -117.5 -282.5t-282.5 -117.5h-300q-165 0 -282.5 117.5t-117.5 282.5v300q0 165 117.5 282.5t282.5 117.5h261l2 -80q-133 -32 -218 -120h-145q-41 0 -70.5 -29.5t-29.5 -70.5v-500q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5z M813 431l360 324l-359 318v-216q-7 0 -19 -1t-48 -8t-69.5 -18.5t-76.5 -37t-76.5 -59t-62 -88t-39.5 -121.5q30 38 81.5 64t103 35.5t99 14t77.5 3.5l29 -1v-209z" />
95
+<glyph unicode="&#xe067;" d="M1100 569v-169q0 -165 -117.5 -282.5t-282.5 -117.5h-300q-165 0 -282.5 117.5t-117.5 282.5v300q0 165 117.5 282.5t282.5 117.5h300q60 0 127 -23l-178 -177h-349q-41 0 -70.5 -29.5t-29.5 -70.5v-500q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5v69z M625 348l566 567l-136 137l-430 -431l-147 147l-136 -136z" />
96
+<glyph unicode="&#xe068;" d="M900 303v198h-200v-200h195l-295 -300l-300 300h200v200h-200v-198l-300 300l300 296v-198h200v200h-200l300 300l295 -300h-195v-200h200v198l300 -296z" />
97
+<glyph unicode="&#xe069;" d="M900 0l-500 488v-438q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v1000q0 21 14.5 35.5t35.5 14.5h100q21 0 35.5 -14.5t14.5 -35.5v-437l500 487v-1100z" />
98
+<glyph unicode="&#xe070;" d="M1200 0l-500 488v-488l-500 488v-438q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v1000q0 21 14.5 35.5t35.5 14.5h100q21 0 35.5 -14.5t14.5 -35.5v-437l500 487v-487l500 487v-1100z" />
99
+<glyph unicode="&#xe071;" d="M1200 0l-500 488v-488l-564 550l564 550v-487l500 487v-1100z" />
100
+<glyph unicode="&#xe072;" d="M1100 550l-900 550v-1100z" />
101
+<glyph unicode="&#xe073;" d="M500 150v800q0 21 -14.5 35.5t-35.5 14.5h-200q-21 0 -35.5 -14.5t-14.5 -35.5v-800q0 -21 14.5 -35.5t35.5 -14.5h200q21 0 35.5 14.5t14.5 35.5zM900 150v800q0 21 -14.5 35.5t-35.5 14.5h-200q-21 0 -35.5 -14.5t-14.5 -35.5v-800q0 -21 14.5 -35.5t35.5 -14.5h200 q21 0 35.5 14.5t14.5 35.5z" />
102
+<glyph unicode="&#xe074;" d="M1100 150v800q0 21 -14.5 35.5t-35.5 14.5h-800q-21 0 -35.5 -14.5t-14.5 -35.5v-800q0 -20 14.5 -35t35.5 -15h800q21 0 35.5 15t14.5 35z" />
103
+<glyph unicode="&#xe075;" d="M500 0v488l-500 -488v1100l500 -487v487l564 -550z" />
104
+<glyph unicode="&#xe076;" d="M1050 1100h100q21 0 35.5 -14.5t14.5 -35.5v-1000q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v438l-500 -488v488l-500 -488v1100l500 -487v487l500 -487v437q0 21 14.5 35.5t35.5 14.5z" />
105
+<glyph unicode="&#xe077;" d="M850 1100h100q21 0 35.5 -14.5t14.5 -35.5v-1000q0 -21 -14.5 -35.5t-35.5 -14.5h-100q-21 0 -35.5 14.5t-14.5 35.5v438l-500 -488v1100l500 -487v437q0 21 14.5 35.5t35.5 14.5z" />
106
+<glyph unicode="&#xe078;" d="M650 1064l-550 -564h1100zM1200 350v-100q0 -21 -14.5 -35.5t-35.5 -14.5h-1000q-21 0 -35.5 14.5t-14.5 35.5v100q0 21 14.5 35.5t35.5 14.5h1000q21 0 35.5 -14.5t14.5 -35.5z" />
107
+<glyph unicode="&#xe079;" d="M777 7l240 240l-353 353l353 353l-240 240l-592 -594z" />
108
+<glyph unicode="&#xe080;" d="M513 -46l-241 240l353 353l-353 353l241 240l572 -571l21 -22l-1 -1v-1z" />
109
+<glyph unicode="&#xe081;" d="M600 1197q162 0 299.5 -80t217.5 -217.5t80 -299.5t-80 -299.5t-217.5 -217.5t-299.5 -80t-299.5 80t-217.5 217.5t-80 299.5t80 299.5t217.5 217.5t299.5 80zM500 900v-200h-200v-200h200v-200h200v200h200v200h-200v200h-200z" />
110
+<glyph unicode="&#xe082;" d="M600 1197q162 0 299.5 -80t217.5 -217.5t80 -299.5t-80 -299.5t-217.5 -217.5t-299.5 -80t-299.5 80t-217.5 217.5t-80 299.5t80 299.5t217.5 217.5t299.5 80zM300 700v-200h600v200h-600z" />
111
+<glyph unicode="&#xe083;" d="M600 1197q162 0 299.5 -80t217.5 -217.5t80 -299.5t-80 -299.5t-217.5 -217.5t-299.5 -80t-299.5 80t-217.5 217.5t-80 299.5t80 299.5t217.5 217.5t299.5 80zM247 741l141 -141l-142 -141l213 -213l141 142l141 -142l213 213l-142 141l142 141l-213 212l-141 -141 l-141 142z" />
112
+<glyph unicode="&#xe084;" d="M600 1197q162 0 299.5 -80t217.5 -217.5t80 -299.5t-80 -299.5t-217.5 -217.5t-299.5 -80t-299.5 80t-217.5 217.5t-80 299.5t80 299.5t217.5 217.5t299.5 80zM546 623l-102 102l-174 -174l276 -277l411 411l-175 174z" />
113
+<glyph unicode="&#xe085;" d="M600 1197q162 0 299.5 -80t217.5 -217.5t80 -299.5t-80 -299.5t-217.5 -217.5t-299.5 -80t-299.5 80t-217.5 217.5t-80 299.5t80 299.5t217.5 217.5t299.5 80zM500 500h200q5 3 14 8t31.5 25.5t39.5 45.5t31 69t14 94q0 51 -17.5 89t-42 58t-58.5 32t-58.5 15t-51.5 3 q-105 0 -172 -56t-67 -183h144q4 0 11.5 -1t11 -1t6.5 3t3 9t1 11t3.5 8.5t3.5 6t5.5 4t6.5 2.5t9 1.5t9 0.5h11.5h12.5q19 0 30 -10t11 -26q0 -22 -4 -28t-27 -22q-5 -1 -12.5 -3t-27 -13.5t-34 -27t-26.5 -46t-11 -68.5zM500 400v-100h200v100h-200z" />
114
+<glyph unicode="&#xe086;" d="M600 1197q162 0 299.5 -80t217.5 -217.5t80 -299.5t-80 -299.5t-217.5 -217.5t-299.5 -80t-299.5 80t-217.5 217.5t-80 299.5t80 299.5t217.5 217.5t299.5 80zM500 900v-100h200v100h-200zM400 700v-100h100v-200h-100v-100h400v100h-100v300h-300z" />
115
+<glyph unicode="&#xe087;" d="M1200 700v-200h-203q-25 -102 -116.5 -186t-180.5 -117v-197h-200v197q-140 27 -208 102.5t-98 200.5h-194v200h194q15 60 36 104.5t55.5 86t88 69t126.5 40.5v200h200v-200q54 -20 113 -60t112.5 -105.5t71.5 -134.5h203zM700 500v-206q149 48 201 206h-201v200h200 q-25 74 -76 127.5t-124 76.5v-204h-200v203q-75 -24 -130 -77.5t-79 -125.5h209v-200h-210q24 -73 79.5 -127.5t130.5 -78.5v206h200z" />
116
+<glyph unicode="&#xe088;" d="M600 1196q162 0 299 -80t217 -217t80 -299t-80 -299t-217 -217t-299 -80t-299 80t-217 217t-80 299t80 299t217 217t299 80zM600 1014q-171 0 -292.5 -121.5t-121.5 -292.5t121.5 -292.5t292.5 -121.5t292.5 121.5t121.5 292.5t-121.5 292.5t-292.5 121.5zM844 735 l-135 -135l135 -135l-109 -109l-135 135l-135 -135l-109 109l135 135l-135 135l109 109l135 -135l135 135z" />
117
+<glyph unicode="&#xe089;" d="M600 1196q162 0 299 -80t217 -217t80 -299t-80 -299t-217 -217t-299 -80t-299 80t-217 217t-80 299t80 299t217 217t299 80zM600 1014q-171 0 -292.5 -121.5t-121.5 -292.5t121.5 -292.5t292.5 -121.5t292.5 121.5t121.5 292.5t-121.5 292.5t-292.5 121.5zM896 654 l-346 -345l-228 228l141 141l87 -87l204 205z" />
118
+<glyph unicode="&#xe090;" d="M600 1196q162 0 299 -80t217 -217t80 -299t-80 -299t-217 -217t-299 -80t-299 80t-217 217t-80 299t80 299t217 217t299 80zM248 385l568 567q-100 62 -216 62q-171 0 -292.5 -121.5t-121.5 -292.5q0 -115 62 -215zM955 809l-564 -564q97 -59 209 -59q171 0 292.5 121.5 t121.5 292.5q0 112 -59 209z" />
119
+<glyph unicode="&#xe091;" d="M1200 400h-600v-301l-600 448l600 453v-300h600v-300z" />
120
+<glyph unicode="&#xe092;" d="M600 400h-600v300h600v300l600 -453l-600 -448v301z" />
121
+<glyph unicode="&#xe093;" d="M1098 600h-298v-600h-300v600h-296l450 600z" />
122
+<glyph unicode="&#xe094;" d="M998 600l-449 -600l-445 600h296v600h300v-600h298z" />
123
+<glyph unicode="&#xe095;" d="M600 199v301q-95 -2 -183 -20t-170 -52t-147 -92.5t-100 -135.5q6 132 41 238.5t103.5 193t184 138t271.5 59.5v271l600 -453z" />
124
+<glyph unicode="&#xe096;" d="M1200 1200h-400l129 -129l-294 -294l142 -142l294 294l129 -129v400zM565 423l-294 -294l129 -129h-400v400l129 -129l294 294z" />
125
+<glyph unicode="&#xe097;" d="M871 730l129 -130h-400v400l129 -129l295 295l142 -141zM200 600h400v-400l-129 130l-295 -295l-142 141l295 295z" />
126
+<glyph unicode="&#xe101;" d="M600 1177q118 0 224.5 -45.5t184 -123t123 -184t45.5 -224.5t-45.5 -224.5t-123 -184t-184 -123t-224.5 -45.5t-224.5 45.5t-184 123t-123 184t-45.5 224.5t45.5 224.5t123 184t184 123t224.5 45.5zM686 549l58 302q4 20 -8 34.5t-33 14.5h-207q-20 0 -32 -14.5t-8 -34.5 l58 -302q4 -20 21.5 -34.5t37.5 -14.5h54q20 0 37.5 14.5t21.5 34.5zM700 400h-200v-100h200v100z" />
127
+<glyph unicode="&#xe102;" d="M1200 900h-111v6t-1 15t-3 18l-34 172q-11 39 -41.5 63t-69.5 24q-32 0 -61 -17l-239 -144q-22 -13 -40 -35q-19 24 -40 36l-238 144q-33 18 -62 18q-39 0 -69.5 -23t-40.5 -61l-35 -177q-2 -8 -3 -18t-1 -15v-6h-111v-100h100v-200h400v300h200v-300h400v200h100v100z M731 900l202 197q5 -12 12 -32.5t23 -64t25 -72t7 -28.5h-269zM481 900h-281q-3 0 14 48t35 96l18 47zM100 0h400v400h-400v-400zM700 400h400v-400h-400v400z" />
128
+<glyph unicode="&#xe103;" d="M0 121l216 193q-9 53 -13 83t-5.5 94t9 113t38.5 114t74 124q47 60 99.5 102.5t103 68t127.5 48t145.5 37.5t184.5 43.5t220 58.5q0 -189 -22 -343t-59 -258t-89 -181.5t-108.5 -120t-122 -68t-125.5 -30t-121.5 -1.5t-107.5 12.5t-87.5 17t-56.5 7.5l-99 -55l-201 -202 v143zM692 611q70 38 118.5 69.5t102 79t99 111.5t86.5 148q22 50 24 60t-6 19q-7 5 -17 5t-26.5 -14.5t-33.5 -39.5q-35 -51 -113.5 -108.5t-139.5 -89.5l-61 -32q-369 -197 -458 -401q-48 -111 -28.5 -117.5t86.5 76.5q55 66 367 234z" />
129
+<glyph unicode="&#xe105;" d="M1261 600l-26 -40q-6 -10 -20 -30t-49 -63.5t-74.5 -85.5t-97 -90t-116.5 -83.5t-132.5 -59t-145.5 -23.5t-145.5 23.5t-132.5 59t-116.5 83.5t-97 90t-74.5 85.5t-49 63.5t-20 30l-26 40l26 40q6 10 20 30t49 63.5t74.5 85.5t97 90t116.5 83.5t132.5 59t145.5 23.5 t145.5 -23.5t132.5 -59t116.5 -83.5t97 -90t74.5 -85.5t49 -63.5t20 -30zM600 240q64 0 123.5 20t100.5 45.5t85.5 71.5t66.5 75.5t58 81.5t47 66q-1 1 -28.5 37.5t-42 55t-43.5 53t-57.5 63.5t-58.5 54q49 -74 49 -163q0 -124 -88 -212t-212 -88t-212 88t-88 212 q0 85 46 158q-102 -87 -226 -258q7 -10 40.5 -58t56 -78.5t68 -77.5t87.5 -75t103 -49.5t125 -21.5zM484 762l-107 -106q49 -124 154 -191l105 105q-37 24 -75 72t-57 84z" />
130
+<glyph unicode="&#xe106;" d="M906 1200l-314 -1200h-148l37 143q-82 21 -165 71.5t-140 102t-109.5 112t-72 88.5t-29.5 43l-26 40l26 40q6 10 20 30t49 63.5t74.5 85.5t97 90t116.5 83.5t132.5 59t145.5 23.5q61 0 121 -17l37 142h148zM1261 600l-26 -40q-7 -12 -25.5 -38t-63.5 -79.5t-95.5 -102.5 t-124 -100t-146.5 -79l38 145q22 15 44.5 34t46 44t40.5 44t41 50.5t33.5 43.5t33 44t24.5 34q-97 127 -140 175l39 146q67 -54 131.5 -125.5t87.5 -103.5t36 -52zM513 264l37 141q-107 18 -178.5 101.5t-71.5 193.5q0 85 46 158q-102 -87 -226 -258q210 -282 393 -336z M484 762l-107 -106q49 -124 154 -191l47 47l23 87q-30 28 -59 69t-44 68z" />
131
+<glyph unicode="&#xe107;" d="M-47 0h1294q37 0 50.5 35.5t-7.5 67.5l-642 1056q-20 33 -48 36t-48 -29l-642 -1066q-21 -32 -7.5 -66t50.5 -34zM700 200v100h-200v-100h-345l445 723l445 -723h-345zM700 700h-200v-100l100 -300l100 300v100z" />
132
+<glyph unicode="&#xe108;" d="M800 711l363 -325q15 -14 26 -38.5t11 -44.5v-41q0 -20 -12 -26.5t-29 5.5l-359 249v-263q100 -91 100 -113v-64q0 -21 -13 -29t-32 1l-94 78h-222l-94 -78q-19 -9 -32 -1t-13 29v64q0 22 100 113v263l-359 -249q-17 -12 -29 -5.5t-12 26.5v41q0 20 11 44.5t26 38.5 l363 325v339q0 62 44 106t106 44t106 -44t44 -106v-339z" />
133
+<glyph unicode="&#xe110;" d="M941 800l-600 -600h-341v200h259l600 600h241v198l300 -295l-300 -300v197h-159zM381 678l141 142l-181 180h-341v-200h259zM1100 598l300 -295l-300 -300v197h-241l-181 181l141 142l122 -123h159v198z" />
134
+<glyph unicode="&#xe111;" d="M100 1100h1000q41 0 70.5 -29.5t29.5 -70.5v-600q0 -41 -29.5 -70.5t-70.5 -29.5h-596l-304 -300v300h-100q-41 0 -70.5 29.5t-29.5 70.5v600q0 41 29.5 70.5t70.5 29.5z" />
135
+<glyph unicode="&#xe112;" d="M400 900h-300v300h300v-300zM1100 900h-300v300h300v-300zM1100 800v-200q0 -42 -3 -83t-15 -104t-31.5 -116t-58 -109.5t-89 -96.5t-129 -65.5t-174.5 -25.5t-174.5 25.5t-129 65.5t-89 96.5t-58 109.5t-31.5 116t-15 104t-3 83v200h300v-250q0 -113 6 -145 q17 -92 102 -117q39 -11 92 -11q37 0 66.5 5.5t50 15.5t36 24t24 31.5t14 37.5t7 42t2.5 45t0 47v25v250h300z" />
136
+<glyph unicode="&#xe113;" d="M902 184l226 227l-578 579l-580 -579l227 -227l352 353z" />
137
+<glyph unicode="&#xe114;" d="M650 218l578 579l-226 227l-353 -353l-352 353l-227 -227z" />
138
+<glyph unicode="&#xe115;" d="M1198 400v600h-796l215 -200h381v-400h-198l299 -283l299 283h-200zM-198 700l299 283l300 -283h-203v-400h385l215 -200h-800v600h-196z" />
139
+<glyph unicode="&#xe116;" d="M1050 1200h94q20 0 35 -14.5t15 -35.5t-15 -35.5t-35 -14.5h-54l-201 -961q-2 -4 -6 -10.5t-19 -17.5t-33 -11h-31v-50q0 -20 -14.5 -35t-35.5 -15t-35.5 15t-14.5 35v50h-300v-50q0 -20 -14.5 -35t-35.5 -15t-35.5 15t-14.5 35v50h-50q-21 0 -35.5 15t-14.5 35 q0 21 14.5 35.5t35.5 14.5h535l48 200h-633q-32 0 -54.5 21t-27.5 43l-100 475q-5 24 10 42q14 19 39 19h896l38 162q5 17 18.5 27.5t30.5 10.5z" />
140
+<glyph unicode="&#xe117;" d="M1200 1000v-100h-1200v100h200q0 41 29.5 70.5t70.5 29.5h300q41 0 70.5 -29.5t29.5 -70.5h500zM0 800h1200v-800h-1200v800z" />
141
+<glyph unicode="&#xe118;" d="M201 800l-200 -400v600h200q0 41 29.5 70.5t70.5 29.5h300q41 0 70.5 -29.5t29.5 -70.5h500v-200h-1000zM1501 700l-300 -700h-1200l300 700h1200z" />
142
+<glyph unicode="&#xe119;" d="M302 300h198v600h-198l298 300l298 -300h-198v-600h198l-298 -300z" />
143
+<glyph unicode="&#xe120;" d="M900 303v197h-600v-197l-300 297l300 298v-198h600v198l300 -298z" />
144
+<glyph unicode="&#xe121;" d="M31 400l172 739q5 22 23 41.5t38 19.5h672q19 0 37.5 -22.5t23.5 -45.5l172 -732h-1138zM100 300h1000q41 0 70.5 -29.5t29.5 -70.5v-100q0 -41 -29.5 -70.5t-70.5 -29.5h-1000q-41 0 -70.5 29.5t-29.5 70.5v100q0 41 29.5 70.5t70.5 29.5zM900 200h-100v-100h100v100z M1100 200h-100v-100h100v100z" />
145
+<glyph unicode="&#xe122;" d="M1100 200v850q0 21 14.5 35.5t35.5 14.5q20 0 35 -14.5t15 -35.5v-850q0 -20 -15 -35t-35 -15q-21 0 -35.5 15t-14.5 35zM325 800l675 250v-850l-675 200h-38l47 -276q2 -12 -3 -17.5t-11 -6t-21 -0.5h-8h-83q-20 0 -34.5 14t-18.5 35q-56 337 -56 351v250v5 q0 13 0.5 18.5t2.5 13t8 10.5t15 3h200zM-101 600v50q0 24 25 49t50 38l25 13v-250l-11 5.5t-24 14t-30 21.5t-24 27.5t-11 31.5z" />
146
+<glyph unicode="&#xe124;" d="M445 1180l-45 -233l-224 78l78 -225l-233 -44l179 -156l-179 -155l233 -45l-78 -224l224 78l45 -233l155 179l155 -179l45 233l224 -78l-78 224l234 45l-180 155l180 156l-234 44l78 225l-224 -78l-45 233l-155 -180z" />
147
+<glyph unicode="&#xe125;" d="M700 1200h-50q-27 0 -51 -20t-38 -48l-96 -198l-145 -196q-20 -26 -20 -63v-400q0 -75 100 -75h61q123 -100 139 -100h250q46 0 83 57l238 344q29 31 29 74v100q0 44 -30.5 84.5t-69.5 40.5h-328q28 118 28 125v150q0 44 -30.5 84.5t-69.5 40.5zM700 925l-50 -225h450 v-125l-250 -375h-214l-136 100h-100v375l150 212l100 213h50v-175zM0 800v-600h200v600h-200z" />
148
+<glyph unicode="&#xe126;" d="M700 0h-50q-27 0 -51 20t-38 48l-96 198l-145 196q-20 26 -20 63v400q0 75 100 75h61q123 100 139 100h250q46 0 83 -57l238 -344q29 -31 29 -74v-100q0 -44 -30.5 -84.5t-69.5 -40.5h-328q28 -118 28 -125v-150q0 -44 -30.5 -84.5t-69.5 -40.5zM200 400h-200v600h200 v-600zM700 275l-50 225h450v125l-250 375h-214l-136 -100h-100v-375l150 -212l100 -213h50v175z" />
149
+<glyph unicode="&#xe127;" d="M364 873l362 230q14 6 25 6q17 0 29 -12l109 -112q14 -14 14 -34q0 -18 -11 -32l-85 -121h302q85 0 138.5 -38t53.5 -110t-54.5 -111t-138.5 -39h-107l-130 -339q-7 -22 -20.5 -41.5t-28.5 -19.5h-341q-7 0 -90 81t-83 94v525q0 17 14 35.5t28 28.5zM408 792v-503 l100 -89h293l131 339q6 21 19.5 41t28.5 20h203q16 0 25 15t9 36q0 20 -9 34.5t-25 14.5h-457h-6.5h-7.5t-6.5 0.5t-6 1t-5 1.5t-5.5 2.5t-4 4t-4 5.5q-5 12 -5 20q0 14 10 27l147 183l-86 83zM208 200h-200v600h200v-600z" />
150
+<glyph unicode="&#xe128;" d="M475 1104l365 -230q7 -4 16.5 -10.5t26 -26t16.5 -36.5v-526q0 -13 -85.5 -93.5t-93.5 -80.5h-342q-15 0 -28.5 20t-19.5 41l-131 339h-106q-84 0 -139 39t-55 111t54 110t139 37h302l-85 121q-11 16 -11 32q0 21 14 34l109 113q13 12 29 12q11 0 25 -6zM370 946 l145 -184q10 -11 10 -26q0 -11 -5 -20q-1 -3 -3.5 -5.5l-4 -4t-5 -2.5t-5.5 -1.5t-6.5 -1t-6.5 -0.5h-7.5h-6.5h-476v-100h222q15 0 28.5 -20.5t19.5 -40.5l131 -339h293l106 89v502l-342 237zM1199 201h-200v600h200v-600z" />
151
+<glyph unicode="&#xe129;" d="M1100 473v342q0 15 -20 28.5t-41 19.5l-339 131v106q0 84 -39 139t-111 55t-110 -53.5t-38 -138.5v-302l-121 84q-15 12 -33.5 11.5t-32.5 -13.5l-112 -110q-22 -22 -6 -53l230 -363q4 -6 10.5 -15.5t26 -25t36.5 -15.5h525q13 0 94 83t81 90zM911 400h-503l-236 339 l83 86l183 -146q22 -18 47 -5q3 1 5.5 3.5l4 4t2.5 5t1.5 5.5t1 6.5t0.5 6v7.5v7v456q0 22 25 31t50 -0.5t25 -30.5v-202q0 -16 20 -29.5t41 -19.5l339 -130v-294zM1000 200v-200h-600v200h600z" />
152
+<glyph unicode="&#xe130;" d="M305 1104v200h600v-200h-600zM605 310l339 131q20 6 40.5 19.5t20.5 28.5v342q0 7 -81 90t-94 83h-525q-17 0 -35.5 -14t-28.5 -28l-10 -15l-230 -362q-15 -31 7 -53l112 -110q13 -13 32 -13.5t34 10.5l121 85l-1 -302q0 -84 38.5 -138t110.5 -54t111 55t39 139v106z M905 804v-294l-340 -130q-20 -6 -40 -20t-20 -29v-202q0 -22 -25 -31t-50 0t-25 31v456v14.5t-1.5 11.5t-5 12t-9.5 7q-24 13 -46 -5l-184 -146l-83 86l237 339h503z" />
153
+<glyph unicode="&#xe131;" d="M603 1195q162 0 299.5 -80t217.5 -218t80 -300t-80 -299.5t-217.5 -217.5t-299.5 -80t-300 80t-218 217.5t-80 299.5q0 122 47.5 232.5t127.5 190.5t190.5 127.5t232.5 47.5zM598 701h-298v-201h300l-2 -194l402 294l-402 298v-197z" />
154
+<glyph unicode="&#xe132;" d="M597 1195q122 0 232.5 -47.5t190.5 -127.5t127.5 -190.5t47.5 -232.5q0 -162 -80 -299.5t-218 -217.5t-300 -80t-299.5 80t-217.5 217.5t-80 299.5q0 122 47.5 232.5t127.5 190.5t190.5 127.5t231.5 47.5zM200 600l400 -294v194h302v201h-300v197z" />
155
+<glyph unicode="&#xe133;" d="M603 1195q121 0 231.5 -47.5t190.5 -127.5t127.5 -190.5t47.5 -232.5q0 -162 -80 -299.5t-217.5 -217.5t-299.5 -80t-300 80t-218 217.5t-80 299.5q0 122 47.5 232.5t127.5 190.5t190.5 127.5t232.5 47.5zM300 600h200v-300h200v300h200l-300 400z" />
156
+<glyph unicode="&#xe134;" d="M603 1195q121 0 231.5 -47.5t190.5 -127.5t127.5 -190.5t47.5 -232.5q0 -162 -80 -299.5t-217.5 -217.5t-299.5 -80t-300 80t-218 217.5t-80 299.5q0 122 47.5 232.5t127.5 190.5t190.5 127.5t232.5 47.5zM500 900v-300h-200l300 -400l300 400h-200v300h-200z" />
157
+<glyph unicode="&#xe135;" d="M603 1195q121 0 231.5 -47.5t190.5 -127.5t127.5 -190.5t47.5 -232.5q0 -162 -80 -299.5t-217.5 -217.5t-299.5 -80t-300 80t-218 217.5t-80 299.5q0 122 47.5 232.5t127.5 190.5t190.5 127.5t232.5 47.5zM627 1101q-15 -12 -36.5 -21t-34.5 -12t-44 -8t-39 -6 q-15 -3 -45.5 0.5t-45.5 -2.5q-21 -7 -52 -26.5t-34 -34.5q-3 -11 6.5 -22.5t8.5 -18.5q-3 -34 -27.5 -90.5t-29.5 -79.5q-8 -33 5.5 -92.5t7.5 -87.5q0 -9 17 -44t16 -60q12 0 23 -5.5t23 -15t20 -13.5q24 -12 108 -42q22 -8 53 -31.5t59.5 -38.5t57.5 -11q8 -18 -15 -55 t-20 -57q42 -71 87 -80q0 -6 -3 -15.5t-3.5 -14.5t4.5 -17q102 -2 221 112q30 29 47 47t34.5 49t20.5 62q-14 9 -37 9.5t-36 7.5q-14 7 -49 15t-52 19q-9 0 -39.5 -0.5t-46.5 -1.5t-39 -6.5t-39 -16.5q-50 -35 -66 -12q-4 2 -3.5 25.5t0.5 25.5q-6 13 -26.5 17t-24.5 7 q2 22 -2 41t-16.5 28t-38.5 -20q-23 -25 -42 4q-19 28 -8 58q6 16 22 22q6 -1 26 -1.5t33.5 -4t19.5 -13.5q12 -19 32 -37.5t34 -27.5l14 -8q0 3 9.5 39.5t5.5 57.5q-4 23 14.5 44.5t22.5 31.5q5 14 10 35t8.5 31t15.5 22.5t34 21.5q-6 18 10 37q8 0 23.5 -1.5t24.5 -1.5 t20.5 4.5t20.5 15.5q-10 23 -30.5 42.5t-38 30t-49 26.5t-43.5 23q11 41 1 44q31 -13 58.5 -14.5t39.5 3.5l11 4q6 36 -17 53.5t-64 28.5t-56 23q-19 -3 -37 0zM613 994q0 -18 8 -42.5t16.5 -44t9.5 -23.5q-9 2 -31 5t-36 5t-32 8t-30 14q3 12 16 30t16 25q10 -10 18.5 -10 t14 6t14.5 14.5t16 12.5z" />
158
+<glyph unicode="&#xe137;" horiz-adv-x="1220" d="M100 1196h1000q41 0 70.5 -29.5t29.5 -70.5v-100q0 -41 -29.5 -70.5t-70.5 -29.5h-1000q-41 0 -70.5 29.5t-29.5 70.5v100q0 41 29.5 70.5t70.5 29.5zM1100 1096h-200v-100h200v100zM100 796h1000q41 0 70.5 -29.5t29.5 -70.5v-100q0 -41 -29.5 -70.5t-70.5 -29.5h-1000 q-41 0 -70.5 29.5t-29.5 70.5v100q0 41 29.5 70.5t70.5 29.5zM1100 696h-500v-100h500v100zM100 396h1000q41 0 70.5 -29.5t29.5 -70.5v-100q0 -41 -29.5 -70.5t-70.5 -29.5h-1000q-41 0 -70.5 29.5t-29.5 70.5v100q0 41 29.5 70.5t70.5 29.5zM1100 296h-300v-100h300v100z " />
159
+<glyph unicode="&#xe138;" d="M1100 1200v-100h-1000v100h1000zM150 1000h900l-350 -500v-300l-200 -200v500z" />
160
+<glyph unicode="&#xe140;" d="M329 729l142 142l-200 200l129 129h-400v-400l129 129zM1200 1200v-400l-129 129l-200 -200l-142 142l200 200l-129 129h400zM271 129l129 -129h-400v400l129 -129l200 200l142 -142zM1071 271l129 129v-400h-400l129 129l-200 200l142 142z" />
161
+<glyph unicode="&#xe141;" d="M596 1192q162 0 299 -80t217 -217t80 -299t-80 -299t-217 -217t-299 -80t-299 80t-217 217t-80 299t80 299t217 217t299 80zM596 1010q-171 0 -292.5 -121.5t-121.5 -292.5q0 -172 121.5 -293t292.5 -121t292.5 121t121.5 293q0 171 -121.5 292.5t-292.5 121.5zM455 905 q22 0 38 -16t16 -39t-16 -39t-38 -16q-23 0 -39 16.5t-16 38.5t16 38.5t39 16.5zM708 821l1 1q-9 14 -9 28q0 22 16 38.5t39 16.5q22 0 38 -16t16 -39t-16 -39t-38 -16q-14 0 -29 10l-55 -145q17 -22 17 -51q0 -36 -25.5 -61.5t-61.5 -25.5t-61.5 25.5t-25.5 61.5 q0 32 20.5 56.5t51.5 29.5zM855 709q23 0 38.5 -15.5t15.5 -38.5t-16 -39t-38 -16q-23 0 -39 16t-16 39q0 22 16 38t39 16zM345 709q23 0 39 -16t16 -38q0 -23 -16 -39t-39 -16q-22 0 -38 16t-16 39t15.5 38.5t38.5 15.5z" />
162
+<glyph unicode="&#xe143;" d="M649 54l-16 22q-90 125 -293 323q-71 70 -104.5 105.5t-77 89.5t-61 99t-17.5 91q0 131 98.5 229.5t230.5 98.5q143 0 241 -129q103 129 246 129q129 0 226 -98.5t97 -229.5q0 -46 -17.5 -91t-61 -99t-77 -89.5t-104.5 -105.5q-203 -198 -293 -323zM844 524l12 12 q64 62 97.5 97t64.5 79t31 72q0 71 -48 119t-105 48q-74 0 -132 -82l-118 -171l-114 174q-51 79 -123 79q-60 0 -109.5 -49t-49.5 -118q0 -27 30.5 -70t61.5 -75.5t95 -94.5l22 -22q93 -90 190 -201q82 92 195 203z" />
163
+<glyph unicode="&#xe144;" d="M476 406l19 -17l105 105l-212 212l389 389l247 -247l-95 -96l18 -18q46 -46 77 -99l29 29q35 35 62.5 88t27.5 96q0 93 -66 159l-141 141q-66 66 -159 66q-95 0 -159 -66l-283 -283q-66 -64 -66 -159q0 -93 66 -159zM123 193l141 -141q66 -66 159 -66q95 0 159 66 l283 283q66 66 66 159t-66 159l-141 141q-12 12 -19 17l-105 -105l212 -212l-389 -389l-247 248l95 95l-18 18q-46 45 -75 101l-55 -55q-66 -66 -66 -159q0 -94 66 -160z" />
164
+<glyph unicode="&#xe145;" d="M200 100v953q0 21 30 46t81 48t129 38t163 15t162 -15t127 -38t79 -48t29 -46v-953q0 -41 -29.5 -70.5t-70.5 -29.5h-600q-41 0 -70.5 29.5t-29.5 70.5zM900 1000h-600v-700h600v700zM600 46q43 0 73.5 30.5t30.5 73.5t-30.5 73.5t-73.5 30.5t-73.5 -30.5t-30.5 -73.5 t30.5 -73.5t73.5 -30.5z" />
165
+<glyph unicode="&#xe148;" d="M700 1029v-307l64 -14q34 -7 64 -16.5t70 -31.5t67.5 -52t47.5 -80.5t20 -112.5q0 -139 -89 -224t-244 -96v-77h-100v78q-152 17 -237 104q-40 40 -52.5 93.5t-15.5 139.5h139q5 -77 48.5 -126.5t117.5 -64.5v335l-27 7q-46 14 -79 26.5t-72 36t-62.5 52t-40 72.5 t-16.5 99q0 92 44 159.5t109 101t144 40.5v78h100v-79q38 -4 72.5 -13.5t75.5 -31.5t71 -53.5t51.5 -84t24.5 -118.5h-159q-8 72 -35 109.5t-101 50.5zM600 755v274q-61 -8 -97.5 -37.5t-36.5 -102.5q0 -29 8 -51t16.5 -34t29.5 -22.5t31 -13.5t38 -10q7 -2 11 -3zM700 548 v-311q170 18 170 151q0 64 -44 99.5t-126 60.5z" />
166
+<glyph unicode="&#xe149;" d="M866 300l50 -147q-41 -25 -80.5 -36.5t-59 -13t-61.5 -1.5q-23 0 -128 33t-155 29q-39 -4 -82 -17t-66 -25l-24 -11l-55 145l16.5 11t15.5 10t13.5 9.5t14.5 12t14.5 14t17.5 18.5q48 55 54 126.5t-30 142.5h-221v100h166q-24 49 -44 104q-10 26 -14.5 55.5t-3 72.5 t25 90t68.5 87q97 88 263 88q129 0 230 -89t101 -208h-153q0 52 -34 89.5t-74 51.5t-76 14q-37 0 -79 -14.5t-62 -35.5q-41 -44 -41 -101q0 -11 2.5 -24.5t5.5 -24t9.5 -26.5t10.5 -25t14 -27.5t14 -25.5t15.5 -27t13.5 -24h242v-100h-197q8 -50 -2.5 -115t-31.5 -94 q-41 -59 -99 -113q35 11 84 18t70 7q32 1 102 -16t104 -17q76 0 136 30z" />
167
+<glyph unicode="&#xe150;" d="M300 0l298 300h-198v900h-200v-900h-198zM900 1200l298 -300h-198v-900h-200v900h-198z" />
168
+<glyph unicode="&#xe151;" d="M400 300h198l-298 -300l-298 300h198v900h200v-900zM1000 1200v-500h-100v100h-100v-100h-100v500h300zM901 1100h-100v-200h100v200zM700 500h300v-200h-99v-100h-100v100h99v100h-200v100zM800 100h200v-100h-300v200h100v-100z" />
169
+<glyph unicode="&#xe152;" d="M400 300h198l-298 -300l-298 300h198v900h200v-900zM1000 1200v-200h-99v-100h-100v100h99v100h-200v100h300zM800 800h200v-100h-300v200h100v-100zM700 500h300v-500h-100v100h-100v-100h-100v500zM801 200h100v200h-100v-200z" />
170
+<glyph unicode="&#xe153;" d="M300 0l298 300h-198v900h-200v-900h-198zM900 1100h-100v100h200v-500h-100v400zM1100 500v-500h-100v100h-200v400h300zM1001 400h-100v-200h100v200z" />
171
+<glyph unicode="&#xe154;" d="M300 0l298 300h-198v900h-200v-900h-198zM1100 1200v-500h-100v100h-200v400h300zM1001 1100h-100v-200h100v200zM900 400h-100v100h200v-500h-100v400z" />
172
+<glyph unicode="&#xe155;" d="M300 0l298 300h-198v900h-200v-900h-198zM900 1000h-200v200h200v-200zM1000 700h-300v200h300v-200zM1100 400h-400v200h400v-200zM1200 100h-500v200h500v-200z" />
173
+<glyph unicode="&#xe156;" d="M300 0l298 300h-198v900h-200v-900h-198zM1200 1000h-500v200h500v-200zM1100 700h-400v200h400v-200zM1000 400h-300v200h300v-200zM900 100h-200v200h200v-200z" />
174
+<glyph unicode="&#xe157;" d="M400 1100h300q162 0 281 -118.5t119 -281.5v-300q0 -165 -118.5 -282.5t-281.5 -117.5h-300q-165 0 -282.5 117.5t-117.5 282.5v300q0 165 117.5 282.5t282.5 117.5zM800 900h-500q-41 0 -70.5 -29.5t-29.5 -70.5v-500q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5 t29.5 70.5v500q0 41 -29.5 70.5t-70.5 29.5z" />
175
+<glyph unicode="&#xe158;" d="M700 0h-300q-163 0 -281.5 117.5t-118.5 282.5v300q0 163 119 281.5t281 118.5h300q165 0 282.5 -117.5t117.5 -282.5v-300q0 -165 -117.5 -282.5t-282.5 -117.5zM800 900h-500q-41 0 -70.5 -29.5t-29.5 -70.5v-500q0 -41 29.5 -70.5t70.5 -29.5h500q41 0 70.5 29.5 t29.5 70.5v500q0 41 -29.5 70.5t-70.5 29.5zM400 800v-500l333 250z" />
176
+<glyph unicode="&#xe159;" d="M0 400v300q0 163 117.5 281.5t282.5 118.5h300q163 0 281.5 -119t118.5 -281v-300q0 -165 -117.5 -282.5t-282.5 -117.5h-300q-165 0 -282.5 117.5t-117.5 282.5zM900 300v500q0 41 -29.5 70.5t-70.5 29.5h-500q-41 0 -70.5 -29.5t-29.5 -70.5v-500q0 -41 29.5 -70.5 t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5zM800 700h-500l250 -333z" />
177
+<glyph unicode="&#xe160;" d="M1100 700v-300q0 -162 -118.5 -281t-281.5 -119h-300q-165 0 -282.5 118.5t-117.5 281.5v300q0 165 117.5 282.5t282.5 117.5h300q165 0 282.5 -117.5t117.5 -282.5zM900 300v500q0 41 -29.5 70.5t-70.5 29.5h-500q-41 0 -70.5 -29.5t-29.5 -70.5v-500q0 -41 29.5 -70.5 t70.5 -29.5h500q41 0 70.5 29.5t29.5 70.5zM550 733l-250 -333h500z" />
178
+<glyph unicode="&#xe161;" d="M500 1100h400q165 0 282.5 -117.5t117.5 -282.5v-300q0 -165 -117.5 -282.5t-282.5 -117.5h-400v200h500q41 0 70.5 29.5t29.5 70.5v500q0 41 -29.5 70.5t-70.5 29.5h-500v200zM700 550l-400 -350v200h-300v300h300v200z" />
179
+<glyph unicode="&#xe162;" d="M403 2l9 -1q13 0 26 16l538 630q15 19 6 36q-8 18 -32 16h-300q1 4 78 219.5t79 227.5q2 17 -6 27l-8 8h-9q-16 0 -25 -15q-4 -5 -98.5 -111.5t-228 -257t-209.5 -238.5q-17 -19 -7 -40q10 -19 32 -19h302q-155 -438 -160 -458q-5 -21 4 -32z" />
180
+<glyph unicode="&#xe163;" d="M800 200h-500q-41 0 -70.5 29.5t-29.5 70.5v500q0 41 29.5 70.5t70.5 29.5h500v185q-14 4 -114 7.5t-193 5.5l-93 2q-165 0 -282.5 -117.5t-117.5 -282.5v-300q0 -165 117.5 -282.5t282.5 -117.5h300q47 0 100 15v185zM900 200v200h-300v300h300v200l400 -350z" />
181
+<glyph unicode="&#xe164;" d="M1200 700l-149 149l-342 -353l-213 213l353 342l-149 149h500v-500zM1022 571l-122 -123v-148q0 -41 -29.5 -70.5t-70.5 -29.5h-500q-41 0 -70.5 29.5t-29.5 70.5v500q0 41 29.5 70.5t70.5 29.5h156l118 122l-74 78h-100q-165 0 -282.5 -117.5t-117.5 -282.5v-300 q0 -165 117.5 -282.5t282.5 -117.5h300q163 0 281.5 117.5t118.5 282.5v98z" />
182
+<glyph unicode="&#xe165;" d="M600 1196q162 0 299 -80t217 -217t80 -299t-80 -299t-217 -217t-299 -80t-299 80t-217 217t-80 299t80 299t217 217t299 80zM600 1014q-171 0 -292.5 -121.5t-121.5 -292.5t121.5 -292.5t292.5 -121.5t292.5 121.5t121.5 292.5t-121.5 292.5t-292.5 121.5zM600 794 q80 0 137 -57t57 -137t-57 -137t-137 -57t-137 57t-57 137t57 137t137 57z" />
183
+<glyph unicode="&#xe166;" d="M700 800v400h-300v-400h-300l445 -500l450 500h-295zM25 300h1048q11 0 19 -7.5t8 -17.5v-275h-1100v275q0 11 7 18t18 7zM1000 200h-100v-50h100v50z" />
184
+<glyph unicode="&#xe167;" d="M400 700v-300h300v300h295l-445 500l-450 -500h300zM25 300h1048q11 0 19 -7.5t8 -17.5v-275h-1100v275q0 11 7 18t18 7zM1000 200h-100v-50h100v50z" />
185
+<glyph unicode="&#xe168;" d="M405 400l596 596l-154 155l-442 -442l-150 151l-155 -155zM25 300h1048q11 0 19 -7.5t8 -17.5v-275h-1100v275q0 11 7 18t18 7zM1000 200h-100v-50h100v50z" />
186
+<glyph unicode="&#xe169;" d="M409 1103l-97 97l-212 -212l97 -98zM650 861l-149 149l-212 -212l149 -149l-238 -248h700v699zM25 300h1048q11 0 19 -7.5t8 -17.5v-275h-1100v275q0 11 7 18t18 7zM1000 200h-100v-50h100v50z" />
187
+<glyph unicode="&#xe170;" d="M539 950l-149 -149l212 -212l149 148l248 -237v700h-699zM297 709l-97 -97l212 -212l98 97zM25 300h1048q11 0 19 -7.5t8 -17.5v-275h-1100v275q0 11 7 18t18 7zM1000 200h-100v-50h100v50z" />
188
+<glyph unicode="&#xe171;" d="M1200 1199v-1079l-475 272l-310 -393v416h-392zM1166 1148l-672 -712v-226z" />
189
+<glyph unicode="&#xe172;" d="M1100 1000v-850q0 -21 -15 -35.5t-35 -14.5h-150v400h-700v-400h-150q-21 0 -35.5 14.5t-14.5 35.5v1000q0 20 14.5 35t35.5 15h250v-300h500v300h100zM700 1200h-100v-200h100v200z" />
190
+<glyph unicode="&#xe173;" d="M578 500h-378v-400h-150q-21 0 -35.5 14.5t-14.5 35.5v1000q0 20 14.5 35t35.5 15h250v-300h500v300h100l200 -200v-218l-276 -275l-120 120zM700 1200h-100v-200h100v200zM1300 538l-475 -476l-244 244l123 123l120 -120l353 352z" />
191
+<glyph unicode="&#xe174;" d="M529 500h-329v-400h-150q-21 0 -35.5 14.5t-14.5 35.5v1000q0 20 14.5 35t35.5 15h250v-300h500v300h100l200 -200v-269l-103 -103l-170 170zM700 1200h-100v-200h100v200zM1167 6l-170 170l-170 -170l-127 127l170 170l-170 170l127 127l170 -170l170 170l127 -128 l-170 -169l170 -170z" />
192
+<glyph unicode="&#xe175;" d="M700 500h-500v-400h-150q-21 0 -35.5 14.5t-14.5 35.5v1000q0 20 14.5 35t35.5 15h250v-300h500v300h100l200 -200v-300h-400v-200zM700 1000h-100v200h100v-200zM1000 600h-200v-300h-200l300 -300l300 300h-200v300z" />
193
+<glyph unicode="&#xe176;" d="M602 500h-402v-400h-150q-21 0 -35.5 14.5t-14.5 35.5v1000q0 20 14.5 35t35.5 15h250v-300h500v300h100l200 -200v-402l-200 200zM700 1000h-100v200h100v-200zM1000 300h200l-300 300l-300 -300h200v-300h200v300z" />
194
+<glyph unicode="&#xe177;" d="M1200 900v150q0 21 -14.5 35.5t-35.5 14.5h-1100q-21 0 -35.5 -14.5t-14.5 -35.5v-150h1200zM0 800v-550q0 -21 14.5 -35.5t35.5 -14.5h1100q21 0 35.5 14.5t14.5 35.5v550h-1200zM100 500h400v-200h-400v200z" />
195
+<glyph unicode="&#xe178;" d="M500 1000h400v198l300 -298l-300 -298v198h-400v200zM100 800v200h100v-200h-100zM400 800h-100v200h100v-200zM700 300h-400v-198l-300 298l300 298v-198h400v-200zM800 500h100v-200h-100v200zM1000 500v-200h100v200h-100z" />
196
+<glyph unicode="&#xe179;" d="M1200 50v1106q0 31 -18 40.5t-44 -7.5l-276 -117q-25 -16 -43.5 -50.5t-18.5 -65.5v-359q0 -29 10.5 -55.5t25 -43t29 -28.5t25.5 -18l10 -5v-397q0 -21 14.5 -35.5t35.5 -14.5h200q21 0 35.5 14.5t14.5 35.5zM550 1200l50 -100v-400l-100 -203v-447q0 -21 -14.5 -35.5 t-35.5 -14.5h-200q-21 0 -35.5 14.5t-14.5 35.5v447l-100 203v400l50 100l50 -100v-300h100v300l50 100l50 -100v-300h100v300z" />
197
+<glyph unicode="&#xe180;" d="M1100 106v888q0 22 25 34.5t50 13.5l25 2v56h-400v-56q75 0 87.5 -6t12.5 -44v-394h-500v394q0 38 12.5 44t87.5 6v56h-400v-56q4 0 11 -0.5t24 -3t30 -7t24 -15t11 -24.5v-888q0 -22 -25 -34.5t-50 -13.5l-25 -2v-56h400v56q-75 0 -87.5 6t-12.5 44v394h500v-394 q0 -38 -12.5 -44t-87.5 -6v-56h400v56q-4 0 -11 0.5t-24 3t-30 7t-24 15t-11 24.5z" />
198
+<glyph unicode="&#xe181;" d="M675 1000l-100 100h-375l-100 -100h400l200 -200v-98l295 98h105v200h-425zM500 300v500q0 41 -29.5 70.5t-70.5 29.5h-300q-41 0 -70.5 -29.5t-29.5 -70.5v-500q0 -41 29.5 -70.5t70.5 -29.5h300q41 0 70.5 29.5t29.5 70.5zM100 800h300v-200h-300v200zM700 565l400 133 v-163l-400 -133v163zM100 500h300v-200h-300v200zM805 300l295 98v-298h-425l-100 -100h-375l-100 100h400l200 200h105z" />
199
+<glyph unicode="&#xe182;" d="M179 1169l-162 -162q-1 -11 -0.5 -32.5t16 -90t46.5 -140t104 -177.5t175 -208q103 -103 207.5 -176t180 -103.5t137 -47t92.5 -16.5l31 1l163 162q16 17 13 40.5t-22 37.5l-192 136q-19 14 -45 12t-42 -19l-119 -118q-143 103 -267 227q-126 126 -227 268l118 118 q17 17 20 41.5t-11 44.5l-139 194q-14 19 -36.5 22t-40.5 -14z" />
200
+<glyph unicode="&#xe183;" d="M1200 712v200q-6 8 -19 20.5t-63 45t-112 57t-171 45t-235 20.5q-92 0 -175 -10.5t-141.5 -27t-108.5 -36.5t-81.5 -40t-53.5 -36.5t-31 -27.5l-9 -10v-200q0 -21 14.5 -33.5t34.5 -8.5l202 33q20 4 34.5 21t14.5 38v146q141 24 300 24t300 -24v-146q0 -21 14.5 -38 t34.5 -21l202 -33q20 -4 34.5 8.5t14.5 33.5zM800 650l365 -303q14 -14 24.5 -39.5t10.5 -45.5v-212q0 -21 -15 -35.5t-35 -14.5h-1100q-21 0 -35.5 14.5t-14.5 35.5v212q0 20 10.5 45.5t24.5 39.5l365 303v50q0 4 1 10.5t12 22.5t30 28.5t60 23t97 10.5t97 -10t60 -23.5 t30 -27.5t12 -24l1 -10v-50z" />
201
+<glyph unicode="&#xe184;" d="M175 200h950l-125 150v250l100 100v400h-100v-200h-100v200h-200v-200h-100v200h-200v-200h-100v200h-100v-400l100 -100v-250zM1200 100v-100h-1100v100h1100z" />
202
+<glyph unicode="&#xe185;" d="M600 1100h100q41 0 70.5 -29.5t29.5 -70.5v-1000h-300v1000q0 41 29.5 70.5t70.5 29.5zM1000 800h100q41 0 70.5 -29.5t29.5 -70.5v-700h-300v700q0 41 29.5 70.5t70.5 29.5zM400 0v400q0 41 -29.5 70.5t-70.5 29.5h-100q-41 0 -70.5 -29.5t-29.5 -70.5v-400h300z" />
203
+<glyph unicode="&#xe186;" d="M1200 800v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212v500q0 124 88 212t212 88h700q124 0 212 -88t88 -212zM1000 900h-900v-700h900v700zM200 800v-300h200v-100h-200v-100h300v300h-200v100h200v100h-300zM800 800h-200v-500h200v100h100v300h-100 v100zM800 700v-300h-100v300h100z" />
204
+<glyph unicode="&#xe187;" d="M1200 800v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212v500q0 124 88 212t212 88h700q124 0 212 -88t88 -212zM1000 900h-900v-700h900v700zM400 600h-100v200h-100v-500h100v200h100v-200h100v500h-100v-200zM800 800h-200v-500h200v100h100v300h-100 v100zM800 700v-300h-100v300h100z" />
205
+<glyph unicode="&#xe188;" d="M1200 800v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212v500q0 124 88 212t212 88h700q124 0 212 -88t88 -212zM1000 900h-900v-700h900v700zM200 800v-500h300v100h-200v300h200v100h-300zM600 800v-500h300v100h-200v300h200v100h-300z" />
206
+<glyph unicode="&#xe189;" d="M1200 800v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212v500q0 124 88 212t212 88h700q124 0 212 -88t88 -212zM1000 900h-900v-700h900v700zM500 700l-300 -150l300 -150v300zM600 400l300 150l-300 150v-300z" />
207
+<glyph unicode="&#xe190;" d="M1200 800v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212v500q0 124 88 212t212 88h700q124 0 212 -88t88 -212zM1000 900h-900v-700h900v700zM900 800v-500h-700v500h700zM300 400h130q41 0 68 42t27 107t-28.5 108t-66.5 43h-130v-300zM800 700h-130 q-38 0 -66.5 -43t-28.5 -108t27 -107t68 -42h130v300z" />
208
+<glyph unicode="&#xe191;" d="M1200 800v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212v500q0 124 88 212t212 88h700q124 0 212 -88t88 -212zM1000 900h-900v-700h900v700zM200 800v-300h200v-100h-200v-100h300v300h-200v100h200v100h-300zM800 300h100v500h-200v-100h100v-400z M601 300h100v100h-100v-100z" />
209
+<glyph unicode="&#xe192;" d="M1200 800v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212v500q0 124 88 212t212 88h700q124 0 212 -88t88 -212zM1000 900h-900v-700h900v700zM300 700v100h-100v-500h300v400h-200zM800 300h100v500h-200v-100h100v-400zM401 400h-100v200h100v-200z M601 300h100v100h-100v-100z" />
210
+<glyph unicode="&#xe193;" d="M200 1100h700q124 0 212 -88t88 -212v-500q0 -124 -88 -212t-212 -88h-700q-124 0 -212 88t-88 212v500q0 124 88 212t212 88zM1000 900h-900v-700h900v700zM400 700h-200v100h300v-300h-99v-100h-100v100h99v200zM800 700h-100v100h200v-500h-100v400zM201 400h100v-100 h-100v100zM701 300h-100v100h100v-100z" />
211
+<glyph unicode="&#xe194;" d="M600 1196q162 0 299 -80t217 -217t80 -299t-80 -299t-217 -217t-299 -80t-299 80t-217 217t-80 299t80 299t217 217t299 80zM600 1014q-171 0 -292.5 -121.5t-121.5 -292.5t121.5 -292.5t292.5 -121.5t292.5 121.5t121.5 292.5t-121.5 292.5t-292.5 121.5zM800 700h-300 v-200h300v-100h-300l-100 100v200l100 100h300v-100z" />
212
+<glyph unicode="&#xe195;" d="M596 1196q162 0 299 -80t217 -217t80 -299t-80 -299t-217 -217t-299 -80t-299 80t-217 217t-80 299t80 299t217 217t299 80zM596 1014q-171 0 -292.5 -121.5t-121.5 -292.5t121.5 -292.5t292.5 -121.5t292.5 121.5t121.5 292.5t-121.5 292.5t-292.5 121.5zM800 700v-100 h-100v100h-200v-100h200v-100h-200v-100h-100v400h300zM800 400h-100v100h100v-100z" />
213
+<glyph unicode="&#xe197;" d="M800 300h128q120 0 205 86t85 208q0 120 -85 206.5t-205 86.5q-46 0 -90 -14q-44 97 -134.5 156.5t-200.5 59.5q-152 0 -260 -107.5t-108 -260.5q0 -25 2 -37q-66 -14 -108.5 -67.5t-42.5 -122.5q0 -80 56.5 -137t135.5 -57h222v300h400v-300zM700 200h200l-300 -300 l-300 300h200v300h200v-300z" />
214
+<glyph unicode="&#xe198;" d="M600 714l403 -403q94 26 154.5 104t60.5 178q0 121 -85 207.5t-205 86.5q-46 0 -90 -14q-44 97 -134.5 156.5t-200.5 59.5q-152 0 -260 -107.5t-108 -260.5q0 -25 2 -37q-66 -14 -108.5 -67.5t-42.5 -122.5q0 -80 56.5 -137t135.5 -57h8zM700 -100h-200v300h-200l300 300 l300 -300h-200v-300z" />
215
+<glyph unicode="&#xe199;" d="M700 200h400l-270 300h170l-270 300h170l-300 333l-300 -333h170l-270 -300h170l-270 -300h400v-155l-75 -45h350l-75 45v155z" />
216
+<glyph unicode="&#xe200;" d="M700 45v306q46 -30 100 -30q74 0 126.5 52.5t52.5 126.5q0 24 -9 55q50 32 79.5 83t29.5 112q0 90 -61.5 155.5t-150.5 71.5q-26 89 -99.5 145.5t-167.5 56.5q-116 0 -197.5 -81.5t-81.5 -197.5q0 -4 1 -12t1 -11q-14 2 -23 2q-74 0 -126.5 -52.5t-52.5 -126.5 q0 -53 28.5 -97t75.5 -65q-4 -16 -4 -38q0 -74 52.5 -126.5t126.5 -52.5q56 0 100 30v-306l-75 -45h350z" />
217
+<glyph unicode="&#x1f4bc;" d="M800 1000h300q41 0 70.5 -29.5t29.5 -70.5v-400h-500v100h-200v-100h-500v400q0 41 29.5 70.5t70.5 29.5h300v100q0 41 29.5 70.5t70.5 29.5h200q41 0 70.5 -29.5t29.5 -70.5v-100zM500 1000h200v100h-200v-100zM1200 400v-200q0 -41 -29.5 -70.5t-70.5 -29.5h-1000 q-41 0 -70.5 29.5t-29.5 70.5v200h1200z" />
218
+<glyph unicode="&#x1f4c5;" d="M1100 900v150q0 21 -14.5 35.5t-35.5 14.5h-150v100h-100v-100h-500v100h-100v-100h-150q-21 0 -35.5 -14.5t-14.5 -35.5v-150h1100zM0 800v-750q0 -20 14.5 -35t35.5 -15h1000q21 0 35.5 15t14.5 35v750h-1100zM100 600h100v-100h-100v100zM300 600h100v-100h-100v100z M500 600h100v-100h-100v100zM700 600h100v-100h-100v100zM900 600h100v-100h-100v100zM100 400h100v-100h-100v100zM300 400h100v-100h-100v100zM500 400h100v-100h-100v100zM700 400h100v-100h-100v100zM900 400h100v-100h-100v100zM100 200h100v-100h-100v100zM300 200 h100v-100h-100v100zM500 200h100v-100h-100v100zM700 200h100v-100h-100v100zM900 200h100v-100h-100v100z" />
219
+<glyph unicode="&#x1f4cc;" d="M902 1185l283 -282q15 -15 15 -36t-15 -35q-14 -15 -35 -15t-35 15l-36 35l-279 -267v-300l-212 210l-208 -207l-380 -303l303 380l207 208l-210 212h300l267 279l-35 36q-15 14 -15 35t15 35q14 15 35 15t35 -15z" />
220
+<glyph unicode="&#x1f4ce;" d="M518 119l69 -60l517 511q67 67 95 157t11 183q-16 87 -67 154t-130 103q-69 33 -152 33q-107 0 -197 -55q-40 -24 -111 -95l-512 -512q-68 -68 -81 -163t35 -173q35 -57 94 -89t129 -32q63 0 119 28q33 16 65 40.5t52.5 45.5t59.5 64q40 44 57 61l394 394q35 35 47 84 t-3 96q-27 87 -117 104q-20 2 -29 2q-46 0 -79.5 -17t-67.5 -51l-388 -396l-7 -7l69 -67l377 373q20 22 39 38q23 23 50 23q38 0 53 -36q16 -39 -20 -75l-547 -547q-52 -52 -125 -52q-55 0 -100 33t-54 96q-5 35 2.5 66t31.5 63t42 50t56 54q24 21 44 41l348 348 q52 52 82.5 79.5t84 54t107.5 26.5q25 0 48 -4q95 -17 154 -94.5t51 -175.5q-7 -101 -98 -192l-252 -249l-253 -256z" />
221
+<glyph unicode="&#x1f4f7;" d="M1200 200v600q0 41 -29.5 70.5t-70.5 29.5h-150q-4 8 -11.5 21.5t-33 48t-53 61t-69 48t-83.5 21.5h-200q-41 0 -82 -20.5t-70 -50t-52 -59t-34 -50.5l-12 -20h-150q-41 0 -70.5 -29.5t-29.5 -70.5v-600q0 -41 29.5 -70.5t70.5 -29.5h1000q41 0 70.5 29.5t29.5 70.5z M1000 700h-100v100h100v-100zM844 500q0 -100 -72 -172t-172 -72t-172 72t-72 172t72 172t172 72t172 -72t72 -172zM706 500q0 44 -31 75t-75 31t-75 -31t-31 -75t31 -75t75 -31t75 31t31 75z" />
222
+<glyph unicode="&#x1f512;" d="M900 800h100q41 0 70.5 -29.5t29.5 -70.5v-600q0 -41 -29.5 -70.5t-70.5 -29.5h-900q-41 0 -70.5 29.5t-29.5 70.5v600q0 41 29.5 70.5t70.5 29.5h100v200q0 82 59 141t141 59h300q82 0 141 -59t59 -141v-200zM400 800h300v150q0 21 -14.5 35.5t-35.5 14.5h-200 q-21 0 -35.5 -14.5t-14.5 -35.5v-150z" />
223
+<glyph unicode="&#x1f514;" d="M1062 400h17q20 0 33.5 -14.5t13.5 -35.5q0 -20 -13 -40t-31 -27q-22 -9 -63 -23t-167.5 -37t-251.5 -23t-245.5 20.5t-178.5 41.5l-58 20q-18 7 -31 27.5t-13 40.5q0 21 13.5 35.5t33.5 14.5h17l118 173l63 327q15 77 76 140t144 83l-18 32q-6 19 3 32t29 13h94 q20 0 29 -10.5t3 -29.5l-18 -37q83 -19 144 -82.5t76 -140.5l63 -327zM600 104q-54 0 -103 6q12 -49 40 -79.5t63 -30.5t63 30.5t39 79.5q-48 -6 -102 -6z" />
224
+<glyph unicode="&#x1f516;" d="M200 0l450 444l450 -443v1150q0 20 -14.5 35t-35.5 15h-800q-21 0 -35.5 -15t-14.5 -35v-1151z" />
225
+<glyph unicode="&#x1f525;" d="M400 755q2 -12 8 -41.5t8 -43t6 -39.5t3.5 -39.5t-1 -33.5t-6 -31.5t-13.5 -24t-21 -20.5t-31 -12q-38 -10 -67 13t-40.5 61.5t-15 81.5t10.5 75q-52 -46 -83.5 -101t-39 -107t-7.5 -85t5 -63q9 -56 44 -119.5t105 -108.5q31 -21 64 -16t62 23.5t57 49.5t48 61.5t35 60.5 q32 66 39 184.5t-13 157.5q79 -80 122 -164t26 -184q-5 -33 -20.5 -69.5t-37.5 -80.5q-10 -19 -14.5 -29t-12 -26t-9 -23.5t-3 -19t2.5 -15.5t11 -9.5t19.5 -5t30.5 2.5t42 8q57 20 91 34t87.5 44.5t87 64t65.5 88.5t47 122q38 172 -44.5 341.5t-246.5 278.5q22 -44 43 -129 q39 -159 -32 -154q-15 2 -33 9q-79 33 -120.5 100t-44 175.5t48.5 257.5q-13 -8 -34 -23.5t-72.5 -66.5t-88.5 -105.5t-60 -138t-8 -166.5z" />
226
+<glyph unicode="&#x1f527;" d="M948 778l251 126q13 -175 -151 -267q-123 -70 -253 -23l-596 -596q-15 -16 -36.5 -16t-36.5 16l-111 110q-15 15 -15 36.5t15 37.5l600 599q-33 101 6 201.5t135 154.5q164 92 306 -9l-259 -138z" />
227
+</font>
228
+</defs></svg> 

二進制
Authentication-test/fonts/glyphicons-halflings-regular.ttf 查看文件


二進制
Authentication-test/fonts/glyphicons-halflings-regular.woff 查看文件


+ 20
- 0
Authentication-test/packages.config 查看文件

@@ -0,0 +1,20 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<packages>
3
+  <package id="Antlr" version="3.4.1.9004" targetFramework="net45" />
4
+  <package id="bootstrap" version="3.0.0" targetFramework="net45" />
5
+  <package id="jQuery" version="1.10.2" targetFramework="net45" />
6
+  <package id="Microsoft.AspNet.Mvc" version="5.0.0" targetFramework="net45" />
7
+  <package id="Microsoft.AspNet.Razor" version="3.0.0" targetFramework="net45" />
8
+  <package id="Microsoft.AspNet.Web.Optimization" version="1.1.1" targetFramework="net45" />
9
+  <package id="Microsoft.AspNet.WebApi" version="5.0.0" targetFramework="net45" />
10
+  <package id="Microsoft.AspNet.WebApi.Client" version="5.0.0" targetFramework="net45" />
11
+  <package id="Microsoft.AspNet.WebApi.Core" version="5.0.0" targetFramework="net45" />
12
+  <package id="Microsoft.AspNet.WebApi.HelpPage" version="5.0.0" targetFramework="net45" />
13
+  <package id="Microsoft.AspNet.WebApi.WebHost" version="5.0.0" targetFramework="net45" />
14
+  <package id="Microsoft.AspNet.WebPages" version="3.0.0" targetFramework="net45" />
15
+  <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
16
+  <package id="Modernizr" version="2.6.2" targetFramework="net45" />
17
+  <package id="Newtonsoft.Json" version="5.0.6" targetFramework="net45" />
18
+  <package id="Respond" version="1.2.0" targetFramework="net45" />
19
+  <package id="WebGrease" version="1.5.2" targetFramework="net45" />
20
+</packages>

+ 79
- 0
Authentication/Authentication.csproj 查看文件

@@ -0,0 +1,79 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4
+  <PropertyGroup>
5
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7
+    <ProjectGuid>{D7B2B4CF-B1F2-4D86-89A5-A6C12FC0E327}</ProjectGuid>
8
+    <OutputType>Library</OutputType>
9
+    <AppDesignerFolder>Properties</AppDesignerFolder>
10
+    <RootNamespace>iiie.Authentication</RootNamespace>
11
+    <AssemblyName>Authentication</AssemblyName>
12
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
13
+    <FileAlignment>512</FileAlignment>
14
+  </PropertyGroup>
15
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
16
+    <DebugSymbols>true</DebugSymbols>
17
+    <DebugType>full</DebugType>
18
+    <Optimize>false</Optimize>
19
+    <OutputPath>bin\Debug\</OutputPath>
20
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
21
+    <ErrorReport>prompt</ErrorReport>
22
+    <WarningLevel>4</WarningLevel>
23
+  </PropertyGroup>
24
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
25
+    <DebugType>pdbonly</DebugType>
26
+    <Optimize>true</Optimize>
27
+    <OutputPath>bin\Release\</OutputPath>
28
+    <DefineConstants>TRACE</DefineConstants>
29
+    <ErrorReport>prompt</ErrorReport>
30
+    <WarningLevel>4</WarningLevel>
31
+  </PropertyGroup>
32
+  <ItemGroup>
33
+    <Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
34
+      <SpecificVersion>False</SpecificVersion>
35
+      <HintPath>..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll</HintPath>
36
+    </Reference>
37
+    <Reference Include="System" />
38
+    <Reference Include="System.Configuration" />
39
+    <Reference Include="System.Core" />
40
+    <Reference Include="System.IdentityModel" />
41
+    <Reference Include="System.IdentityModel.Tokens.Jwt">
42
+      <HintPath>..\packages\System.IdentityModel.Tokens.Jwt.4.0.2.205111437\lib\net45\System.IdentityModel.Tokens.Jwt.dll</HintPath>
43
+    </Reference>
44
+    <Reference Include="System.Net.Http" />
45
+    <Reference Include="System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
46
+      <SpecificVersion>False</SpecificVersion>
47
+      <HintPath>..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll</HintPath>
48
+    </Reference>
49
+    <Reference Include="System.Web.Http, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
50
+      <SpecificVersion>False</SpecificVersion>
51
+      <HintPath>..\packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll</HintPath>
52
+    </Reference>
53
+    <Reference Include="System.Xml.Linq" />
54
+    <Reference Include="System.Data.DataSetExtensions" />
55
+    <Reference Include="Microsoft.CSharp" />
56
+    <Reference Include="System.Data" />
57
+    <Reference Include="System.Xml" />
58
+  </ItemGroup>
59
+  <ItemGroup>
60
+    <Compile Include="Business\Attributes\AuthFilter.cs" />
61
+    <Compile Include="Business\JWT\PasswordHash.cs" />
62
+    <Compile Include="Business\JWT\TokenManager.cs" />
63
+    <Compile Include="Business\JWT\TokenValidationHandler.cs" />
64
+    <Compile Include="Business\AuthProvider.cs" />
65
+    <Compile Include="DBO\UserDboAuth.cs" />
66
+    <Compile Include="Properties\AssemblyInfo.cs" />
67
+  </ItemGroup>
68
+  <ItemGroup>
69
+    <None Include="packages.config" />
70
+  </ItemGroup>
71
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
72
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
73
+       Other similar extension points exist, see Microsoft.Common.targets.
74
+  <Target Name="BeforeBuild">
75
+  </Target>
76
+  <Target Name="AfterBuild">
77
+  </Target>
78
+  -->
79
+</Project>

+ 16
- 0
Authentication/Authentication.nuspec 查看文件

@@ -0,0 +1,16 @@
1
+<?xml version="1.0"?>
2
+<package >
3
+  <metadata>
4
+    <id>3ieAuthentication</id>
5
+    <version>1.0.0</version>
6
+    <title>3ie Authentication</title>
7
+    <authors>robin.thoni</authors>
8
+    <owners>robin.thoni</owners>
9
+    <projectUrl>https://bitbucket.org/3ie/nuget-3ie</projectUrl>
10
+    <requireLicenseAcceptance>false</requireLicenseAcceptance>
11
+    <description>Common features for web API authentication</description>
12
+    <releaseNotes>First release</releaseNotes>
13
+    <copyright>Copyright 2015</copyright>
14
+    <tags>web api authentication user login</tags>
15
+  </metadata>
16
+</package>

+ 37
- 0
Authentication/Business/Attributes/AuthFilter.cs 查看文件

@@ -0,0 +1,37 @@
1
+using System.Collections.Generic;
2
+using System.Linq;
3
+using System.Web.Http;
4
+using System.Web.Http.Controllers;
5
+
6
+namespace iiie.Authentication.Business.Attributes
7
+{
8
+    /// <summary>
9
+    /// Filter for controllers methods
10
+    /// </summary>
11
+    public class AuthFilter : AuthorizeAttribute
12
+    {
13
+        /// <summary>
14
+        /// Authorized roles to access this method
15
+        /// </summary>
16
+        public IEnumerable<int> Roles { get; set; }
17
+
18
+        /// <summary>
19
+        /// Constructor
20
+        /// </summary>
21
+        /// <param name="roles"></param>
22
+        public AuthFilter(params int[] roles)
23
+        {
24
+            Roles = roles.ToList();
25
+        }
26
+
27
+        /// <summary>
28
+        /// Check if user can access this method
29
+        /// </summary>
30
+        /// <param name="context">HTTP request context</param>
31
+        /// <returns>True if user can access, false otherwise</returns>
32
+        protected override bool IsAuthorized(HttpActionContext context)
33
+        {
34
+            return !Roles.Any() || (UsersBusiness.UserId != null && Roles.Contains(UsersBusiness.UserId.Role));
35
+        }
36
+    }
37
+}

+ 152
- 0
Authentication/Business/AuthProvider.cs 查看文件

@@ -0,0 +1,152 @@
1
+using System;
2
+using System.Configuration;
3
+using System.Linq;
4
+using System.Security.Claims;
5
+using System.Text.RegularExpressions;
6
+using System.Threading;
7
+using iiie.Authentication.DBO;
8
+using Newtonsoft.Json;
9
+
10
+namespace iiie.Authentication.Business
11
+{
12
+    public abstract class AuthProvider<TUserDbo>
13
+        where TUserDbo : UserDboAuth
14
+    {
15
+        /// <summary>
16
+        /// Application specific settings
17
+        /// </summary>
18
+        public static AuthProvider<TUserDbo> Instance { get; set; }
19
+
20
+        /// <summary>
21
+        /// The registered user dbo, or null if no user is logged
22
+        /// </summary>
23
+        public static TUserDbo UserDbo
24
+        {
25
+            get
26
+            {
27
+                var claim = ((ClaimsIdentity)Thread.CurrentPrincipal.Identity).Claims.FirstOrDefault(x => x != null && x.Type == "__userdbo__");
28
+                if (claim == null)
29
+                    return null;
30
+                return JsonConvert.DeserializeObject<TUserDbo>(claim.Value);
31
+            }
32
+            set
33
+            {
34
+                var claim = new Claim("__userdbo__", JsonConvert.SerializeObject(value));
35
+                ((ClaimsIdentity)Thread.CurrentPrincipal.Identity).AddClaim(claim);
36
+            }
37
+        }
38
+
39
+        /// <summary>
40
+        /// Check if this is a valid email address
41
+        /// </summary>
42
+        /// <param name="email">The email to test</param>
43
+        /// <returns>True if the email is valid, false otherwise</returns>
44
+        public static bool IsValidEmail(string email)
45
+        {
46
+            try
47
+            {
48
+                return Regex.IsMatch(email,
49
+                      @"^(?("")("".+?(?<!\\)""@)|(([0-9a-z]((\.(?!\.))|[-!#\$%&'\*\+/=\?\^`\{\}\|~\w])*)(?<=[0-9a-z])@))" +
50
+                      @"(?(\[)(\[(\d{1,3}\.){3}\d{1,3}\])|(([0-9a-z][-\w]*[0-9a-z]*\.)+[a-z0-9][\-a-z0-9]{0,22}[a-z0-9]))$",
51
+                      RegexOptions.IgnoreCase, TimeSpan.FromMilliseconds(250));
52
+            }
53
+            catch (RegexMatchTimeoutException)
54
+            {
55
+                return false;
56
+            }
57
+        }
58
+
59
+        /// <summary>
60
+        /// Get a int from config file, or return the default value
61
+        /// </summary>
62
+        /// <param name="key">The config file key</param>
63
+        /// <param name="def">The default value</param>
64
+        /// <returns>The found int</returns>
65
+        protected int GetInt(string key, int def)
66
+        {
67
+            var valueStr = ConfigurationManager.AppSettings[key];
68
+            if (valueStr == null)
69
+                return def;
70
+            int value;
71
+            if (int.TryParse(valueStr, out value))
72
+                return value;
73
+            return def;
74
+        }
75
+
76
+        /// <summary>
77
+        /// Get a string from config file, or return the default value
78
+        /// </summary>
79
+        /// <param name="key">The config file key</param>
80
+        /// <param name="def">The default value</param>
81
+        /// <returns>The found string</returns>
82
+        protected string GetString(string key, string def)
83
+        {
84
+            var value = ConfigurationManager.AppSettings[key];
85
+            if (value == null)
86
+                return def;
87
+            return value;
88
+        }
89
+        /// <summary>
90
+        /// Contructs a user dbo from the specified username and salt and register it into UserDbo
91
+        /// </summary>
92
+        /// <param name="username">The username of the verified token</param>
93
+        /// <param name="salt">The salt in the token</param>
94
+        /// <returns>The user dbo, or null if user is not valid</returns>
95
+        public TUserDbo GetAndRegisterUserDbo(string username, string salt)
96
+        {
97
+            return UserDbo = GetUserDbo(username, salt);
98
+        }
99
+
100
+        /// <summary>
101
+        /// Contructs a user dbo from the specified username and salt
102
+        /// </summary>
103
+        /// <param name="username">The username of the verified token</param>
104
+        /// <param name="salt">The salt in the token</param>
105
+        /// <returns>The user dbo, or null if user is not valid</returns>
106
+        public abstract TUserDbo GetUserDbo(string username, string salt);
107
+
108
+        /// <summary>
109
+        /// Const value to compute password hash
110
+        /// </summary>
111
+        public virtual int GetPasswordSaltByteSize()
112
+        {
113
+            return GetInt("PasswordSaltByteSize", 42);
114
+        }
115
+
116
+        /// <summary>
117
+        /// Const value to compute password hash
118
+        /// </summary>
119
+        public virtual int GetPasswordHashByteSize()
120
+        {
121
+            return GetInt("PasswordHashByteSize", 42);
122
+        }
123
+
124
+        /// <summary>
125
+        /// Const value to compute password hash
126
+        /// </summary>
127
+        public virtual int GetPasswordIterations()
128
+        {
129
+            return GetInt("PasswordIterations", 2048);
130
+        }
131
+
132
+        /// <summary>
133
+        /// Returns a string used to validate the token.
134
+        /// Must be constant. Default is app setting 'ValidatorString'
135
+        /// </summary>
136
+        /// <returns>The string</returns>
137
+        public virtual string GetValidatorString()
138
+        {
139
+            return GetString("ValidatorString", "__default__");
140
+        }
141
+
142
+        /// <summary>
143
+        /// Returns a string used to sign the token
144
+        /// Must be constant. Default is app setting 'CredentialKey'
145
+        /// </summary>
146
+        /// <returns>The string</returns>
147
+        public virtual string GetCredentialKey()
148
+        {
149
+            return GetString("CredentialKey", "__default__");
150
+        }
151
+    }
152
+}

+ 77
- 0
Authentication/Business/JWT/PasswordHash.cs 查看文件

@@ -0,0 +1,77 @@
1
+using System;
2
+using System.Security.Cryptography;
3
+
4
+namespace iiie.Authentication.Business.JWT
5
+{
6
+    /// <summary>
7
+    /// Hash generator for passwords
8
+    /// </summary>
9
+    public static class PasswordHash
10
+    {
11
+        private const int ITERATION_INDEX = 0;
12
+        private const int SALT_INDEX = 1;
13
+        private const int PBKDF2_INDEX = 2;
14
+
15
+        /// <summary>
16
+        /// Crée un hash à partir du password
17
+        /// </summary>
18
+        /// <param name="password">le password à hasher</param>
19
+        /// <returns>le hash du password</returns>
20
+        public static string CreateHash(string password)
21
+        {
22
+            // génaration du SALT aléatoire
23
+            RNGCryptoServiceProvider csprng = new RNGCryptoServiceProvider();
24
+            byte[] salt = new byte[AuthProvider.Instance.GetPasswordSaltByteSize()];
25
+            csprng.GetBytes(salt);
26
+
27
+            // hash le password et création de la chaine avec les paramêtres
28
+            byte[] hash = PBKDF2(password, salt, AuthProvider.Instance.GetPasswordIterations(),
29
+                AuthProvider.Instance.GetPasswordSaltByteSize());
30
+            return AuthProvider.Instance.GetPasswordIterations() + ":" +
31
+                Convert.ToBase64String(salt) + ":" + Convert.ToBase64String(hash);
32
+        }
33
+
34
+        /// <summary>
35
+        /// Valide le password en adequation avec le hash
36
+        /// </summary>
37
+        /// <param name="password">le password à vérifier</param>
38
+        /// <param name="correctHash">le hash du password stocké en base</param>
39
+        /// <returns>True si c'est bon sinon false</returns>
40
+        public static bool ValidatePassword(string password, string correctHash)
41
+        {
42
+            // Extraction des paramêtres du hash
43
+            char[] delimiter = { ':' };
44
+            string[] split = correctHash.Split(delimiter);
45
+            int iterations = Int32.Parse(split[ITERATION_INDEX]);
46
+            byte[] salt = Convert.FromBase64String(split[SALT_INDEX]);
47
+            byte[] hash = Convert.FromBase64String(split[PBKDF2_INDEX]);
48
+
49
+            byte[] testHash = PBKDF2(password, salt, iterations, hash.Length);
50
+            return SlowEquals(hash, testHash);
51
+        }
52
+
53
+
54
+        private static bool SlowEquals(byte[] a, byte[] b)
55
+        {
56
+            uint diff = (uint)a.Length ^ (uint)b.Length;
57
+            for (int i = 0; i < a.Length && i < b.Length; i++)
58
+                diff |= (uint)(a[i] ^ b[i]);
59
+            return diff == 0;
60
+        }
61
+
62
+        /// <summary>
63
+        /// Calcul le PBKDF2-SHA1 hash du password.
64
+        /// </summary>
65
+        /// <param name="password">The password à hasher</param>
66
+        /// <param name="salt">le salt</param>
67
+        /// <param name="iterations">le nombre d'itération</param>
68
+        /// <param name="outputBytes">la longueur du hash à générer</param>
69
+        /// <returns>le hash du password.</returns>
70
+        private static byte[] PBKDF2(string password, byte[] salt, int iterations, int outputBytes)
71
+        {
72
+            Rfc2898DeriveBytes pbkdf2 = new Rfc2898DeriveBytes(password, salt);
73
+            pbkdf2.IterationCount = iterations;
74
+            return pbkdf2.GetBytes(outputBytes);
75
+        }
76
+    }
77
+}

+ 50
- 0
Authentication/Business/JWT/TokenManager.cs 查看文件

@@ -0,0 +1,50 @@
1
+using System;
2
+using System.IdentityModel.Tokens;
3
+using System.Security.Claims;
4
+using iiie.Authentication.DBO;
5
+
6
+namespace iiie.Authentication.Business.JWT
7
+{
8
+    /// <summary>
9
+    /// Token creation class
10
+    /// </summary>
11
+    public static class TokenManager
12
+    {
13
+        /// <summary>
14
+        /// Create signing credentials to sign the token
15
+        /// </summary>
16
+        /// <returns>The credentials</returns>
17
+        private static SigningCredentials CreateSigningCredentials()
18
+        {
19
+            string symmetricKey = AuthProvider.Instance.GetCredentialKey();
20
+            byte[] keybytes = Convert.FromBase64String(symmetricKey);
21
+            SecurityKey securityKey = new InMemorySymmetricSecurityKey(keybytes);
22
+            SigningCredentials signingCredentials =
23
+                    new SigningCredentials(securityKey,
24
+                        SecurityAlgorithms.HmacSha256Signature,
25
+                        SecurityAlgorithms.Sha256Digest);
26
+            return signingCredentials;
27
+        }
28
+
29
+        /// <summary>
30
+        /// Create a JWT token
31
+        /// </summary>
32
+        /// <param name="user">The user</param>
33
+        /// <returns>The token</returns>
34
+        public static string GetToken(UserDboAuth user, String salt)
35
+        {
36
+            var stringValidator = AuthProvider.Instance.GetValidatorString();
37
+            JwtSecurityToken jst = new JwtSecurityToken("urn:" + stringValidator,
38
+                                              stringValidator,
39
+                                              new Claim[]
40
+                                               {
41
+                                                   new Claim(ClaimTypes.Name, user.Username),
42
+                                                   new Claim(ClaimTypes.Authentication, salt)
43
+                                               }, null, DateTime.Now.AddDays(1),
44
+                                              CreateSigningCredentials());
45
+
46
+            JwtSecurityTokenHandler jh = new JwtSecurityTokenHandler();
47
+            return jh.WriteToken(jst);
48
+        }
49
+    }
50
+}

+ 106
- 0
Authentication/Business/JWT/TokenValidationHandler.cs 查看文件

@@ -0,0 +1,106 @@
1
+using System;
2
+using System.IdentityModel.Tokens;
3
+using System.Linq;
4
+using System.Net;
5
+using System.Net.Http;
6
+using System.Security.Claims;
7
+using System.ServiceModel.Security.Tokens;
8
+using System.Threading;
9
+using System.Threading.Tasks;
10
+using iiie.Authentication.DBO;
11
+
12
+namespace iiie.Authentication.Business.JWT
13
+{
14
+    /// <summary>
15
+    /// Handler for token authentication
16
+    /// </summary>
17
+    public class TokenValidationHandler : DelegatingHandler
18
+    {
19
+        /// <summary>
20
+        /// Gets the token from the HTTP AUthorization header
21
+        /// </summary>
22
+        /// <param name="request">The HTTP request</param>
23
+        /// <param name="token">The variable to store the token</param>
24
+        /// <returns>True if the token has been found, false otherwise</returns>
25
+        private static bool TryRetrieveToken(HttpRequestMessage request, out string token)
26
+        {
27
+            token = null;
28
+            var auth = request.Headers.Authorization;
29
+            if (auth == null || auth.Scheme != "Bearer")
30
+                return false;
31
+            token = auth.Parameter;
32
+            return true;
33
+        }
34
+
35
+        /// <summary>
36
+        /// Contructs a user dbo from the specified username and salt
37
+        /// </summary>
38
+        /// <param name="username">The username of the verified token</param>
39
+        /// <param name="salt">The salt in the token</param>
40
+        /// <returns>The user dbo, or null if user is not valid</returns>
41
+        protected abstract UserDboAuth GetUserDbo(string username, string salt);
42
+
43
+        /// <summary>
44
+        /// Attempts to verify user token
45
+        /// </summary>
46
+        /// <param name="request">The HTTP request</param>
47
+        /// <param name="cancellationToken">Token used for cancelation</param>
48
+        /// <returns>The HTTP response</returns>
49
+        protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
50
+        {
51
+            HttpStatusCode statusCode;
52
+            string token;
53
+
54
+            if (!TryRetrieveToken(request, out token))
55
+            {
56
+                return base.SendAsync(request, cancellationToken);
57
+            }
58
+
59
+            try
60
+            {
61
+                JwtSecurityTokenHandler tokenHandler = new JwtSecurityTokenHandler
62
+                {
63
+                    Configuration = new SecurityTokenHandlerConfiguration()
64
+                    {
65
+                        MaxClockSkew = new TimeSpan(0, 1, 0)
66
+                    }
67
+                };
68
+
69
+                var stringValidator = AuthProvider.Instance.GetValidatorString();
70
+                TokenValidationParameters validationParameters = new TokenValidationParameters()
71
+                {
72
+                    RequireSignedTokens = true,
73
+                    RequireExpirationTime = true,
74
+                    ValidAudience = stringValidator,
75
+                    ValidateIssuerSigningKey = true,
76
+                    ValidIssuer = "urn:" + stringValidator,
77
+                    IssuerSigningToken = new BinarySecretSecurityToken(Convert.FromBase64String(AuthProvider.Instance.GetCredentialKey()))
78
+                };
79
+
80
+                SecurityToken validateToken;
81
+                ClaimsPrincipal claim = tokenHandler.ValidateToken(token, validationParameters, out validateToken);
82
+                Thread.CurrentPrincipal = claim;
83
+
84
+                var name = ((ClaimsIdentity)claim.Identity).Claims.FirstOrDefault(x => x.Type == ClaimTypes.Name);
85
+                var salt = ((ClaimsIdentity)claim.Identity).Claims.FirstOrDefault(x => x.Type == ClaimTypes.Authentication);
86
+
87
+                if (name == null || salt == null)
88
+                    statusCode = HttpStatusCode.Unauthorized;
89
+                else
90
+                {
91
+                    var user = GetUserDbo(name.Value, salt.Value);
92
+                    if (user == null)
93
+                        statusCode = HttpStatusCode.Unauthorized;
94
+                    else
95
+                        return base.SendAsync(request, cancellationToken);
96
+                }
97
+            }
98
+            catch (Exception e)
99
+            {
100
+                statusCode = HttpStatusCode.Unauthorized;
101
+            }
102
+            return Task<HttpResponseMessage>.Factory.StartNew(() =>
103
+               new HttpResponseMessage(statusCode), cancellationToken);
104
+        }
105
+    }
106
+}

+ 24
- 0
Authentication/DBO/UserDboAuth.cs 查看文件

@@ -0,0 +1,24 @@
1
+
2
+namespace iiie.Authentication.DBO
3
+{
4
+    /// <summary>
5
+    /// Basic User representation
6
+    /// </summary>
7
+    public class UserDboAuth
8
+    {
9
+        /// <summary>
10
+        /// The user internal id
11
+        /// </summary>
12
+        public long Id { get; set; }
13
+
14
+        /// <summary>
15
+        /// User username
16
+        /// </summary>
17
+        public string Username { get; set; }
18
+
19
+        /// <summary>
20
+        /// User role
21
+        /// </summary>
22
+        public int Role { get; set; }
23
+    }
24
+}

+ 36
- 0
Authentication/Properties/AssemblyInfo.cs 查看文件

@@ -0,0 +1,36 @@
1
+using System.Reflection;
2
+using System.Runtime.CompilerServices;
3
+using System.Runtime.InteropServices;
4
+
5
+// General Information about an assembly is controlled through the following 
6
+// set of attributes. Change these attribute values to modify the information
7
+// associated with an assembly.
8
+[assembly: AssemblyTitle("Authentication")]
9
+[assembly: AssemblyDescription("")]
10
+[assembly: AssemblyConfiguration("")]
11
+[assembly: AssemblyCompany("")]
12
+[assembly: AssemblyProduct("Authentication")]
13
+[assembly: AssemblyCopyright("Copyright ©  2015")]
14
+[assembly: AssemblyTrademark("")]
15
+[assembly: AssemblyCulture("")]
16
+
17
+// Setting ComVisible to false makes the types in this assembly not visible 
18
+// to COM components.  If you need to access a type in this assembly from 
19
+// COM, set the ComVisible attribute to true on that type.
20
+[assembly: ComVisible(false)]
21
+
22
+// The following GUID is for the ID of the typelib if this project is exposed to COM
23
+[assembly: Guid("c94f6dc3-c07c-4748-b66b-96cff73b027e")]
24
+
25
+// Version information for an assembly consists of the following four values:
26
+//
27
+//      Major Version
28
+//      Minor Version 
29
+//      Build Number
30
+//      Revision
31
+//
32
+// You can specify all the values or you can default the Build and Revision Numbers 
33
+// by using the '*' as shown below:
34
+// [assembly: AssemblyVersion("1.0.*")]
35
+[assembly: AssemblyVersion("1.0.0.0")]
36
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 7
- 0
Authentication/packages.config 查看文件

@@ -0,0 +1,7 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<packages>
3
+  <package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net45" />
4
+  <package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net45" />
5
+  <package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" />
6
+  <package id="System.IdentityModel.Tokens.Jwt" version="4.0.2.205111437" targetFramework="net45" />
7
+</packages>

+ 16
- 0
NuGet-3ie.sln 查看文件

@@ -11,6 +11,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CacheControl-test", "CacheC
11 11
 EndProject
12 12
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Cache-Control", "Cache-Control", "{E16E4E26-9C4B-433E-90A3-BFAA852C0FFA}"
13 13
 EndProject
14
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Authentication", "Authentication", "{17A4996D-EF9B-410F-ADB4-9731C1EB3F4A}"
15
+EndProject
16
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authentication", "Authentication\Authentication.csproj", "{D7B2B4CF-B1F2-4D86-89A5-A6C12FC0E327}"
17
+EndProject
18
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authentication-test", "Authentication-test\Authentication-test.csproj", "{236E3095-DCCC-4460-AEE5-7A6BB126DC04}"
19
+EndProject
14 20
 Global
15 21
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
16 22
 		Debug|Any CPU = Debug|Any CPU
@@ -29,6 +35,14 @@ Global
29 35
 		{87621742-F6EE-457A-9ED4-6C450D462B3B}.Debug|Any CPU.Build.0 = Debug|Any CPU
30 36
 		{87621742-F6EE-457A-9ED4-6C450D462B3B}.Release|Any CPU.ActiveCfg = Release|Any CPU
31 37
 		{87621742-F6EE-457A-9ED4-6C450D462B3B}.Release|Any CPU.Build.0 = Release|Any CPU
38
+		{D7B2B4CF-B1F2-4D86-89A5-A6C12FC0E327}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
39
+		{D7B2B4CF-B1F2-4D86-89A5-A6C12FC0E327}.Debug|Any CPU.Build.0 = Debug|Any CPU
40
+		{D7B2B4CF-B1F2-4D86-89A5-A6C12FC0E327}.Release|Any CPU.ActiveCfg = Release|Any CPU
41
+		{D7B2B4CF-B1F2-4D86-89A5-A6C12FC0E327}.Release|Any CPU.Build.0 = Release|Any CPU
42
+		{236E3095-DCCC-4460-AEE5-7A6BB126DC04}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
43
+		{236E3095-DCCC-4460-AEE5-7A6BB126DC04}.Debug|Any CPU.Build.0 = Debug|Any CPU
44
+		{236E3095-DCCC-4460-AEE5-7A6BB126DC04}.Release|Any CPU.ActiveCfg = Release|Any CPU
45
+		{236E3095-DCCC-4460-AEE5-7A6BB126DC04}.Release|Any CPU.Build.0 = Release|Any CPU
32 46
 	EndGlobalSection
33 47
 	GlobalSection(SolutionProperties) = preSolution
34 48
 		HideSolutionNode = FALSE
@@ -36,5 +50,7 @@ Global
36 50
 	GlobalSection(NestedProjects) = preSolution
37 51
 		{BA63D177-BE9E-41E0-89F5-3D134A26A604} = {E16E4E26-9C4B-433E-90A3-BFAA852C0FFA}
38 52
 		{87621742-F6EE-457A-9ED4-6C450D462B3B} = {E16E4E26-9C4B-433E-90A3-BFAA852C0FFA}
53
+		{D7B2B4CF-B1F2-4D86-89A5-A6C12FC0E327} = {17A4996D-EF9B-410F-ADB4-9731C1EB3F4A}
54
+		{236E3095-DCCC-4460-AEE5-7A6BB126DC04} = {17A4996D-EF9B-410F-ADB4-9731C1EB3F4A}
39 55
 	EndGlobalSection
40 56
 EndGlobal

Loading…
取消
儲存