You can configure the attribute using the twilio.requestValidation section, but you can also override this configuration using the appSettings.
The reason for this is that appSettings has configuration builders which allow for storing the auth token as a secret.
Also on platforms like Azure Web Apps, you can override appSettings from the portal, but you cannot override the configuration sections.
Attribute usage is now like this:
public class SmsController : TwilioController
{
[ValidateRequest]
public TwiMLResult Index(){}
}
AuthToken, UrlOverride, and AllowLocal cannot be configured through the constructor or object initializer.
However, you can still inherit from the attribute and configure the properties as you wish.
Contributing to Twilio
All third-party contributors acknowledge that any contributions they provide will be made under the same open-source license that the open-source project is provided under.
[x] I acknowledge that all my contributions will be made under the project's license.
Instead of hardcoding the configuration into the
ValidateRequestAttribute
, you can now configure the attribute from the Web.config file:Web.config:
You can configure the attribute using the
twilio.requestValidation
section, but you can also override this configuration using theappSettings
. The reason for this is thatappSettings
has configuration builders which allow for storing the auth token as a secret. Also on platforms like Azure Web Apps, you can overrideappSettings
from the portal, but you cannot override the configuration sections.Attribute usage is now like this:
AuthToken
,UrlOverride
, andAllowLocal
cannot be configured through the constructor or object initializer. However, you can still inherit from the attribute and configure the properties as you wish.Contributing to Twilio