From 3505acf34b85392e14c4e6ce7b4e6d3be4c5e66e Mon Sep 17 00:00:00 2001 From: Ryan Brandenburg Date: Wed, 26 Jun 2019 11:36:32 -0700 Subject: [PATCH 01/11] Endpoint routing in SPA templates --- .../content/Angular-CSharp/Startup.cs | 13 ++++++------- .../content/React-CSharp/Startup.cs | 6 +++--- .../content/ReactRedux-CSharp/Startup.cs | 6 +++--- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Startup.cs b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Startup.cs index b5d6e749b978..616ca94af90a 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Startup.cs +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Startup.cs @@ -36,13 +36,13 @@ public void ConfigureServices(IServiceCollection services) { #if (IndividualLocalAuth) services.AddDbContext(options => - #if (UseLocalDB) +#if (UseLocalDB) options.UseSqlServer( Configuration.GetConnectionString("DefaultConnection"))); - #else +#else options.UseSqlite( Configuration.GetConnectionString("DefaultConnection"))); - #endif +#endif services.AddDefaultIdentity() .AddEntityFrameworkStores(); @@ -92,12 +92,11 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) app.UseAuthentication(); app.UseIdentityServer(); #endif - - app.UseMvc(routes => + app.UseEndpoints(endpoints => { - routes.MapRoute( + endpoints.MapControllerRoute( name: "default", - template: "{controller}/{action=Index}/{id?}"); + pattern: "{controller}/{action=Index}/{id?}"); }); app.UseSpa(spa => diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Startup.cs b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Startup.cs index 2303f02e1b0f..e6314eb0d28c 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Startup.cs +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Startup.cs @@ -93,11 +93,11 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) app.UseIdentityServer(); #endif - app.UseMvc(routes => + app.UseEndpoints(endpoints => { - routes.MapRoute( + endpoints.MapControllerRoute( name: "default", - template: "{controller}/{action=Index}/{id?}"); + pattern: "{controller}/{action=Index}/{id?}"); }); app.UseSpa(spa => diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/Startup.cs b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/Startup.cs index 620d39f9af98..5fbc22516b22 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/Startup.cs +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/Startup.cs @@ -55,11 +55,11 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) app.UseStaticFiles(); app.UseSpaStaticFiles(); - app.UseMvc(routes => + app.UseEndpoints(endpoints => { - routes.MapRoute( + endpoints.MapControllerRoute( name: "default", - template: "{controller}/{action=Index}/{id?}"); + pattern: "{controller}/{action=Index}/{id?}"); }); app.UseSpa(spa => From ca0338864eb2ed816edba3fac72fc2957aca7aae Mon Sep 17 00:00:00 2001 From: Ryan Brandenburg Date: Fri, 28 Jun 2019 16:01:12 -0700 Subject: [PATCH 02/11] Revert "More doc comment additions" This reverts commit ef2c042ec73f221a07d369e0c5f9ddd22298a632. --- src/Antiforgery/src/IAntiforgery.cs | 2 - .../ConfigurationModel/SecretExtensions.cs | 5 +- .../src/GenericHostBuilderExtensions.cs | 2 +- .../JsonPatch/src/JsonPatchDocument.cs | 12 ++--- .../JsonPatch/src/JsonPatchDocumentOfT.cs | 52 +++++++++---------- src/Hosting/Abstractions/src/IWebHost.cs | 4 +- src/Hosting/Hosting/src/WebHostExtensions.cs | 3 +- src/Hosting/TestHost/src/RequestBuilder.cs | 10 ++-- .../src/AuthenticateResult.cs | 3 -- .../AuthenticationHttpContextExtensions.cs | 2 +- .../src/IAuthenticationRequestHandler.cs | 2 +- src/Http/Http.Abstractions/src/HostString.cs | 45 ++++++++-------- src/Http/Http.Extensions/src/UriHelper.cs | 11 ++-- .../src/IdentityRoleClaim.cs | 4 +- .../WsFederation/src/WsFederationHandler.cs | 8 +-- 15 files changed, 77 insertions(+), 88 deletions(-) diff --git a/src/Antiforgery/src/IAntiforgery.cs b/src/Antiforgery/src/IAntiforgery.cs index 425f5d592009..89630a46d092 100644 --- a/src/Antiforgery/src/IAntiforgery.cs +++ b/src/Antiforgery/src/IAntiforgery.cs @@ -29,7 +29,6 @@ public interface IAntiforgery /// Generates an for this request. /// /// The associated with the current request. - /// The for this request. /// /// Unlike , this method has no side effect. The caller /// is responsible for setting the response cookie and injecting the returned @@ -52,7 +51,6 @@ public interface IAntiforgery /// Validates an antiforgery token that was supplied as part of the request. /// /// The associated with the current request. - /// A that completes when validation has completed. /// /// Thrown when the request does not include a valid antiforgery token. /// diff --git a/src/DataProtection/DataProtection/src/AuthenticatedEncryption/ConfigurationModel/SecretExtensions.cs b/src/DataProtection/DataProtection/src/AuthenticatedEncryption/ConfigurationModel/SecretExtensions.cs index 4876247762d2..75444140c8aa 100644 --- a/src/DataProtection/DataProtection/src/AuthenticatedEncryption/ConfigurationModel/SecretExtensions.cs +++ b/src/DataProtection/DataProtection/src/AuthenticatedEncryption/ConfigurationModel/SecretExtensions.cs @@ -12,8 +12,7 @@ internal unsafe static class SecretExtensions /// Converts an to an <masterKey> element which is marked /// as requiring encryption. /// - /// The secret for accessing the master key. - /// The master key . + /// public static XElement ToMasterKeyElement(this ISecret secret) { // Technically we'll be keeping the unprotected secret around in memory as @@ -44,7 +43,7 @@ public static XElement ToMasterKeyElement(this ISecret secret) /// /// Converts a base64-encoded string into an . /// - /// The . + /// public static Secret ToSecret(this string base64String) { byte[] unprotectedSecret = Convert.FromBase64String(base64String); diff --git a/src/DefaultBuilder/src/GenericHostBuilderExtensions.cs b/src/DefaultBuilder/src/GenericHostBuilderExtensions.cs index 4e11e3c2ca67..2b8d3df2758e 100644 --- a/src/DefaultBuilder/src/GenericHostBuilderExtensions.cs +++ b/src/DefaultBuilder/src/GenericHostBuilderExtensions.cs @@ -21,7 +21,7 @@ public static class GenericHostBuilderExtensions /// /// The instance to configure /// The configure callback - /// The for chaining. + /// public static IHostBuilder ConfigureWebHostDefaults(this IHostBuilder builder, Action configure) { return builder.ConfigureWebHost(webHostBuilder => diff --git a/src/Features/JsonPatch/src/JsonPatchDocument.cs b/src/Features/JsonPatch/src/JsonPatchDocument.cs index 80c39a6e6c4b..1888ea6b4b0a 100644 --- a/src/Features/JsonPatch/src/JsonPatchDocument.cs +++ b/src/Features/JsonPatch/src/JsonPatchDocument.cs @@ -52,7 +52,7 @@ public JsonPatchDocument(List operations, IContractResolver contractR /// /// target location /// value - /// The for chaining. + /// public JsonPatchDocument Add(string path, object value) { if (path == null) @@ -69,7 +69,7 @@ public JsonPatchDocument Add(string path, object value) /// { "op": "remove", "path": "/a/b/c" } /// /// target location - /// The for chaining. + /// public JsonPatchDocument Remove(string path) { if (path == null) @@ -87,7 +87,7 @@ public JsonPatchDocument Remove(string path) /// /// target location /// value - /// The for chaining. + /// public JsonPatchDocument Replace(string path, object value) { if (path == null) @@ -105,7 +105,7 @@ public JsonPatchDocument Replace(string path, object value) /// /// target location /// value - /// The for chaining. + /// public JsonPatchDocument Test(string path, object value) { if (path == null) @@ -123,7 +123,7 @@ public JsonPatchDocument Test(string path, object value) /// /// source location /// target location - /// The for chaining. + /// public JsonPatchDocument Move(string from, string path) { if (from == null) @@ -146,7 +146,7 @@ public JsonPatchDocument Move(string from, string path) /// /// source location /// target location - /// The for chaining. + /// public JsonPatchDocument Copy(string from, string path) { if (from == null) diff --git a/src/Features/JsonPatch/src/JsonPatchDocumentOfT.cs b/src/Features/JsonPatch/src/JsonPatchDocumentOfT.cs index 1b5e6ce0fc18..e0b4fca240cd 100644 --- a/src/Features/JsonPatch/src/JsonPatchDocumentOfT.cs +++ b/src/Features/JsonPatch/src/JsonPatchDocumentOfT.cs @@ -48,7 +48,7 @@ public JsonPatchDocument(List> operations, IContractResolver c /// value type /// target location /// value - /// The for chaining. + /// public JsonPatchDocument Add(Expression> path, TProp value) { if (path == null) @@ -72,7 +72,7 @@ public JsonPatchDocument Add(Expression> path /// target location /// value /// position - /// The for chaining. + /// public JsonPatchDocument Add( Expression>> path, TProp value, @@ -98,7 +98,7 @@ public JsonPatchDocument Add( /// value type /// target location /// value - /// The for chaining. + /// public JsonPatchDocument Add(Expression>> path, TProp value) { if (path == null) @@ -120,7 +120,7 @@ public JsonPatchDocument Add(Expression /// { "op": "remove", "path": "/a/b/c" } /// /// target location - /// The for chaining. + /// public JsonPatchDocument Remove(Expression> path) { if (path == null) @@ -139,7 +139,7 @@ public JsonPatchDocument Remove(Expression> p /// value type /// target location /// position - /// The for chaining. + /// public JsonPatchDocument Remove(Expression>> path, int position) { if (path == null) @@ -160,7 +160,7 @@ public JsonPatchDocument Remove(Expression /// value type /// target location - /// The for chaining. + /// public JsonPatchDocument Remove(Expression>> path) { if (path == null) @@ -182,7 +182,7 @@ public JsonPatchDocument Remove(Expression /// target location /// value - /// The for chaining. + /// public JsonPatchDocument Replace(Expression> path, TProp value) { if (path == null) @@ -206,7 +206,7 @@ public JsonPatchDocument Replace(Expression> /// target location /// value /// position - /// The for chaining. + /// public JsonPatchDocument Replace(Expression>> path, TProp value, int position) { @@ -230,7 +230,7 @@ public JsonPatchDocument Replace(Expressionvalue type /// target location /// value - /// The for chaining. + /// public JsonPatchDocument Replace(Expression>> path, TProp value) { if (path == null) @@ -253,7 +253,7 @@ public JsonPatchDocument Replace(Expression /// target location /// value - /// The for chaining. + /// public JsonPatchDocument Test(Expression> path, TProp value) { if (path == null) @@ -277,7 +277,7 @@ public JsonPatchDocument Test(Expression> pat /// target location /// value /// position - /// The for chaining. + /// public JsonPatchDocument Test(Expression>> path, TProp value, int position) { @@ -301,7 +301,7 @@ public JsonPatchDocument Test(Expressionvalue type /// target location /// value - /// The for chaining. + /// public JsonPatchDocument Test(Expression>> path, TProp value) { if (path == null) @@ -324,7 +324,7 @@ public JsonPatchDocument Test(Expression /// source location /// target location - /// The for chaining. + /// public JsonPatchDocument Move( Expression> from, Expression> path) @@ -354,7 +354,7 @@ public JsonPatchDocument Move( /// source location /// position /// target location - /// The for chaining. + /// public JsonPatchDocument Move( Expression>> from, int positionFrom, @@ -385,7 +385,7 @@ public JsonPatchDocument Move( /// source location /// target location /// position - /// The for chaining. + /// public JsonPatchDocument Move( Expression> from, Expression>> path, @@ -417,7 +417,7 @@ public JsonPatchDocument Move( /// position (source) /// target location /// position (target) - /// The for chaining. + /// public JsonPatchDocument Move( Expression>> from, int positionFrom, @@ -449,7 +449,7 @@ public JsonPatchDocument Move( /// source location /// position /// target location - /// The for chaining. + /// public JsonPatchDocument Move( Expression>> from, int positionFrom, @@ -479,7 +479,7 @@ public JsonPatchDocument Move( /// /// source location /// target location - /// The for chaining. + /// public JsonPatchDocument Move( Expression> from, Expression>> path) @@ -508,7 +508,7 @@ public JsonPatchDocument Move( /// /// source location /// target location - /// The for chaining. + /// public JsonPatchDocument Copy( Expression> from, Expression> path) @@ -538,7 +538,7 @@ public JsonPatchDocument Copy( /// source location /// position /// target location - /// The for chaining. + /// public JsonPatchDocument Copy( Expression>> from, int positionFrom, @@ -569,7 +569,7 @@ public JsonPatchDocument Copy( /// source location /// target location /// position - /// The for chaining. + /// public JsonPatchDocument Copy( Expression> from, Expression>> path, @@ -601,7 +601,7 @@ public JsonPatchDocument Copy( /// position (source) /// target location /// position (target) - /// The for chaining. + /// public JsonPatchDocument Copy( Expression>> from, int positionFrom, @@ -633,7 +633,7 @@ public JsonPatchDocument Copy( /// source location /// position /// target location - /// The for chaining. + /// public JsonPatchDocument Copy( Expression>> from, int positionFrom, @@ -663,7 +663,7 @@ public JsonPatchDocument Copy( /// /// source location /// target location - /// The for chaining. + /// public JsonPatchDocument Copy( Expression> from, Expression>> path) @@ -868,7 +868,7 @@ private static bool ContinueWithSubPath(ExpressionType expressionType) } - // Evaluates the value of the key or index which may be an int or a string, + // Evaluates the value of the key or index which may be an int or a string, // or some other expression type. // The expression is converted to a delegate and the result of executing the delegate is returned as a string. private static string EvaluateExpression(Expression expression) @@ -881,4 +881,4 @@ private static string EvaluateExpression(Expression expression) return Convert.ToString(func(null), CultureInfo.InvariantCulture); } } -} +} \ No newline at end of file diff --git a/src/Hosting/Abstractions/src/IWebHost.cs b/src/Hosting/Abstractions/src/IWebHost.cs index a9f84eecdcba..e6bd78de6cc8 100644 --- a/src/Hosting/Abstractions/src/IWebHost.cs +++ b/src/Hosting/Abstractions/src/IWebHost.cs @@ -38,8 +38,8 @@ public interface IWebHost : IDisposable /// /// Attempt to gracefully stop the host. /// - /// Used to indicate when stop should no longer be graceful. - /// A that completes when the stops. + /// + /// Task StopAsync(CancellationToken cancellationToken = default); } } diff --git a/src/Hosting/Hosting/src/WebHostExtensions.cs b/src/Hosting/Hosting/src/WebHostExtensions.cs index 0b594be84f84..a356f584894a 100644 --- a/src/Hosting/Hosting/src/WebHostExtensions.cs +++ b/src/Hosting/Hosting/src/WebHostExtensions.cs @@ -18,7 +18,7 @@ public static class WebHostExtensions /// /// The timeout for stopping gracefully. Once expired the /// server may terminate any remaining active connections. - /// A that completes when the stops. + /// public static Task StopAsync(this IWebHost host, TimeSpan timeout) { return host.StopAsync(new CancellationTokenSource(timeout).Token); @@ -38,7 +38,6 @@ public static void WaitForShutdown(this IWebHost host) /// /// The running . /// The token to trigger shutdown. - /// A that completes when shutdown is triggered via Ctrl+C or SIGTERM. public static async Task WaitForShutdownAsync(this IWebHost host, CancellationToken token = default) { var done = new ManualResetEventSlim(false); diff --git a/src/Hosting/TestHost/src/RequestBuilder.cs b/src/Hosting/TestHost/src/RequestBuilder.cs index c8499fc02572..644257992e8b 100644 --- a/src/Hosting/TestHost/src/RequestBuilder.cs +++ b/src/Hosting/TestHost/src/RequestBuilder.cs @@ -35,7 +35,7 @@ public RequestBuilder(TestServer server, string path) /// Configure any HttpRequestMessage properties. /// /// - /// This for chaining. + /// public RequestBuilder And(Action configure) { if (configure == null) @@ -52,7 +52,7 @@ public RequestBuilder And(Action configure) /// /// /// - /// This for chaining. + /// public RequestBuilder AddHeader(string name, string value) { if (!_req.Headers.TryAddWithoutValidation(name, value)) @@ -74,7 +74,7 @@ public RequestBuilder AddHeader(string name, string value) /// Set the request method and start processing the request. /// /// - /// The resulting . + /// public Task SendAsync(string method) { _req.Method = new HttpMethod(method); @@ -84,7 +84,7 @@ public Task SendAsync(string method) /// /// Set the request method to GET and start processing the request. /// - /// The resulting . + /// public Task GetAsync() { _req.Method = HttpMethod.Get; @@ -94,7 +94,7 @@ public Task GetAsync() /// /// Set the request method to POST and start processing the request. /// - /// The resulting . + /// public Task PostAsync() { _req.Method = HttpMethod.Post; diff --git a/src/Http/Authentication.Abstractions/src/AuthenticateResult.cs b/src/Http/Authentication.Abstractions/src/AuthenticateResult.cs index fe31859ed461..5982143bcb9a 100644 --- a/src/Http/Authentication.Abstractions/src/AuthenticateResult.cs +++ b/src/Http/Authentication.Abstractions/src/AuthenticateResult.cs @@ -11,9 +11,6 @@ namespace Microsoft.AspNetCore.Authentication /// public class AuthenticateResult { - /// - /// Creates a new instance. - /// protected AuthenticateResult() { } /// diff --git a/src/Http/Authentication.Abstractions/src/AuthenticationHttpContextExtensions.cs b/src/Http/Authentication.Abstractions/src/AuthenticationHttpContextExtensions.cs index 0b40426098b2..bb50c6534f5e 100644 --- a/src/Http/Authentication.Abstractions/src/AuthenticationHttpContextExtensions.cs +++ b/src/Http/Authentication.Abstractions/src/AuthenticationHttpContextExtensions.cs @@ -171,7 +171,7 @@ public static Task SignInAsync(this HttpContext context, string scheme, ClaimsPr /// The context. /// The name of the authentication scheme. /// The properties. - /// The task. + /// public static Task SignOutAsync(this HttpContext context, string scheme, AuthenticationProperties properties) => context.RequestServices.GetRequiredService().SignOutAsync(context, scheme, properties); diff --git a/src/Http/Authentication.Abstractions/src/IAuthenticationRequestHandler.cs b/src/Http/Authentication.Abstractions/src/IAuthenticationRequestHandler.cs index d2822cdc8804..fb1b227ad7a0 100644 --- a/src/Http/Authentication.Abstractions/src/IAuthenticationRequestHandler.cs +++ b/src/Http/Authentication.Abstractions/src/IAuthenticationRequestHandler.cs @@ -13,7 +13,7 @@ public interface IAuthenticationRequestHandler : IAuthenticationHandler /// /// Returns true if request processing should stop. /// - /// true if request processing should stop. + /// Task HandleRequestAsync(); } diff --git a/src/Http/Http.Abstractions/src/HostString.cs b/src/Http/Http.Abstractions/src/HostString.cs index 23850231bf91..0e3da28c4180 100644 --- a/src/Http/Http.Abstractions/src/HostString.cs +++ b/src/Http/Http.Abstractions/src/HostString.cs @@ -51,7 +51,7 @@ public HostString(string host, int port) && host.IndexOf(':', index + 1) >= 0) { // IPv6 without brackets ::1 is the only type of host with 2 or more colons - host = $"[{host}]"; + host = $"[{host}]"; } _value = host + ":" + port.ToString(CultureInfo.InvariantCulture); @@ -74,7 +74,7 @@ public bool HasValue /// Returns the value of the host part of the value. The port is removed if it was present. /// IPv6 addresses will have brackets added if they are missing. /// - /// The host portion of the value. + /// public string Host { get @@ -88,7 +88,7 @@ public string Host /// /// Returns the value of the port part of the host, or null if none is found. /// - /// The port portion of the value. + /// public int? Port { get @@ -108,7 +108,7 @@ public int? Port /// /// Returns the value as normalized by ToUriComponent(). /// - /// The value as normalized by . + /// public override string ToString() { return ToUriComponent(); @@ -118,7 +118,7 @@ public override string ToString() /// Returns the value properly formatted and encoded for use in a URI in a HTTP header. /// Any Unicode is converted to punycode. IPv6 addresses will have brackets added if they are missing. /// - /// The value formated for use in a URI or HTTP header. + /// public string ToUriComponent() { if (string.IsNullOrEmpty(_value)) @@ -154,8 +154,8 @@ public string ToUriComponent() /// Creates a new HostString from the given URI component. /// Any punycode will be converted to Unicode. /// - /// The URI component string to create a from. - /// The that was created. + /// + /// public static HostString FromUriComponent(string uriComponent) { if (!string.IsNullOrEmpty(uriComponent)) @@ -195,8 +195,8 @@ public static HostString FromUriComponent(string uriComponent) /// Creates a new HostString from the host and port of the give Uri instance. /// Punycode will be converted to Unicode. /// - /// The to create a from. - /// The that was created. + /// + /// public static HostString FromUriComponent(Uri uri) { if (uri == null) @@ -223,7 +223,7 @@ public static HostString FromUriComponent(Uri uri) /// "abc.example.com:443" but not "example.com:443". /// Matching is case insensitive. /// - /// true if matches any of the patterns. + /// public static bool MatchesAny(StringSegment value, IList patterns) { if (value == null) @@ -281,8 +281,8 @@ public static bool MatchesAny(StringSegment value, IList patterns /// /// Compares the equality of the Value property, ignoring case. /// - /// The to compare against. - /// true if they have the same value. + /// + /// public bool Equals(HostString other) { if (!HasValue && !other.HasValue) @@ -295,8 +295,8 @@ public bool Equals(HostString other) /// /// Compares against the given object only if it is a HostString. /// - /// The to compare against. - /// true if they have the same value. + /// + /// public override bool Equals(object obj) { if (ReferenceEquals(null, obj)) @@ -309,7 +309,7 @@ public override bool Equals(object obj) /// /// Gets a hash code for the value. /// - /// The hash code as an . + /// public override int GetHashCode() { return (HasValue ? StringComparer.OrdinalIgnoreCase.GetHashCode(_value) : 0); @@ -318,9 +318,9 @@ public override int GetHashCode() /// /// Compares the two instances for equality. /// - /// The left parameter. - /// The right parameter. - /// true if both 's have the same value. + /// + /// + /// public static bool operator ==(HostString left, HostString right) { return left.Equals(right); @@ -329,9 +329,9 @@ public override int GetHashCode() /// /// Compares the two instances for inequality. /// - /// The left parameter. - /// The right parameter. - /// true if both 's values are not equal. + /// + /// + /// public static bool operator !=(HostString left, HostString right) { return !left.Equals(right); @@ -340,9 +340,6 @@ public override int GetHashCode() /// /// Parses the current value. IPv6 addresses will have brackets added if they are missing. /// - /// The value to get the parts of. - /// The portion of the which represents the host. - /// The portion of the which represents the port. private static void GetParts(StringSegment value, out StringSegment host, out StringSegment port) { int index; diff --git a/src/Http/Http.Extensions/src/UriHelper.cs b/src/Http/Http.Extensions/src/UriHelper.cs index 8db49359bb98..4c1507b604e6 100644 --- a/src/Http/Http.Extensions/src/UriHelper.cs +++ b/src/Http/Http.Extensions/src/UriHelper.cs @@ -23,7 +23,7 @@ public static class UriHelper /// The portion of the request path that identifies the requested resource. /// The query, if any. /// The fragment, if any. - /// The combined URI components, properly encoded for use in HTTP headers. + /// public static string BuildRelative( PathString pathBase = new PathString(), PathString path = new PathString(), @@ -44,7 +44,7 @@ public static string BuildRelative( /// The portion of the request path that identifies the requested resource. /// The query, if any. /// The fragment, if any. - /// The combined URI components, properly encoded for use in HTTP headers. + /// public static string BuildAbsolute( string scheme, HostString host, @@ -143,7 +143,7 @@ public static void FromAbsolute( /// HTTP headers. Note that a unicode host name will be encoded as punycode. /// /// The Uri to encode. - /// The encoded string version of . + /// public static string Encode(Uri uri) { if (uri == null) @@ -180,7 +180,7 @@ public static string GetEncodedUrl(this HttpRequest request) /// Returns the relative URI. /// /// The request to assemble the uri pieces from. - /// The path and query off of . + /// public static string GetEncodedPathAndQuery(this HttpRequest request) { return BuildRelative(request.PathBase, request.Path, request.QueryString); @@ -191,8 +191,7 @@ public static string GetEncodedPathAndQuery(this HttpRequest request) /// suitable only for display. This format should not be used in HTTP headers or other HTTP operations. /// /// The request to assemble the uri pieces from. - /// The combined components of the request URL in a fully un-escaped form (except for the QueryString) - /// suitable only for display. + /// public static string GetDisplayUrl(this HttpRequest request) { var scheme = request.Scheme ?? string.Empty; diff --git a/src/Identity/Extensions.Stores/src/IdentityRoleClaim.cs b/src/Identity/Extensions.Stores/src/IdentityRoleClaim.cs index 3f59b2665eea..ff257d59ed63 100644 --- a/src/Identity/Extensions.Stores/src/IdentityRoleClaim.cs +++ b/src/Identity/Extensions.Stores/src/IdentityRoleClaim.cs @@ -35,7 +35,7 @@ public class IdentityRoleClaim where TKey : IEquatable /// /// Constructs a new claim with the type and value. /// - /// The that was produced. + /// public virtual Claim ToClaim() { return new Claim(ClaimType, ClaimValue); @@ -51,4 +51,4 @@ public virtual void InitializeFromClaim(Claim other) ClaimValue = other?.Value; } } -} +} \ No newline at end of file diff --git a/src/Security/Authentication/WsFederation/src/WsFederationHandler.cs b/src/Security/Authentication/WsFederation/src/WsFederationHandler.cs index 27bb332ccf52..6e1f59a44fe2 100644 --- a/src/Security/Authentication/WsFederation/src/WsFederationHandler.cs +++ b/src/Security/Authentication/WsFederation/src/WsFederationHandler.cs @@ -54,7 +54,7 @@ public WsFederationHandler(IOptionsMonitor options, ILogger /// /// Overridden to handle remote signout requests /// - /// true if request processing should stop. + /// public override Task HandleRequestAsync() { // RemoteSignOutPath and CallbackPath may be the same, fall through if the message doesn't match. @@ -149,7 +149,7 @@ protected override async Task HandleRemoteAuthenticateAsync && Request.Body.CanRead) { var form = await Request.ReadFormAsync(); - + wsFederationMessage = new WsFederationMessage(form.Select(pair => new KeyValuePair(pair.Key, pair.Value))); } @@ -163,7 +163,7 @@ protected override async Task HandleRemoteAuthenticateAsync return HandleRequestResult.Fail("No message."); } - + try { // Retrieve our cached redirect uri @@ -422,4 +422,4 @@ private string BuildRedirectUriIfRelative(string uri) return BuildRedirectUri(uri); } } -} +} \ No newline at end of file From 9e372ffa436f6ad7489cca9119347dab19c4e1a9 Mon Sep 17 00:00:00 2001 From: Ryan Brandenburg Date: Fri, 28 Jun 2019 16:46:44 -0700 Subject: [PATCH 03/11] PR feedback --- .../content/Angular-CSharp/Startup.cs | 22 ++++++++++++--- .../content/React-CSharp/Startup.cs | 27 +++++++++++++++---- .../content/ReactRedux-CSharp/Startup.cs | 23 +++++++++++++++- 3 files changed, 63 insertions(+), 9 deletions(-) diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Startup.cs b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Startup.cs index 616ca94af90a..7ead84c39562 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Startup.cs +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Startup.cs @@ -53,8 +53,20 @@ public void ConfigureServices(IServiceCollection services) services.AddAuthentication() .AddIdentityServerJwt(); #endif - services.AddMvc(options => options.EnableEndpointRouting = false); - +#if (OrganizationalAuth) + services.AddControllersWithViews(options => + { + var policy = new AuthorizationPolicyBuilder() + .RequireAuthenticatedUser() + .Build(); + options.Filters.Add(new AuthorizeFilter(policy)); + }); +#else + services.AddControllersWithViews(); +#endif +#if (OrganizationalAuth || IndividualAuth) + services.AddRazorPages(); +#endif // In production, the Angular files will be served from this directory services.AddSpaStaticFiles(configuration => { @@ -87,11 +99,15 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) #endif app.UseStaticFiles(); app.UseSpaStaticFiles(); -#if (IndividualLocalAuth) + app.UseRouting(); + +#if (IndividualLocalAuth) app.UseAuthentication(); app.UseIdentityServer(); #endif + app.UseAuthorization(); + app.UseEndpoints(endpoints => { endpoints.MapControllerRoute( diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Startup.cs b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Startup.cs index e6314eb0d28c..f25b9852c7cf 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Startup.cs +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Startup.cs @@ -36,13 +36,13 @@ public void ConfigureServices(IServiceCollection services) { #if (IndividualLocalAuth) services.AddDbContext(options => - #if (UseLocalDB) +#if (UseLocalDB) options.UseSqlServer( Configuration.GetConnectionString("DefaultConnection"))); - #else +#else options.UseSqlite( Configuration.GetConnectionString("DefaultConnection"))); - #endif +#endif services.AddDefaultIdentity() .AddEntityFrameworkStores(); @@ -53,7 +53,21 @@ public void ConfigureServices(IServiceCollection services) services.AddAuthentication() .AddIdentityServerJwt(); #endif - services.AddMvc(options => options.EnableEndpointRouting = false); + +#if (OrganizationalAuth) + services.AddControllersWithViews(options => + { + var policy = new AuthorizationPolicyBuilder() + .RequireAuthenticatedUser() + .Build(); + options.Filters.Add(new AuthorizeFilter(policy)); + }); +#else + services.AddControllersWithViews(); +#endif +#if (OrganizationalAuth || IndividualAuth) + services.AddRazorPages(); +#endif // In production, the React files will be served from this directory services.AddSpaStaticFiles(configuration => @@ -87,11 +101,14 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) #endif app.UseStaticFiles(); app.UseSpaStaticFiles(); -#if (IndividualLocalAuth) + app.UseRouting(); + +#if (IndividualLocalAuth) app.UseAuthentication(); app.UseIdentityServer(); #endif + app.UseAuthorization(); app.UseEndpoints(endpoints => { diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/Startup.cs b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/Startup.cs index 5fbc22516b22..800be33b0bf4 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/Startup.cs +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/Startup.cs @@ -23,7 +23,20 @@ public Startup(IConfiguration configuration) // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - services.AddMvc(options => options.EnableEndpointRouting = false); +#if (OrganizationalAuth) + services.AddControllersWithViews(options => + { + var policy = new AuthorizationPolicyBuilder() + .RequireAuthenticatedUser() + .Build(); + options.Filters.Add(new AuthorizeFilter(policy)); + }); +#else + services.AddControllersWithViews(); +#endif +#if (OrganizationalAuth || IndividualAuth) + services.AddRazorPages(); +#endif // In production, the React files will be served from this directory services.AddSpaStaticFiles(configuration => @@ -55,6 +68,14 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) app.UseStaticFiles(); app.UseSpaStaticFiles(); + app.UseRouting(); + +#if (IndividualLocalAuth) + app.UseAuthentication(); + app.UseIdentityServer(); +#endif + app.UseAuthorization(); + app.UseEndpoints(endpoints => { endpoints.MapControllerRoute( From 6fe2b8edecc1570f4ff88ab49daa70d3560033af Mon Sep 17 00:00:00 2001 From: Ryan Brandenburg Date: Mon, 1 Jul 2019 14:48:59 -0700 Subject: [PATCH 04/11] PR feedback --- .../content/Angular-CSharp/Startup.cs | 13 ++----------- .../content/React-CSharp/Startup.cs | 13 ++----------- .../content/ReactRedux-CSharp/Startup.cs | 13 ++----------- 3 files changed, 6 insertions(+), 33 deletions(-) diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Startup.cs b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Startup.cs index 7ead84c39562..5df91dd7d7a9 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Startup.cs +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Startup.cs @@ -53,17 +53,7 @@ public void ConfigureServices(IServiceCollection services) services.AddAuthentication() .AddIdentityServerJwt(); #endif -#if (OrganizationalAuth) - services.AddControllersWithViews(options => - { - var policy = new AuthorizationPolicyBuilder() - .RequireAuthenticatedUser() - .Build(); - options.Filters.Add(new AuthorizeFilter(policy)); - }); -#else services.AddControllersWithViews(); -#endif #if (OrganizationalAuth || IndividualAuth) services.AddRazorPages(); #endif @@ -106,8 +96,9 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) app.UseAuthentication(); app.UseIdentityServer(); #endif +#if (!NoAuth) app.UseAuthorization(); - +#endif app.UseEndpoints(endpoints => { endpoints.MapControllerRoute( diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Startup.cs b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Startup.cs index f25b9852c7cf..c1a42a4b5c15 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Startup.cs +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Startup.cs @@ -54,17 +54,7 @@ public void ConfigureServices(IServiceCollection services) .AddIdentityServerJwt(); #endif -#if (OrganizationalAuth) - services.AddControllersWithViews(options => - { - var policy = new AuthorizationPolicyBuilder() - .RequireAuthenticatedUser() - .Build(); - options.Filters.Add(new AuthorizeFilter(policy)); - }); -#else services.AddControllersWithViews(); -#endif #if (OrganizationalAuth || IndividualAuth) services.AddRazorPages(); #endif @@ -108,8 +98,9 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) app.UseAuthentication(); app.UseIdentityServer(); #endif +#if (!NoAuth) app.UseAuthorization(); - +#endif app.UseEndpoints(endpoints => { endpoints.MapControllerRoute( diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/Startup.cs b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/Startup.cs index 800be33b0bf4..3c11809510cf 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/Startup.cs +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/Startup.cs @@ -23,17 +23,7 @@ public Startup(IConfiguration configuration) // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { -#if (OrganizationalAuth) - services.AddControllersWithViews(options => - { - var policy = new AuthorizationPolicyBuilder() - .RequireAuthenticatedUser() - .Build(); - options.Filters.Add(new AuthorizeFilter(policy)); - }); -#else services.AddControllersWithViews(); -#endif #if (OrganizationalAuth || IndividualAuth) services.AddRazorPages(); #endif @@ -74,8 +64,9 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) app.UseAuthentication(); app.UseIdentityServer(); #endif +#if (!NoAuth) app.UseAuthorization(); - +#endif app.UseEndpoints(endpoints => { endpoints.MapControllerRoute( From 7af00e7bbef2726007d6e7d15341bc22e4de3085 Mon Sep 17 00:00:00 2001 From: Ryan Brandenburg Date: Tue, 2 Jul 2019 11:43:40 -0700 Subject: [PATCH 05/11] Don't make the same mistake twice --- .../content/ReactRedux-CSharp/Startup.cs | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/Startup.cs b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/Startup.cs index 3c11809510cf..2281a7ed77e4 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/Startup.cs +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/ReactRedux-CSharp/Startup.cs @@ -24,9 +24,6 @@ public Startup(IConfiguration configuration) public void ConfigureServices(IServiceCollection services) { services.AddControllersWithViews(); -#if (OrganizationalAuth || IndividualAuth) - services.AddRazorPages(); -#endif // In production, the React files will be served from this directory services.AddSpaStaticFiles(configuration => @@ -60,13 +57,6 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) app.UseRouting(); -#if (IndividualLocalAuth) - app.UseAuthentication(); - app.UseIdentityServer(); -#endif -#if (!NoAuth) - app.UseAuthorization(); -#endif app.UseEndpoints(endpoints => { endpoints.MapControllerRoute( From 9369da870bcb0357ee972dc2114f30fd3e74814a Mon Sep 17 00:00:00 2001 From: Ryan Brandenburg Date: Wed, 3 Jul 2019 13:37:49 -0700 Subject: [PATCH 06/11] Resolve rebase problems --- src/Antiforgery/src/IAntiforgery.cs | 2 + .../ConfigurationModel/SecretExtensions.cs | 5 +- .../src/GenericHostBuilderExtensions.cs | 2 +- .../JsonPatch/src/JsonPatchDocument.cs | 12 ++--- .../JsonPatch/src/JsonPatchDocumentOfT.cs | 52 +++++++++---------- src/Hosting/Abstractions/src/IWebHost.cs | 4 +- src/Hosting/Hosting/src/WebHostExtensions.cs | 3 +- src/Hosting/TestHost/src/RequestBuilder.cs | 10 ++-- .../src/AuthenticateResult.cs | 3 ++ .../AuthenticationHttpContextExtensions.cs | 2 +- .../src/IAuthenticationRequestHandler.cs | 2 +- src/Http/Http.Abstractions/src/HostString.cs | 45 ++++++++-------- src/Http/Http.Extensions/src/UriHelper.cs | 11 ++-- .../src/IdentityRoleClaim.cs | 4 +- .../WsFederation/src/WsFederationHandler.cs | 8 +-- 15 files changed, 88 insertions(+), 77 deletions(-) diff --git a/src/Antiforgery/src/IAntiforgery.cs b/src/Antiforgery/src/IAntiforgery.cs index 89630a46d092..425f5d592009 100644 --- a/src/Antiforgery/src/IAntiforgery.cs +++ b/src/Antiforgery/src/IAntiforgery.cs @@ -29,6 +29,7 @@ public interface IAntiforgery /// Generates an for this request. /// /// The associated with the current request. + /// The for this request. /// /// Unlike , this method has no side effect. The caller /// is responsible for setting the response cookie and injecting the returned @@ -51,6 +52,7 @@ public interface IAntiforgery /// Validates an antiforgery token that was supplied as part of the request. /// /// The associated with the current request. + /// A that completes when validation has completed. /// /// Thrown when the request does not include a valid antiforgery token. /// diff --git a/src/DataProtection/DataProtection/src/AuthenticatedEncryption/ConfigurationModel/SecretExtensions.cs b/src/DataProtection/DataProtection/src/AuthenticatedEncryption/ConfigurationModel/SecretExtensions.cs index 75444140c8aa..4876247762d2 100644 --- a/src/DataProtection/DataProtection/src/AuthenticatedEncryption/ConfigurationModel/SecretExtensions.cs +++ b/src/DataProtection/DataProtection/src/AuthenticatedEncryption/ConfigurationModel/SecretExtensions.cs @@ -12,7 +12,8 @@ internal unsafe static class SecretExtensions /// Converts an to an <masterKey> element which is marked /// as requiring encryption. /// - /// + /// The secret for accessing the master key. + /// The master key . public static XElement ToMasterKeyElement(this ISecret secret) { // Technically we'll be keeping the unprotected secret around in memory as @@ -43,7 +44,7 @@ public static XElement ToMasterKeyElement(this ISecret secret) /// /// Converts a base64-encoded string into an . /// - /// + /// The . public static Secret ToSecret(this string base64String) { byte[] unprotectedSecret = Convert.FromBase64String(base64String); diff --git a/src/DefaultBuilder/src/GenericHostBuilderExtensions.cs b/src/DefaultBuilder/src/GenericHostBuilderExtensions.cs index 2b8d3df2758e..4e11e3c2ca67 100644 --- a/src/DefaultBuilder/src/GenericHostBuilderExtensions.cs +++ b/src/DefaultBuilder/src/GenericHostBuilderExtensions.cs @@ -21,7 +21,7 @@ public static class GenericHostBuilderExtensions /// /// The instance to configure /// The configure callback - /// + /// The for chaining. public static IHostBuilder ConfigureWebHostDefaults(this IHostBuilder builder, Action configure) { return builder.ConfigureWebHost(webHostBuilder => diff --git a/src/Features/JsonPatch/src/JsonPatchDocument.cs b/src/Features/JsonPatch/src/JsonPatchDocument.cs index 1888ea6b4b0a..80c39a6e6c4b 100644 --- a/src/Features/JsonPatch/src/JsonPatchDocument.cs +++ b/src/Features/JsonPatch/src/JsonPatchDocument.cs @@ -52,7 +52,7 @@ public JsonPatchDocument(List operations, IContractResolver contractR /// /// target location /// value - /// + /// The for chaining. public JsonPatchDocument Add(string path, object value) { if (path == null) @@ -69,7 +69,7 @@ public JsonPatchDocument Add(string path, object value) /// { "op": "remove", "path": "/a/b/c" } /// /// target location - /// + /// The for chaining. public JsonPatchDocument Remove(string path) { if (path == null) @@ -87,7 +87,7 @@ public JsonPatchDocument Remove(string path) /// /// target location /// value - /// + /// The for chaining. public JsonPatchDocument Replace(string path, object value) { if (path == null) @@ -105,7 +105,7 @@ public JsonPatchDocument Replace(string path, object value) /// /// target location /// value - /// + /// The for chaining. public JsonPatchDocument Test(string path, object value) { if (path == null) @@ -123,7 +123,7 @@ public JsonPatchDocument Test(string path, object value) /// /// source location /// target location - /// + /// The for chaining. public JsonPatchDocument Move(string from, string path) { if (from == null) @@ -146,7 +146,7 @@ public JsonPatchDocument Move(string from, string path) /// /// source location /// target location - /// + /// The for chaining. public JsonPatchDocument Copy(string from, string path) { if (from == null) diff --git a/src/Features/JsonPatch/src/JsonPatchDocumentOfT.cs b/src/Features/JsonPatch/src/JsonPatchDocumentOfT.cs index e0b4fca240cd..1b5e6ce0fc18 100644 --- a/src/Features/JsonPatch/src/JsonPatchDocumentOfT.cs +++ b/src/Features/JsonPatch/src/JsonPatchDocumentOfT.cs @@ -48,7 +48,7 @@ public JsonPatchDocument(List> operations, IContractResolver c /// value type /// target location /// value - /// + /// The for chaining. public JsonPatchDocument Add(Expression> path, TProp value) { if (path == null) @@ -72,7 +72,7 @@ public JsonPatchDocument Add(Expression> path /// target location /// value /// position - /// + /// The for chaining. public JsonPatchDocument Add( Expression>> path, TProp value, @@ -98,7 +98,7 @@ public JsonPatchDocument Add( /// value type /// target location /// value - /// + /// The for chaining. public JsonPatchDocument Add(Expression>> path, TProp value) { if (path == null) @@ -120,7 +120,7 @@ public JsonPatchDocument Add(Expression /// { "op": "remove", "path": "/a/b/c" } /// /// target location - /// + /// The for chaining. public JsonPatchDocument Remove(Expression> path) { if (path == null) @@ -139,7 +139,7 @@ public JsonPatchDocument Remove(Expression> p /// value type /// target location /// position - /// + /// The for chaining. public JsonPatchDocument Remove(Expression>> path, int position) { if (path == null) @@ -160,7 +160,7 @@ public JsonPatchDocument Remove(Expression /// value type /// target location - /// + /// The for chaining. public JsonPatchDocument Remove(Expression>> path) { if (path == null) @@ -182,7 +182,7 @@ public JsonPatchDocument Remove(Expression /// target location /// value - /// + /// The for chaining. public JsonPatchDocument Replace(Expression> path, TProp value) { if (path == null) @@ -206,7 +206,7 @@ public JsonPatchDocument Replace(Expression> /// target location /// value /// position - /// + /// The for chaining. public JsonPatchDocument Replace(Expression>> path, TProp value, int position) { @@ -230,7 +230,7 @@ public JsonPatchDocument Replace(Expressionvalue type /// target location /// value - /// + /// The for chaining. public JsonPatchDocument Replace(Expression>> path, TProp value) { if (path == null) @@ -253,7 +253,7 @@ public JsonPatchDocument Replace(Expression /// target location /// value - /// + /// The for chaining. public JsonPatchDocument Test(Expression> path, TProp value) { if (path == null) @@ -277,7 +277,7 @@ public JsonPatchDocument Test(Expression> pat /// target location /// value /// position - /// + /// The for chaining. public JsonPatchDocument Test(Expression>> path, TProp value, int position) { @@ -301,7 +301,7 @@ public JsonPatchDocument Test(Expressionvalue type /// target location /// value - /// + /// The for chaining. public JsonPatchDocument Test(Expression>> path, TProp value) { if (path == null) @@ -324,7 +324,7 @@ public JsonPatchDocument Test(Expression /// source location /// target location - /// + /// The for chaining. public JsonPatchDocument Move( Expression> from, Expression> path) @@ -354,7 +354,7 @@ public JsonPatchDocument Move( /// source location /// position /// target location - /// + /// The for chaining. public JsonPatchDocument Move( Expression>> from, int positionFrom, @@ -385,7 +385,7 @@ public JsonPatchDocument Move( /// source location /// target location /// position - /// + /// The for chaining. public JsonPatchDocument Move( Expression> from, Expression>> path, @@ -417,7 +417,7 @@ public JsonPatchDocument Move( /// position (source) /// target location /// position (target) - /// + /// The for chaining. public JsonPatchDocument Move( Expression>> from, int positionFrom, @@ -449,7 +449,7 @@ public JsonPatchDocument Move( /// source location /// position /// target location - /// + /// The for chaining. public JsonPatchDocument Move( Expression>> from, int positionFrom, @@ -479,7 +479,7 @@ public JsonPatchDocument Move( /// /// source location /// target location - /// + /// The for chaining. public JsonPatchDocument Move( Expression> from, Expression>> path) @@ -508,7 +508,7 @@ public JsonPatchDocument Move( /// /// source location /// target location - /// + /// The for chaining. public JsonPatchDocument Copy( Expression> from, Expression> path) @@ -538,7 +538,7 @@ public JsonPatchDocument Copy( /// source location /// position /// target location - /// + /// The for chaining. public JsonPatchDocument Copy( Expression>> from, int positionFrom, @@ -569,7 +569,7 @@ public JsonPatchDocument Copy( /// source location /// target location /// position - /// + /// The for chaining. public JsonPatchDocument Copy( Expression> from, Expression>> path, @@ -601,7 +601,7 @@ public JsonPatchDocument Copy( /// position (source) /// target location /// position (target) - /// + /// The for chaining. public JsonPatchDocument Copy( Expression>> from, int positionFrom, @@ -633,7 +633,7 @@ public JsonPatchDocument Copy( /// source location /// position /// target location - /// + /// The for chaining. public JsonPatchDocument Copy( Expression>> from, int positionFrom, @@ -663,7 +663,7 @@ public JsonPatchDocument Copy( /// /// source location /// target location - /// + /// The for chaining. public JsonPatchDocument Copy( Expression> from, Expression>> path) @@ -868,7 +868,7 @@ private static bool ContinueWithSubPath(ExpressionType expressionType) } - // Evaluates the value of the key or index which may be an int or a string, + // Evaluates the value of the key or index which may be an int or a string, // or some other expression type. // The expression is converted to a delegate and the result of executing the delegate is returned as a string. private static string EvaluateExpression(Expression expression) @@ -881,4 +881,4 @@ private static string EvaluateExpression(Expression expression) return Convert.ToString(func(null), CultureInfo.InvariantCulture); } } -} \ No newline at end of file +} diff --git a/src/Hosting/Abstractions/src/IWebHost.cs b/src/Hosting/Abstractions/src/IWebHost.cs index e6bd78de6cc8..a9f84eecdcba 100644 --- a/src/Hosting/Abstractions/src/IWebHost.cs +++ b/src/Hosting/Abstractions/src/IWebHost.cs @@ -38,8 +38,8 @@ public interface IWebHost : IDisposable /// /// Attempt to gracefully stop the host. /// - /// - /// + /// Used to indicate when stop should no longer be graceful. + /// A that completes when the stops. Task StopAsync(CancellationToken cancellationToken = default); } } diff --git a/src/Hosting/Hosting/src/WebHostExtensions.cs b/src/Hosting/Hosting/src/WebHostExtensions.cs index a356f584894a..0b594be84f84 100644 --- a/src/Hosting/Hosting/src/WebHostExtensions.cs +++ b/src/Hosting/Hosting/src/WebHostExtensions.cs @@ -18,7 +18,7 @@ public static class WebHostExtensions /// /// The timeout for stopping gracefully. Once expired the /// server may terminate any remaining active connections. - /// + /// A that completes when the stops. public static Task StopAsync(this IWebHost host, TimeSpan timeout) { return host.StopAsync(new CancellationTokenSource(timeout).Token); @@ -38,6 +38,7 @@ public static void WaitForShutdown(this IWebHost host) /// /// The running . /// The token to trigger shutdown. + /// A that completes when shutdown is triggered via Ctrl+C or SIGTERM. public static async Task WaitForShutdownAsync(this IWebHost host, CancellationToken token = default) { var done = new ManualResetEventSlim(false); diff --git a/src/Hosting/TestHost/src/RequestBuilder.cs b/src/Hosting/TestHost/src/RequestBuilder.cs index 644257992e8b..c8499fc02572 100644 --- a/src/Hosting/TestHost/src/RequestBuilder.cs +++ b/src/Hosting/TestHost/src/RequestBuilder.cs @@ -35,7 +35,7 @@ public RequestBuilder(TestServer server, string path) /// Configure any HttpRequestMessage properties. /// /// - /// + /// This for chaining. public RequestBuilder And(Action configure) { if (configure == null) @@ -52,7 +52,7 @@ public RequestBuilder And(Action configure) /// /// /// - /// + /// This for chaining. public RequestBuilder AddHeader(string name, string value) { if (!_req.Headers.TryAddWithoutValidation(name, value)) @@ -74,7 +74,7 @@ public RequestBuilder AddHeader(string name, string value) /// Set the request method and start processing the request. /// /// - /// + /// The resulting . public Task SendAsync(string method) { _req.Method = new HttpMethod(method); @@ -84,7 +84,7 @@ public Task SendAsync(string method) /// /// Set the request method to GET and start processing the request. /// - /// + /// The resulting . public Task GetAsync() { _req.Method = HttpMethod.Get; @@ -94,7 +94,7 @@ public Task GetAsync() /// /// Set the request method to POST and start processing the request. /// - /// + /// The resulting . public Task PostAsync() { _req.Method = HttpMethod.Post; diff --git a/src/Http/Authentication.Abstractions/src/AuthenticateResult.cs b/src/Http/Authentication.Abstractions/src/AuthenticateResult.cs index 5982143bcb9a..fe31859ed461 100644 --- a/src/Http/Authentication.Abstractions/src/AuthenticateResult.cs +++ b/src/Http/Authentication.Abstractions/src/AuthenticateResult.cs @@ -11,6 +11,9 @@ namespace Microsoft.AspNetCore.Authentication /// public class AuthenticateResult { + /// + /// Creates a new instance. + /// protected AuthenticateResult() { } /// diff --git a/src/Http/Authentication.Abstractions/src/AuthenticationHttpContextExtensions.cs b/src/Http/Authentication.Abstractions/src/AuthenticationHttpContextExtensions.cs index bb50c6534f5e..0b40426098b2 100644 --- a/src/Http/Authentication.Abstractions/src/AuthenticationHttpContextExtensions.cs +++ b/src/Http/Authentication.Abstractions/src/AuthenticationHttpContextExtensions.cs @@ -171,7 +171,7 @@ public static Task SignInAsync(this HttpContext context, string scheme, ClaimsPr /// The context. /// The name of the authentication scheme. /// The properties. - /// + /// The task. public static Task SignOutAsync(this HttpContext context, string scheme, AuthenticationProperties properties) => context.RequestServices.GetRequiredService().SignOutAsync(context, scheme, properties); diff --git a/src/Http/Authentication.Abstractions/src/IAuthenticationRequestHandler.cs b/src/Http/Authentication.Abstractions/src/IAuthenticationRequestHandler.cs index fb1b227ad7a0..d2822cdc8804 100644 --- a/src/Http/Authentication.Abstractions/src/IAuthenticationRequestHandler.cs +++ b/src/Http/Authentication.Abstractions/src/IAuthenticationRequestHandler.cs @@ -13,7 +13,7 @@ public interface IAuthenticationRequestHandler : IAuthenticationHandler /// /// Returns true if request processing should stop. /// - /// + /// true if request processing should stop. Task HandleRequestAsync(); } diff --git a/src/Http/Http.Abstractions/src/HostString.cs b/src/Http/Http.Abstractions/src/HostString.cs index 0e3da28c4180..23850231bf91 100644 --- a/src/Http/Http.Abstractions/src/HostString.cs +++ b/src/Http/Http.Abstractions/src/HostString.cs @@ -51,7 +51,7 @@ public HostString(string host, int port) && host.IndexOf(':', index + 1) >= 0) { // IPv6 without brackets ::1 is the only type of host with 2 or more colons - host = $"[{host}]"; + host = $"[{host}]"; } _value = host + ":" + port.ToString(CultureInfo.InvariantCulture); @@ -74,7 +74,7 @@ public bool HasValue /// Returns the value of the host part of the value. The port is removed if it was present. /// IPv6 addresses will have brackets added if they are missing. /// - /// + /// The host portion of the value. public string Host { get @@ -88,7 +88,7 @@ public string Host /// /// Returns the value of the port part of the host, or null if none is found. /// - /// + /// The port portion of the value. public int? Port { get @@ -108,7 +108,7 @@ public int? Port /// /// Returns the value as normalized by ToUriComponent(). /// - /// + /// The value as normalized by . public override string ToString() { return ToUriComponent(); @@ -118,7 +118,7 @@ public override string ToString() /// Returns the value properly formatted and encoded for use in a URI in a HTTP header. /// Any Unicode is converted to punycode. IPv6 addresses will have brackets added if they are missing. /// - /// + /// The value formated for use in a URI or HTTP header. public string ToUriComponent() { if (string.IsNullOrEmpty(_value)) @@ -154,8 +154,8 @@ public string ToUriComponent() /// Creates a new HostString from the given URI component. /// Any punycode will be converted to Unicode. /// - /// - /// + /// The URI component string to create a from. + /// The that was created. public static HostString FromUriComponent(string uriComponent) { if (!string.IsNullOrEmpty(uriComponent)) @@ -195,8 +195,8 @@ public static HostString FromUriComponent(string uriComponent) /// Creates a new HostString from the host and port of the give Uri instance. /// Punycode will be converted to Unicode. /// - /// - /// + /// The to create a from. + /// The that was created. public static HostString FromUriComponent(Uri uri) { if (uri == null) @@ -223,7 +223,7 @@ public static HostString FromUriComponent(Uri uri) /// "abc.example.com:443" but not "example.com:443". /// Matching is case insensitive. /// - /// + /// true if matches any of the patterns. public static bool MatchesAny(StringSegment value, IList patterns) { if (value == null) @@ -281,8 +281,8 @@ public static bool MatchesAny(StringSegment value, IList patterns /// /// Compares the equality of the Value property, ignoring case. /// - /// - /// + /// The to compare against. + /// true if they have the same value. public bool Equals(HostString other) { if (!HasValue && !other.HasValue) @@ -295,8 +295,8 @@ public bool Equals(HostString other) /// /// Compares against the given object only if it is a HostString. /// - /// - /// + /// The to compare against. + /// true if they have the same value. public override bool Equals(object obj) { if (ReferenceEquals(null, obj)) @@ -309,7 +309,7 @@ public override bool Equals(object obj) /// /// Gets a hash code for the value. /// - /// + /// The hash code as an . public override int GetHashCode() { return (HasValue ? StringComparer.OrdinalIgnoreCase.GetHashCode(_value) : 0); @@ -318,9 +318,9 @@ public override int GetHashCode() /// /// Compares the two instances for equality. /// - /// - /// - /// + /// The left parameter. + /// The right parameter. + /// true if both 's have the same value. public static bool operator ==(HostString left, HostString right) { return left.Equals(right); @@ -329,9 +329,9 @@ public override int GetHashCode() /// /// Compares the two instances for inequality. /// - /// - /// - /// + /// The left parameter. + /// The right parameter. + /// true if both 's values are not equal. public static bool operator !=(HostString left, HostString right) { return !left.Equals(right); @@ -340,6 +340,9 @@ public override int GetHashCode() /// /// Parses the current value. IPv6 addresses will have brackets added if they are missing. /// + /// The value to get the parts of. + /// The portion of the which represents the host. + /// The portion of the which represents the port. private static void GetParts(StringSegment value, out StringSegment host, out StringSegment port) { int index; diff --git a/src/Http/Http.Extensions/src/UriHelper.cs b/src/Http/Http.Extensions/src/UriHelper.cs index 4c1507b604e6..8db49359bb98 100644 --- a/src/Http/Http.Extensions/src/UriHelper.cs +++ b/src/Http/Http.Extensions/src/UriHelper.cs @@ -23,7 +23,7 @@ public static class UriHelper /// The portion of the request path that identifies the requested resource. /// The query, if any. /// The fragment, if any. - /// + /// The combined URI components, properly encoded for use in HTTP headers. public static string BuildRelative( PathString pathBase = new PathString(), PathString path = new PathString(), @@ -44,7 +44,7 @@ public static string BuildRelative( /// The portion of the request path that identifies the requested resource. /// The query, if any. /// The fragment, if any. - /// + /// The combined URI components, properly encoded for use in HTTP headers. public static string BuildAbsolute( string scheme, HostString host, @@ -143,7 +143,7 @@ public static void FromAbsolute( /// HTTP headers. Note that a unicode host name will be encoded as punycode. /// /// The Uri to encode. - /// + /// The encoded string version of . public static string Encode(Uri uri) { if (uri == null) @@ -180,7 +180,7 @@ public static string GetEncodedUrl(this HttpRequest request) /// Returns the relative URI. /// /// The request to assemble the uri pieces from. - /// + /// The path and query off of . public static string GetEncodedPathAndQuery(this HttpRequest request) { return BuildRelative(request.PathBase, request.Path, request.QueryString); @@ -191,7 +191,8 @@ public static string GetEncodedPathAndQuery(this HttpRequest request) /// suitable only for display. This format should not be used in HTTP headers or other HTTP operations. /// /// The request to assemble the uri pieces from. - /// + /// The combined components of the request URL in a fully un-escaped form (except for the QueryString) + /// suitable only for display. public static string GetDisplayUrl(this HttpRequest request) { var scheme = request.Scheme ?? string.Empty; diff --git a/src/Identity/Extensions.Stores/src/IdentityRoleClaim.cs b/src/Identity/Extensions.Stores/src/IdentityRoleClaim.cs index ff257d59ed63..3f59b2665eea 100644 --- a/src/Identity/Extensions.Stores/src/IdentityRoleClaim.cs +++ b/src/Identity/Extensions.Stores/src/IdentityRoleClaim.cs @@ -35,7 +35,7 @@ public class IdentityRoleClaim where TKey : IEquatable /// /// Constructs a new claim with the type and value. /// - /// + /// The that was produced. public virtual Claim ToClaim() { return new Claim(ClaimType, ClaimValue); @@ -51,4 +51,4 @@ public virtual void InitializeFromClaim(Claim other) ClaimValue = other?.Value; } } -} \ No newline at end of file +} diff --git a/src/Security/Authentication/WsFederation/src/WsFederationHandler.cs b/src/Security/Authentication/WsFederation/src/WsFederationHandler.cs index 6e1f59a44fe2..27bb332ccf52 100644 --- a/src/Security/Authentication/WsFederation/src/WsFederationHandler.cs +++ b/src/Security/Authentication/WsFederation/src/WsFederationHandler.cs @@ -54,7 +54,7 @@ public WsFederationHandler(IOptionsMonitor options, ILogger /// /// Overridden to handle remote signout requests /// - /// + /// true if request processing should stop. public override Task HandleRequestAsync() { // RemoteSignOutPath and CallbackPath may be the same, fall through if the message doesn't match. @@ -149,7 +149,7 @@ protected override async Task HandleRemoteAuthenticateAsync && Request.Body.CanRead) { var form = await Request.ReadFormAsync(); - + wsFederationMessage = new WsFederationMessage(form.Select(pair => new KeyValuePair(pair.Key, pair.Value))); } @@ -163,7 +163,7 @@ protected override async Task HandleRemoteAuthenticateAsync return HandleRequestResult.Fail("No message."); } - + try { // Retrieve our cached redirect uri @@ -422,4 +422,4 @@ private string BuildRedirectUriIfRelative(string uri) return BuildRedirectUri(uri); } } -} \ No newline at end of file +} From d8874a59fb6e4288c56a479e8991dd9030f2f5a0 Mon Sep 17 00:00:00 2001 From: Ryan Brandenburg Date: Wed, 17 Jul 2019 15:26:36 -0700 Subject: [PATCH 07/11] Remove missing variable --- .../Web.Spa.ProjectTemplates/content/Angular-CSharp/Startup.cs | 2 +- .../Web.Spa.ProjectTemplates/content/React-CSharp/Startup.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Startup.cs b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Startup.cs index 5df91dd7d7a9..122cc149d3e5 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Startup.cs +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Startup.cs @@ -54,7 +54,7 @@ public void ConfigureServices(IServiceCollection services) .AddIdentityServerJwt(); #endif services.AddControllersWithViews(); -#if (OrganizationalAuth || IndividualAuth) +#if (IndividualAuth) services.AddRazorPages(); #endif // In production, the Angular files will be served from this directory diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Startup.cs b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Startup.cs index c1a42a4b5c15..54b8a2c4de8d 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Startup.cs +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Startup.cs @@ -55,7 +55,7 @@ public void ConfigureServices(IServiceCollection services) #endif services.AddControllersWithViews(); -#if (OrganizationalAuth || IndividualAuth) +#if (IndividualAuth) services.AddRazorPages(); #endif From 2bb5b04049adcd381e1e09dbf3e9fc15e4ed71bc Mon Sep 17 00:00:00 2001 From: Ryan Brandenburg Date: Thu, 18 Jul 2019 16:45:35 -0700 Subject: [PATCH 08/11] MapRazorPages --- .../Web.Spa.ProjectTemplates/content/Angular-CSharp/Startup.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Startup.cs b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Startup.cs index 122cc149d3e5..61ab0a2c883f 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Startup.cs +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Startup.cs @@ -104,6 +104,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) endpoints.MapControllerRoute( name: "default", pattern: "{controller}/{action=Index}/{id?}"); + endpoints.MapRazorPages(); }); app.UseSpa(spa => From 0c96d3703871dfc74d7a9dd72e6cdebe5639e1d6 Mon Sep 17 00:00:00 2001 From: Ryan Brandenburg Date: Fri, 19 Jul 2019 09:19:35 -0700 Subject: [PATCH 09/11] Conditionalize --- .../Web.Spa.ProjectTemplates/content/Angular-CSharp/Startup.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Startup.cs b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Startup.cs index 61ab0a2c883f..f4e5ccff1e3c 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Startup.cs +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Startup.cs @@ -104,7 +104,9 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) endpoints.MapControllerRoute( name: "default", pattern: "{controller}/{action=Index}/{id?}"); +#if (IndividualAuth) endpoints.MapRazorPages(); +#endif }); app.UseSpa(spa => From b6476d3adc8c8fad865ac1963a95dae1b9fc23fd Mon Sep 17 00:00:00 2001 From: Ryan Brandenburg Date: Fri, 19 Jul 2019 12:59:54 -0700 Subject: [PATCH 10/11] Use variables that exist --- .../content/Angular-CSharp/Startup.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Startup.cs b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Startup.cs index f4e5ccff1e3c..d6e4a775ccde 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Startup.cs +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/Angular-CSharp/Startup.cs @@ -54,7 +54,7 @@ public void ConfigureServices(IServiceCollection services) .AddIdentityServerJwt(); #endif services.AddControllersWithViews(); -#if (IndividualAuth) +#if (IndividualLocalAuth) services.AddRazorPages(); #endif // In production, the Angular files will be served from this directory @@ -104,7 +104,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) endpoints.MapControllerRoute( name: "default", pattern: "{controller}/{action=Index}/{id?}"); -#if (IndividualAuth) +#if (IndividualLocalAuth) endpoints.MapRazorPages(); #endif }); From db6aa55cdc12f1ba395b191ca8836536d358894c Mon Sep 17 00:00:00 2001 From: Ryan Brandenburg Date: Fri, 19 Jul 2019 14:53:25 -0700 Subject: [PATCH 11/11] Fix variable names --- .../Web.Spa.ProjectTemplates/content/React-CSharp/Startup.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Startup.cs b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Startup.cs index 54b8a2c4de8d..13319df968bf 100644 --- a/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Startup.cs +++ b/src/ProjectTemplates/Web.Spa.ProjectTemplates/content/React-CSharp/Startup.cs @@ -55,7 +55,7 @@ public void ConfigureServices(IServiceCollection services) #endif services.AddControllersWithViews(); -#if (IndividualAuth) +#if (IndividualLocalAuth) services.AddRazorPages(); #endif @@ -106,6 +106,9 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) endpoints.MapControllerRoute( name: "default", pattern: "{controller}/{action=Index}/{id?}"); +#if (IndividualLocalAuth) + endpoints.MapRazorPages(); +#endif }); app.UseSpa(spa =>