parent
321db9d99f
commit
33eb8ba552
|
|
@ -29,6 +29,7 @@ namespace Microsoft.AspNetCore.Antiforgery
|
|||
/// Generates an <see cref="AntiforgeryTokenSet"/> for this request.
|
||||
/// </summary>
|
||||
/// <param name="httpContext">The <see cref="HttpContext"/> associated with the current request.</param>
|
||||
/// <returns>The <see cref="AntiforgeryTokenSet"/> for this request.</returns>
|
||||
/// <remarks>
|
||||
/// Unlike <see cref="GetAndStoreTokens(HttpContext)"/>, this method has no side effect. The caller
|
||||
/// is responsible for setting the response cookie and injecting the returned
|
||||
|
|
@ -51,6 +52,7 @@ namespace Microsoft.AspNetCore.Antiforgery
|
|||
/// Validates an antiforgery token that was supplied as part of the request.
|
||||
/// </summary>
|
||||
/// <param name="httpContext">The <see cref="HttpContext"/> associated with the current request.</param>
|
||||
/// <returns>A <see cref="Task"/> that completes when validation has completed.</returns>
|
||||
/// <exception cref="AntiforgeryValidationException">
|
||||
/// Thrown when the request does not include a valid antiforgery token.
|
||||
/// </exception>
|
||||
|
|
|
|||
|
|
@ -12,7 +12,8 @@ namespace Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.Configurat
|
|||
/// Converts an <see cref="ISecret"/> to an <masterKey> element which is marked
|
||||
/// as requiring encryption.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <param name="secret">The secret for accessing the master key.</param>
|
||||
/// <returns>The master key <see cref="XElement"/>.</returns>
|
||||
public static XElement ToMasterKeyElement(this ISecret secret)
|
||||
{
|
||||
// Technically we'll be keeping the unprotected secret around in memory as
|
||||
|
|
@ -43,7 +44,7 @@ namespace Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.Configurat
|
|||
/// <summary>
|
||||
/// Converts a base64-encoded string into an <see cref="ISecret"/>.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <returns>The <see cref="Secret"/>.</returns>
|
||||
public static Secret ToSecret(this string base64String)
|
||||
{
|
||||
byte[] unprotectedSecret = Convert.FromBase64String(base64String);
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ namespace Microsoft.Extensions.Hosting
|
|||
/// </remarks>
|
||||
/// <param name="builder">The <see cref="IHostBuilder" /> instance to configure</param>
|
||||
/// <param name="configure">The configure callback</param>
|
||||
/// <returns></returns>
|
||||
/// <returns>The <see cref="IHostBuilder"/> for chaining.</returns>
|
||||
public static IHostBuilder ConfigureWebHostDefaults(this IHostBuilder builder, Action<IWebHostBuilder> configure)
|
||||
{
|
||||
return builder.ConfigureWebHost(webHostBuilder =>
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ namespace Microsoft.AspNetCore.JsonPatch
|
|||
/// </summary>
|
||||
/// <param name="path">target location</param>
|
||||
/// <param name="value">value</param>
|
||||
/// <returns></returns>
|
||||
/// <returns>The <see cref="JsonPatchDocument"/> for chaining.</returns>
|
||||
public JsonPatchDocument Add(string path, object value)
|
||||
{
|
||||
if (path == null)
|
||||
|
|
@ -69,7 +69,7 @@ namespace Microsoft.AspNetCore.JsonPatch
|
|||
/// { "op": "remove", "path": "/a/b/c" }
|
||||
/// </summary>
|
||||
/// <param name="path">target location</param>
|
||||
/// <returns></returns>
|
||||
/// <returns>The <see cref="JsonPatchDocument"/> for chaining.</returns>
|
||||
public JsonPatchDocument Remove(string path)
|
||||
{
|
||||
if (path == null)
|
||||
|
|
@ -87,7 +87,7 @@ namespace Microsoft.AspNetCore.JsonPatch
|
|||
/// </summary>
|
||||
/// <param name="path">target location</param>
|
||||
/// <param name="value">value</param>
|
||||
/// <returns></returns>
|
||||
/// <returns>The <see cref="JsonPatchDocument"/> for chaining.</returns>
|
||||
public JsonPatchDocument Replace(string path, object value)
|
||||
{
|
||||
if (path == null)
|
||||
|
|
@ -105,7 +105,7 @@ namespace Microsoft.AspNetCore.JsonPatch
|
|||
/// </summary>
|
||||
/// <param name="path">target location</param>
|
||||
/// <param name="value">value</param>
|
||||
/// <returns></returns>
|
||||
/// <returns>The <see cref="JsonPatchDocument"/> for chaining.</returns>
|
||||
public JsonPatchDocument Test(string path, object value)
|
||||
{
|
||||
if (path == null)
|
||||
|
|
@ -123,7 +123,7 @@ namespace Microsoft.AspNetCore.JsonPatch
|
|||
/// </summary>
|
||||
/// <param name="from">source location</param>
|
||||
/// <param name="path">target location</param>
|
||||
/// <returns></returns>
|
||||
/// <returns>The <see cref="JsonPatchDocument"/> for chaining.</returns>
|
||||
public JsonPatchDocument Move(string from, string path)
|
||||
{
|
||||
if (from == null)
|
||||
|
|
@ -146,7 +146,7 @@ namespace Microsoft.AspNetCore.JsonPatch
|
|||
/// </summary>
|
||||
/// <param name="from">source location</param>
|
||||
/// <param name="path">target location</param>
|
||||
/// <returns></returns>
|
||||
/// <returns>The <see cref="JsonPatchDocument"/> for chaining.</returns>
|
||||
public JsonPatchDocument Copy(string from, string path)
|
||||
{
|
||||
if (from == null)
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ namespace Microsoft.AspNetCore.JsonPatch
|
|||
/// <typeparam name="TProp">value type</typeparam>
|
||||
/// <param name="path">target location</param>
|
||||
/// <param name="value">value</param>
|
||||
/// <returns></returns>
|
||||
/// <returns>The <see cref="JsonPatchDocument{TModel}"/> for chaining.</returns>
|
||||
public JsonPatchDocument<TModel> Add<TProp>(Expression<Func<TModel, TProp>> path, TProp value)
|
||||
{
|
||||
if (path == null)
|
||||
|
|
@ -72,7 +72,7 @@ namespace Microsoft.AspNetCore.JsonPatch
|
|||
/// <param name="path">target location</param>
|
||||
/// <param name="value">value</param>
|
||||
/// <param name="position">position</param>
|
||||
/// <returns></returns>
|
||||
/// <returns>The <see cref="JsonPatchDocument{TModel}"/> for chaining.</returns>
|
||||
public JsonPatchDocument<TModel> Add<TProp>(
|
||||
Expression<Func<TModel, IList<TProp>>> path,
|
||||
TProp value,
|
||||
|
|
@ -98,7 +98,7 @@ namespace Microsoft.AspNetCore.JsonPatch
|
|||
/// <typeparam name="TProp">value type</typeparam>
|
||||
/// <param name="path">target location</param>
|
||||
/// <param name="value">value</param>
|
||||
/// <returns></returns>
|
||||
/// <returns>The <see cref="JsonPatchDocument{TModel}"/> for chaining.</returns>
|
||||
public JsonPatchDocument<TModel> Add<TProp>(Expression<Func<TModel, IList<TProp>>> path, TProp value)
|
||||
{
|
||||
if (path == null)
|
||||
|
|
@ -120,7 +120,7 @@ namespace Microsoft.AspNetCore.JsonPatch
|
|||
/// { "op": "remove", "path": "/a/b/c" }
|
||||
/// </summary>
|
||||
/// <param name="path">target location</param>
|
||||
/// <returns></returns>
|
||||
/// <returns>The <see cref="JsonPatchDocument{TModel}"/> for chaining.</returns>
|
||||
public JsonPatchDocument<TModel> Remove<TProp>(Expression<Func<TModel, TProp>> path)
|
||||
{
|
||||
if (path == null)
|
||||
|
|
@ -139,7 +139,7 @@ namespace Microsoft.AspNetCore.JsonPatch
|
|||
/// <typeparam name="TProp">value type</typeparam>
|
||||
/// <param name="path">target location</param>
|
||||
/// <param name="position">position</param>
|
||||
/// <returns></returns>
|
||||
/// <returns>The <see cref="JsonPatchDocument{TModel}"/> for chaining.</returns>
|
||||
public JsonPatchDocument<TModel> Remove<TProp>(Expression<Func<TModel, IList<TProp>>> path, int position)
|
||||
{
|
||||
if (path == null)
|
||||
|
|
@ -160,7 +160,7 @@ namespace Microsoft.AspNetCore.JsonPatch
|
|||
/// </summary>
|
||||
/// <typeparam name="TProp">value type</typeparam>
|
||||
/// <param name="path">target location</param>
|
||||
/// <returns></returns>
|
||||
/// <returns>The <see cref="JsonPatchDocument{TModel}"/> for chaining.</returns>
|
||||
public JsonPatchDocument<TModel> Remove<TProp>(Expression<Func<TModel, IList<TProp>>> path)
|
||||
{
|
||||
if (path == null)
|
||||
|
|
@ -182,7 +182,7 @@ namespace Microsoft.AspNetCore.JsonPatch
|
|||
/// </summary>
|
||||
/// <param name="path">target location</param>
|
||||
/// <param name="value">value</param>
|
||||
/// <returns></returns>
|
||||
/// <returns>The <see cref="JsonPatchDocument{TModel}"/> for chaining.</returns>
|
||||
public JsonPatchDocument<TModel> Replace<TProp>(Expression<Func<TModel, TProp>> path, TProp value)
|
||||
{
|
||||
if (path == null)
|
||||
|
|
@ -206,7 +206,7 @@ namespace Microsoft.AspNetCore.JsonPatch
|
|||
/// <param name="path">target location</param>
|
||||
/// <param name="value">value</param>
|
||||
/// <param name="position">position</param>
|
||||
/// <returns></returns>
|
||||
/// <returns>The <see cref="JsonPatchDocument{TModel}"/> for chaining.</returns>
|
||||
public JsonPatchDocument<TModel> Replace<TProp>(Expression<Func<TModel, IList<TProp>>> path,
|
||||
TProp value, int position)
|
||||
{
|
||||
|
|
@ -230,7 +230,7 @@ namespace Microsoft.AspNetCore.JsonPatch
|
|||
/// <typeparam name="TProp">value type</typeparam>
|
||||
/// <param name="path">target location</param>
|
||||
/// <param name="value">value</param>
|
||||
/// <returns></returns>
|
||||
/// <returns>The <see cref="JsonPatchDocument{TModel}"/> for chaining.</returns>
|
||||
public JsonPatchDocument<TModel> Replace<TProp>(Expression<Func<TModel, IList<TProp>>> path, TProp value)
|
||||
{
|
||||
if (path == null)
|
||||
|
|
@ -253,7 +253,7 @@ namespace Microsoft.AspNetCore.JsonPatch
|
|||
/// </summary>
|
||||
/// <param name="path">target location</param>
|
||||
/// <param name="value">value</param>
|
||||
/// <returns></returns>
|
||||
/// <returns>The <see cref="JsonPatchDocument{TModel}"/> for chaining.</returns>
|
||||
public JsonPatchDocument<TModel> Test<TProp>(Expression<Func<TModel, TProp>> path, TProp value)
|
||||
{
|
||||
if (path == null)
|
||||
|
|
@ -277,7 +277,7 @@ namespace Microsoft.AspNetCore.JsonPatch
|
|||
/// <param name="path">target location</param>
|
||||
/// <param name="value">value</param>
|
||||
/// <param name="position">position</param>
|
||||
/// <returns></returns>
|
||||
/// <returns>The <see cref="JsonPatchDocument{TModel}"/> for chaining.</returns>
|
||||
public JsonPatchDocument<TModel> Test<TProp>(Expression<Func<TModel, IList<TProp>>> path,
|
||||
TProp value, int position)
|
||||
{
|
||||
|
|
@ -301,7 +301,7 @@ namespace Microsoft.AspNetCore.JsonPatch
|
|||
/// <typeparam name="TProp">value type</typeparam>
|
||||
/// <param name="path">target location</param>
|
||||
/// <param name="value">value</param>
|
||||
/// <returns></returns>
|
||||
/// <returns>The <see cref="JsonPatchDocument{TModel}"/> for chaining.</returns>
|
||||
public JsonPatchDocument<TModel> Test<TProp>(Expression<Func<TModel, IList<TProp>>> path, TProp value)
|
||||
{
|
||||
if (path == null)
|
||||
|
|
@ -324,7 +324,7 @@ namespace Microsoft.AspNetCore.JsonPatch
|
|||
/// </summary>
|
||||
/// <param name="from">source location</param>
|
||||
/// <param name="path">target location</param>
|
||||
/// <returns></returns>
|
||||
/// <returns>The <see cref="JsonPatchDocument{TModel}"/> for chaining.</returns>
|
||||
public JsonPatchDocument<TModel> Move<TProp>(
|
||||
Expression<Func<TModel, TProp>> from,
|
||||
Expression<Func<TModel, TProp>> path)
|
||||
|
|
@ -354,7 +354,7 @@ namespace Microsoft.AspNetCore.JsonPatch
|
|||
/// <param name="from">source location</param>
|
||||
/// <param name="positionFrom">position</param>
|
||||
/// <param name="path">target location</param>
|
||||
/// <returns></returns>
|
||||
/// <returns>The <see cref="JsonPatchDocument{TModel}"/> for chaining.</returns>
|
||||
public JsonPatchDocument<TModel> Move<TProp>(
|
||||
Expression<Func<TModel, IList<TProp>>> from,
|
||||
int positionFrom,
|
||||
|
|
@ -385,7 +385,7 @@ namespace Microsoft.AspNetCore.JsonPatch
|
|||
/// <param name="from">source location</param>
|
||||
/// <param name="path">target location</param>
|
||||
/// <param name="positionTo">position</param>
|
||||
/// <returns></returns>
|
||||
/// <returns>The <see cref="JsonPatchDocument{TModel}"/> for chaining.</returns>
|
||||
public JsonPatchDocument<TModel> Move<TProp>(
|
||||
Expression<Func<TModel, TProp>> from,
|
||||
Expression<Func<TModel, IList<TProp>>> path,
|
||||
|
|
@ -417,7 +417,7 @@ namespace Microsoft.AspNetCore.JsonPatch
|
|||
/// <param name="positionFrom">position (source)</param>
|
||||
/// <param name="path">target location</param>
|
||||
/// <param name="positionTo">position (target)</param>
|
||||
/// <returns></returns>
|
||||
/// <returns>The <see cref="JsonPatchDocument{TModel}"/> for chaining.</returns>
|
||||
public JsonPatchDocument<TModel> Move<TProp>(
|
||||
Expression<Func<TModel, IList<TProp>>> from,
|
||||
int positionFrom,
|
||||
|
|
@ -449,7 +449,7 @@ namespace Microsoft.AspNetCore.JsonPatch
|
|||
/// <param name="from">source location</param>
|
||||
/// <param name="positionFrom">position</param>
|
||||
/// <param name="path">target location</param>
|
||||
/// <returns></returns>
|
||||
/// <returns>The <see cref="JsonPatchDocument{TModel}"/> for chaining.</returns>
|
||||
public JsonPatchDocument<TModel> Move<TProp>(
|
||||
Expression<Func<TModel, IList<TProp>>> from,
|
||||
int positionFrom,
|
||||
|
|
@ -479,7 +479,7 @@ namespace Microsoft.AspNetCore.JsonPatch
|
|||
/// <typeparam name="TProp"></typeparam>
|
||||
/// <param name="from">source location</param>
|
||||
/// <param name="path">target location</param>
|
||||
/// <returns></returns>
|
||||
/// <returns>The <see cref="JsonPatchDocument{TModel}"/> for chaining.</returns>
|
||||
public JsonPatchDocument<TModel> Move<TProp>(
|
||||
Expression<Func<TModel, TProp>> from,
|
||||
Expression<Func<TModel, IList<TProp>>> path)
|
||||
|
|
@ -508,7 +508,7 @@ namespace Microsoft.AspNetCore.JsonPatch
|
|||
/// </summary>
|
||||
/// <param name="from">source location</param>
|
||||
/// <param name="path">target location</param>
|
||||
/// <returns></returns>
|
||||
/// <returns>The <see cref="JsonPatchDocument{TModel}"/> for chaining.</returns>
|
||||
public JsonPatchDocument<TModel> Copy<TProp>(
|
||||
Expression<Func<TModel, TProp>> from,
|
||||
Expression<Func<TModel, TProp>> path)
|
||||
|
|
@ -538,7 +538,7 @@ namespace Microsoft.AspNetCore.JsonPatch
|
|||
/// <param name="from">source location</param>
|
||||
/// <param name="positionFrom">position</param>
|
||||
/// <param name="path">target location</param>
|
||||
/// <returns></returns>
|
||||
/// <returns>The <see cref="JsonPatchDocument{TModel}"/> for chaining.</returns>
|
||||
public JsonPatchDocument<TModel> Copy<TProp>(
|
||||
Expression<Func<TModel, IList<TProp>>> from,
|
||||
int positionFrom,
|
||||
|
|
@ -569,7 +569,7 @@ namespace Microsoft.AspNetCore.JsonPatch
|
|||
/// <param name="from">source location</param>
|
||||
/// <param name="path">target location</param>
|
||||
/// <param name="positionTo">position</param>
|
||||
/// <returns></returns>
|
||||
/// <returns>The <see cref="JsonPatchDocument{TModel}"/> for chaining.</returns>
|
||||
public JsonPatchDocument<TModel> Copy<TProp>(
|
||||
Expression<Func<TModel, TProp>> from,
|
||||
Expression<Func<TModel, IList<TProp>>> path,
|
||||
|
|
@ -601,7 +601,7 @@ namespace Microsoft.AspNetCore.JsonPatch
|
|||
/// <param name="positionFrom">position (source)</param>
|
||||
/// <param name="path">target location</param>
|
||||
/// <param name="positionTo">position (target)</param>
|
||||
/// <returns></returns>
|
||||
/// <returns>The <see cref="JsonPatchDocument{TModel}"/> for chaining.</returns>
|
||||
public JsonPatchDocument<TModel> Copy<TProp>(
|
||||
Expression<Func<TModel, IList<TProp>>> from,
|
||||
int positionFrom,
|
||||
|
|
@ -633,7 +633,7 @@ namespace Microsoft.AspNetCore.JsonPatch
|
|||
/// <param name="from">source location</param>
|
||||
/// <param name="positionFrom">position</param>
|
||||
/// <param name="path">target location</param>
|
||||
/// <returns></returns>
|
||||
/// <returns>The <see cref="JsonPatchDocument{TModel}"/> for chaining.</returns>
|
||||
public JsonPatchDocument<TModel> Copy<TProp>(
|
||||
Expression<Func<TModel, IList<TProp>>> from,
|
||||
int positionFrom,
|
||||
|
|
@ -663,7 +663,7 @@ namespace Microsoft.AspNetCore.JsonPatch
|
|||
/// <typeparam name="TProp"></typeparam>
|
||||
/// <param name="from">source location</param>
|
||||
/// <param name="path">target location</param>
|
||||
/// <returns></returns>
|
||||
/// <returns>The <see cref="JsonPatchDocument{TModel}"/> for chaining.</returns>
|
||||
public JsonPatchDocument<TModel> Copy<TProp>(
|
||||
Expression<Func<TModel, TProp>> from,
|
||||
Expression<Func<TModel, IList<TProp>>> path)
|
||||
|
|
@ -868,7 +868,7 @@ namespace Microsoft.AspNetCore.JsonPatch
|
|||
|
||||
}
|
||||
|
||||
// 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 @@ namespace Microsoft.AspNetCore.JsonPatch
|
|||
return Convert.ToString(func(null), CultureInfo.InvariantCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,13 +31,15 @@ namespace Microsoft.AspNetCore.Hosting
|
|||
/// <summary>
|
||||
/// Starts listening on the configured addresses.
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">Used to abort program start.</param>
|
||||
/// <returns>A <see cref="Task"/> that completes when the <see cref="IWebHost"/> starts.</returns>
|
||||
Task StartAsync(CancellationToken cancellationToken = default);
|
||||
|
||||
/// <summary>
|
||||
/// Attempt to gracefully stop the host.
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
/// <param name="cancellationToken">Used to indicate when stop should no longer be graceful.</param>
|
||||
/// <returns>A <see cref="Task"/> that completes when the <see cref="IWebHost"/> stops.</returns>
|
||||
Task StopAsync(CancellationToken cancellationToken = default);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ namespace Microsoft.AspNetCore.Hosting
|
|||
/// <param name="host"></param>
|
||||
/// <param name="timeout">The timeout for stopping gracefully. Once expired the
|
||||
/// server may terminate any remaining active connections.</param>
|
||||
/// <returns></returns>
|
||||
/// <returns>A <see cref="Task"/> that completes when the <see cref="IWebHost"/> stops.</returns>
|
||||
public static Task StopAsync(this IWebHost host, TimeSpan timeout)
|
||||
{
|
||||
return host.StopAsync(new CancellationTokenSource(timeout).Token);
|
||||
|
|
@ -38,6 +38,7 @@ namespace Microsoft.AspNetCore.Hosting
|
|||
/// </summary>
|
||||
/// <param name="host">The running <see cref="IWebHost"/>.</param>
|
||||
/// <param name="token">The token to trigger shutdown.</param>
|
||||
/// <returns>A <see cref="Task"/> that completes when shutdown is triggered via Ctrl+C or SIGTERM.</returns>
|
||||
public static async Task WaitForShutdownAsync(this IWebHost host, CancellationToken token = default)
|
||||
{
|
||||
var done = new ManualResetEventSlim(false);
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ namespace Microsoft.AspNetCore.TestHost
|
|||
/// Configure any HttpRequestMessage properties.
|
||||
/// </summary>
|
||||
/// <param name="configure"></param>
|
||||
/// <returns></returns>
|
||||
/// <returns>This <see cref="RequestBuilder"/> for chaining.</returns>
|
||||
public RequestBuilder And(Action<HttpRequestMessage> configure)
|
||||
{
|
||||
if (configure == null)
|
||||
|
|
@ -52,7 +52,7 @@ namespace Microsoft.AspNetCore.TestHost
|
|||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
/// <returns>This <see cref="RequestBuilder"/> for chaining.</returns>
|
||||
public RequestBuilder AddHeader(string name, string value)
|
||||
{
|
||||
if (!_req.Headers.TryAddWithoutValidation(name, value))
|
||||
|
|
@ -74,7 +74,7 @@ namespace Microsoft.AspNetCore.TestHost
|
|||
/// Set the request method and start processing the request.
|
||||
/// </summary>
|
||||
/// <param name="method"></param>
|
||||
/// <returns></returns>
|
||||
/// <returns>The resulting <see cref="HttpResponseMessage"/>.</returns>
|
||||
public Task<HttpResponseMessage> SendAsync(string method)
|
||||
{
|
||||
_req.Method = new HttpMethod(method);
|
||||
|
|
@ -84,7 +84,7 @@ namespace Microsoft.AspNetCore.TestHost
|
|||
/// <summary>
|
||||
/// Set the request method to GET and start processing the request.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <returns>The resulting <see cref="HttpResponseMessage"/>.</returns>
|
||||
public Task<HttpResponseMessage> GetAsync()
|
||||
{
|
||||
_req.Method = HttpMethod.Get;
|
||||
|
|
@ -94,7 +94,7 @@ namespace Microsoft.AspNetCore.TestHost
|
|||
/// <summary>
|
||||
/// Set the request method to POST and start processing the request.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <returns>The resulting <see cref="HttpResponseMessage"/>.</returns>
|
||||
public Task<HttpResponseMessage> PostAsync()
|
||||
{
|
||||
_req.Method = HttpMethod.Post;
|
||||
|
|
|
|||
|
|
@ -11,6 +11,9 @@ namespace Microsoft.AspNetCore.Authentication
|
|||
/// </summary>
|
||||
public class AuthenticateResult
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="AuthenticateResult"/> instance.
|
||||
/// </summary>
|
||||
protected AuthenticateResult() { }
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ namespace Microsoft.AspNetCore.Authentication
|
|||
/// <param name="context">The <see cref="HttpContext"/> context.</param>
|
||||
/// <param name="scheme">The name of the authentication scheme.</param>
|
||||
/// <param name="properties">The <see cref="AuthenticationProperties"/> properties.</param>
|
||||
/// <returns></returns>
|
||||
/// <returns>The task.</returns>
|
||||
public static Task SignOutAsync(this HttpContext context, string scheme, AuthenticationProperties properties) =>
|
||||
context.RequestServices.GetRequiredService<IAuthenticationService>().SignOutAsync(context, scheme, properties);
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ namespace Microsoft.AspNetCore.Authentication
|
|||
/// <summary>
|
||||
/// Returns true if request processing should stop.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <returns><code>true</code> if request processing should stop.</returns>
|
||||
Task<bool> HandleRequestAsync();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ namespace Microsoft.AspNetCore.Http
|
|||
&& 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 @@ namespace Microsoft.AspNetCore.Http
|
|||
/// 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.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <returns>The host portion of the value.</returns>
|
||||
public string Host
|
||||
{
|
||||
get
|
||||
|
|
@ -88,7 +88,7 @@ namespace Microsoft.AspNetCore.Http
|
|||
/// <summary>
|
||||
/// Returns the value of the port part of the host, or <value>null</value> if none is found.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <returns>The port portion of the value.</returns>
|
||||
public int? Port
|
||||
{
|
||||
get
|
||||
|
|
@ -108,7 +108,7 @@ namespace Microsoft.AspNetCore.Http
|
|||
/// <summary>
|
||||
/// Returns the value as normalized by ToUriComponent().
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <returns>The value as normalized by <see cref="ToUriComponent"/>.</returns>
|
||||
public override string ToString()
|
||||
{
|
||||
return ToUriComponent();
|
||||
|
|
@ -118,7 +118,7 @@ namespace Microsoft.AspNetCore.Http
|
|||
/// 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.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <returns>The <see cref="HostString"/> value formated for use in a URI or HTTP header.</returns>
|
||||
public string ToUriComponent()
|
||||
{
|
||||
if (string.IsNullOrEmpty(_value))
|
||||
|
|
@ -154,8 +154,8 @@ namespace Microsoft.AspNetCore.Http
|
|||
/// Creates a new HostString from the given URI component.
|
||||
/// Any punycode will be converted to Unicode.
|
||||
/// </summary>
|
||||
/// <param name="uriComponent"></param>
|
||||
/// <returns></returns>
|
||||
/// <param name="uriComponent">The URI component string to create a <see cref="HostString"/> from.</param>
|
||||
/// <returns>The <see cref="HostString"/> that was created.</returns>
|
||||
public static HostString FromUriComponent(string uriComponent)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(uriComponent))
|
||||
|
|
@ -195,8 +195,8 @@ namespace Microsoft.AspNetCore.Http
|
|||
/// Creates a new HostString from the host and port of the give Uri instance.
|
||||
/// Punycode will be converted to Unicode.
|
||||
/// </summary>
|
||||
/// <param name="uri"></param>
|
||||
/// <returns></returns>
|
||||
/// <param name="uri">The <see cref="Uri"/> to create a <see cref="HostString"/> from.</param>
|
||||
/// <returns>The <see cref="HostString"/> that was created.</returns>
|
||||
public static HostString FromUriComponent(Uri uri)
|
||||
{
|
||||
if (uri == null)
|
||||
|
|
@ -223,7 +223,7 @@ namespace Microsoft.AspNetCore.Http
|
|||
/// "abc.example.com:443" but not "example.com:443".
|
||||
/// Matching is case insensitive.
|
||||
/// </remarks>
|
||||
/// <returns></returns>
|
||||
/// <returns><code>true</code> if <paramref name="value"/> matches any of the patterns.</returns>
|
||||
public static bool MatchesAny(StringSegment value, IList<StringSegment> patterns)
|
||||
{
|
||||
if (value == null)
|
||||
|
|
@ -281,8 +281,8 @@ namespace Microsoft.AspNetCore.Http
|
|||
/// <summary>
|
||||
/// Compares the equality of the Value property, ignoring case.
|
||||
/// </summary>
|
||||
/// <param name="other"></param>
|
||||
/// <returns></returns>
|
||||
/// <param name="other">The <see cref="HostString"/> to compare against.</param>
|
||||
/// <returns><code>true</code> if they have the same value.</returns>
|
||||
public bool Equals(HostString other)
|
||||
{
|
||||
if (!HasValue && !other.HasValue)
|
||||
|
|
@ -295,8 +295,8 @@ namespace Microsoft.AspNetCore.Http
|
|||
/// <summary>
|
||||
/// Compares against the given object only if it is a HostString.
|
||||
/// </summary>
|
||||
/// <param name="obj"></param>
|
||||
/// <returns></returns>
|
||||
/// <param name="obj">The <see cref="object"/> to compare against.</param>
|
||||
/// <returns><code>true</code> if they have the same value.</returns>
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (ReferenceEquals(null, obj))
|
||||
|
|
@ -309,7 +309,7 @@ namespace Microsoft.AspNetCore.Http
|
|||
/// <summary>
|
||||
/// Gets a hash code for the value.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <returns>The hash code as an <see cref="int"/>.</returns>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return (HasValue ? StringComparer.OrdinalIgnoreCase.GetHashCode(_value) : 0);
|
||||
|
|
@ -318,9 +318,9 @@ namespace Microsoft.AspNetCore.Http
|
|||
/// <summary>
|
||||
/// Compares the two instances for equality.
|
||||
/// </summary>
|
||||
/// <param name="left"></param>
|
||||
/// <param name="right"></param>
|
||||
/// <returns></returns>
|
||||
/// <param name="left">The left parameter.</param>
|
||||
/// <param name="right">The right parameter.</param>
|
||||
/// <returns><code>true</code> if both <see cref="HostString"/>'s have the same value.</returns>
|
||||
public static bool operator ==(HostString left, HostString right)
|
||||
{
|
||||
return left.Equals(right);
|
||||
|
|
@ -329,9 +329,9 @@ namespace Microsoft.AspNetCore.Http
|
|||
/// <summary>
|
||||
/// Compares the two instances for inequality.
|
||||
/// </summary>
|
||||
/// <param name="left"></param>
|
||||
/// <param name="right"></param>
|
||||
/// <returns></returns>
|
||||
/// <param name="left">The left parameter.</param>
|
||||
/// <param name="right">The right parameter.</param>
|
||||
/// <returns><code>true</code> if both <see cref="HostString"/>'s values are not equal.</returns>
|
||||
public static bool operator !=(HostString left, HostString right)
|
||||
{
|
||||
return !left.Equals(right);
|
||||
|
|
@ -340,6 +340,9 @@ namespace Microsoft.AspNetCore.Http
|
|||
/// <summary>
|
||||
/// Parses the current value. IPv6 addresses will have brackets added if they are missing.
|
||||
/// </summary>
|
||||
/// <param name="value">The value to get the parts of.</param>
|
||||
/// <param name="host">The portion of the <paramref name="value"/> which represents the host.</param>
|
||||
/// <param name="port">The portion of the <paramref name="value"/> which represents the port.</param>
|
||||
private static void GetParts(StringSegment value, out StringSegment host, out StringSegment port)
|
||||
{
|
||||
int index;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ namespace Microsoft.AspNetCore.Http.Extensions
|
|||
/// <param name="path">The portion of the request path that identifies the requested resource.</param>
|
||||
/// <param name="query">The query, if any.</param>
|
||||
/// <param name="fragment">The fragment, if any.</param>
|
||||
/// <returns></returns>
|
||||
/// <returns>The combined URI components, properly encoded for use in HTTP headers.</returns>
|
||||
public static string BuildRelative(
|
||||
PathString pathBase = new PathString(),
|
||||
PathString path = new PathString(),
|
||||
|
|
@ -44,7 +44,7 @@ namespace Microsoft.AspNetCore.Http.Extensions
|
|||
/// <param name="path">The portion of the request path that identifies the requested resource.</param>
|
||||
/// <param name="query">The query, if any.</param>
|
||||
/// <param name="fragment">The fragment, if any.</param>
|
||||
/// <returns></returns>
|
||||
/// <returns>The combined URI components, properly encoded for use in HTTP headers.</returns>
|
||||
public static string BuildAbsolute(
|
||||
string scheme,
|
||||
HostString host,
|
||||
|
|
@ -90,9 +90,9 @@ namespace Microsoft.AspNetCore.Http.Extensions
|
|||
public static void FromAbsolute(
|
||||
string uri,
|
||||
out string scheme,
|
||||
out HostString host,
|
||||
out HostString host,
|
||||
out PathString path,
|
||||
out QueryString query,
|
||||
out QueryString query,
|
||||
out FragmentString fragment)
|
||||
{
|
||||
if (uri == null)
|
||||
|
|
@ -134,7 +134,7 @@ namespace Microsoft.AspNetCore.Http.Extensions
|
|||
path = PathString.FromUriComponent(uri.Substring(searchIndex, limit - searchIndex));
|
||||
limit = searchIndex;
|
||||
}
|
||||
|
||||
|
||||
host = HostString.FromUriComponent(uri.Substring(startIndex, limit - startIndex));
|
||||
}
|
||||
|
||||
|
|
@ -143,7 +143,7 @@ namespace Microsoft.AspNetCore.Http.Extensions
|
|||
/// HTTP headers. Note that a unicode host name will be encoded as punycode.
|
||||
/// </summary>
|
||||
/// <param name="uri">The Uri to encode.</param>
|
||||
/// <returns></returns>
|
||||
/// <returns>The encoded string version of <paramref name="uri"/>.</returns>
|
||||
public static string Encode(Uri uri)
|
||||
{
|
||||
if (uri == null)
|
||||
|
|
@ -171,16 +171,16 @@ namespace Microsoft.AspNetCore.Http.Extensions
|
|||
/// and other HTTP operations.
|
||||
/// </summary>
|
||||
/// <param name="request">The request to assemble the uri pieces from.</param>
|
||||
/// <returns></returns>
|
||||
/// <returns>The encoded string version of the URL from <paramref name="request"/>.</returns>
|
||||
public static string GetEncodedUrl(this HttpRequest request)
|
||||
{
|
||||
return BuildAbsolute(request.Scheme, request.Host, request.PathBase, request.Path, request.QueryString);
|
||||
}
|
||||
/// <summary>
|
||||
/// Returns the relative url
|
||||
/// Returns the relative URI.
|
||||
/// </summary>
|
||||
/// <param name="request">The request to assemble the uri pieces from.</param>
|
||||
/// <returns></returns>
|
||||
/// <returns>The path and query off of <paramref name="request"/>.</returns>
|
||||
public static string GetEncodedPathAndQuery(this HttpRequest request)
|
||||
{
|
||||
return BuildRelative(request.PathBase, request.Path, request.QueryString);
|
||||
|
|
@ -191,10 +191,11 @@ namespace Microsoft.AspNetCore.Http.Extensions
|
|||
/// suitable only for display. This format should not be used in HTTP headers or other HTTP operations.
|
||||
/// </summary>
|
||||
/// <param name="request">The request to assemble the uri pieces from.</param>
|
||||
/// <returns></returns>
|
||||
/// <returns>The combined components of the request URL in a fully un-escaped form (except for the QueryString)
|
||||
/// suitable only for display.</returns>
|
||||
public static string GetDisplayUrl(this HttpRequest request)
|
||||
{
|
||||
var scheme = request.Scheme ?? string.Empty;
|
||||
var scheme = request.Scheme ?? string.Empty;
|
||||
var host = request.Host.Value ?? string.Empty;
|
||||
var pathBase = request.PathBase.Value ?? string.Empty;
|
||||
var path = request.Path.Value ?? string.Empty;
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ namespace Microsoft.AspNetCore.Identity
|
|||
/// <summary>
|
||||
/// Constructs a new claim with the type and value.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <returns>The <see cref="Claim"/> that was produced.</returns>
|
||||
public virtual Claim ToClaim()
|
||||
{
|
||||
return new Claim(ClaimType, ClaimValue);
|
||||
|
|
@ -51,4 +51,4 @@ namespace Microsoft.AspNetCore.Identity
|
|||
ClaimValue = other?.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ namespace Microsoft.AspNetCore.Authentication.WsFederation
|
|||
/// <summary>
|
||||
/// Overridden to handle remote signout requests
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <returns><code>true</code> if request processing should stop.</returns>
|
||||
public override Task<bool> HandleRequestAsync()
|
||||
{
|
||||
// RemoteSignOutPath and CallbackPath may be the same, fall through if the message doesn't match.
|
||||
|
|
@ -149,7 +149,7 @@ namespace Microsoft.AspNetCore.Authentication.WsFederation
|
|||
&& Request.Body.CanRead)
|
||||
{
|
||||
var form = await Request.ReadFormAsync();
|
||||
|
||||
|
||||
wsFederationMessage = new WsFederationMessage(form.Select(pair => new KeyValuePair<string, string[]>(pair.Key, pair.Value)));
|
||||
}
|
||||
|
||||
|
|
@ -163,7 +163,7 @@ namespace Microsoft.AspNetCore.Authentication.WsFederation
|
|||
|
||||
return HandleRequestResult.Fail("No message.");
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
// Retrieve our cached redirect uri
|
||||
|
|
@ -422,4 +422,4 @@ namespace Microsoft.AspNetCore.Authentication.WsFederation
|
|||
return BuildRedirectUri(uri);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue