-
Notifications
You must be signed in to change notification settings - Fork 100
/
HttpConfigurationExtensions.cs
32 lines (30 loc) · 1.73 KB
/
HttpConfigurationExtensions.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.ComponentModel;
using Microsoft.AspNet.WebHooks.Config;
namespace System.Web.Http
{
/// <summary>
/// Extension methods for <see cref="HttpConfiguration"/>.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public static class HttpConfigurationExtensions
{
/// <summary>
/// Initializes support for receiving generic WebHooks containing valid JSON
/// with no special validation logic or security requirements. This can for example be used
/// to receive WebHooks from IFTTT's Maker Channel or a Zapier WebHooks Action.
/// A sample WebHook URI is '<c>https://<host>/api/webhooks/incoming/genericjson/{id}?code=83699ec7c1d794c0c780e49a5c72972590571fd8</c>'.
/// For security reasons the WebHook URI must be an <c>https</c> URI and contain a 'code' query parameter with the
/// same value as configured in the '<c>MS_WebHookReceiverSecret_GenericJson</c>' application setting, optionally using IDs
/// to differentiate between multiple WebHooks, for example '<c>secret0, id1=secret1, id2=secret2</c>'.
/// The 'code' parameter must be between 32 and 128 characters long.
/// The URI may optionally include an '<c>action</c>' query parameter which will serve as the WebHook action.
/// </summary>
/// <param name="config">The current <see cref="HttpConfiguration"/>config.</param>
public static void InitializeReceiveGenericJsonWebHooks(this HttpConfiguration config)
{
WebHooksConfig.Initialize(config);
}
}
}