Skip to content

Commit

Permalink
Merge pull request #120 from twilio-labs/remove-unsupported-frameworks
Browse files Browse the repository at this point in the history
Remove unsupported frameworks and update/remove packages
  • Loading branch information
Swimburger authored Mar 2, 2023
2 parents c63c585 + 6b7b285 commit 792381d
Show file tree
Hide file tree
Showing 14 changed files with 322 additions and 313 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ Then configure the request validation:

A couple of notes about the configuration:
- `Twilio:RequestValidation:AuthToken` falls back on `Twilio:AuthToken`. You only need to configure one of them.
- `AllowLocal` will skip validation when the HTTP request originated from localhost.
- `AllowLocal` will skip validation when the HTTP request originated from localhost. ⚠️ Only use this during development, as this will make your application vulnerable to Server-Side Request Forgery.
- Use `BaseUrlOverride` in case your app is behind a reverse proxy or a tunnel like ngrok. The path of the current request will be appended to the `BaseUrlOverride` for request validation.

You can also manually configure the request validation:
Expand Down
30 changes: 8 additions & 22 deletions src/Twilio.AspNet.Core/Twilio.AspNet.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net5.0;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<OutputType>Library</OutputType>
<Version>0.0.0-alpha</Version>
<PackageId>Twilio.AspNet.Core</PackageId>
Expand All @@ -21,45 +21,31 @@
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<IsNetStandard20Compatible>$([MSBuild]::IsTargetFrameworkCompatible($(TargetFramework), 'netstandard2.0'))</IsNetStandard20Compatible>
<IsNet50Compatible>$([MSBuild]::IsTargetFrameworkCompatible($(TargetFramework), 'net5.0'))</IsNet50Compatible>
<IsNet60Compatible>$([MSBuild]::IsTargetFrameworkCompatible($(TargetFramework), 'net6.0'))</IsNet60Compatible>
<IsNet70Compatible>$([MSBuild]::IsTargetFrameworkCompatible($(TargetFramework), 'net7.0'))</IsNet70Compatible>
</PropertyGroup>
<PropertyGroup Condition="'$(CI)' == 'true'">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Twilio" Version="6.2.0" />
<PackageReference Include="Twilio" Version="6.2.2" />
<PackageReference Include="Twilio.AspNet.Common" Version="0.0.0-alpha" />

<FrameworkReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.Extensions.Http" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.2" />

<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>

<None Include="..\..\icon.png" Pack="true" PackagePath="\" />
<None Include="..\..\README.md" Pack="true" PackagePath="\" />
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
<_Parameter1>Twilio.AspNet.Core.UnitTests</_Parameter1>
</AssemblyAttribute>
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.0" />
</ItemGroup>
<ItemGroup Condition="$(IsNetStandard20Compatible)">
<PackageReference Include="Microsoft.Extensions.Http" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="7.0.0" />
</ItemGroup>
<ItemGroup Condition="$(IsNet50Compatible)">
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
<ItemGroup Condition="!$(IsNet60Compatible)">
<Compile Remove="MinimalApiTwiMLResult.cs" />
</ItemGroup>
<ItemGroup Condition="!$(IsNet70Compatible)">
<Compile Remove="ValidateTwilioRequestFilter.cs" />
</ItemGroup>
<ItemGroup Condition="!$(IsNetStandard20Compatible)">
<Compile Remove="TwilioClientDependencyInjectionExtensions.cs" />
<Compile Remove="RequestValidationDependencyInjectionExtensions.cs" />
</ItemGroup>
</Project>
89 changes: 43 additions & 46 deletions src/Twilio.AspNet.Mvc.UnitTests/Twilio.AspNet.Mvc.UnitTests.csproj
Original file line number Diff line number Diff line change
@@ -1,49 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net471</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Net" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Web" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Twilio.AspNet.Common\Twilio.AspNet.Common.csproj" />
<ProjectReference Include="..\Twilio.AspNet.Mvc\Twilio.AspNet.Mvc.csproj" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Castle.Core" Version="4.4.0" />
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="5.2.1" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="5.2.1" />
<PackageReference Include="Moq" Version="4.16.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Twilio" Version="6.2.0" />
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="xunit.abstractions" Version="2.0.1" />
<PackageReference Include="xunit.analyzers" Version="0.8.0" />
<PackageReference Include="xunit.assert" Version="2.3.1" />
<PackageReference Include="xunit.core" Version="2.3.1" />
<PackageReference Include="xunit.extensibility.core" Version="2.3.1" />
<PackageReference Include="xunit.extensibility.execution" Version="2.3.1" />
<PackageReference Include="xunit.runner.console" Version="2.3.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net471</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Net" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Web" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Twilio.AspNet.Common\Twilio.AspNet.Common.csproj" />
<ProjectReference Include="..\Twilio.AspNet.Mvc\Twilio.AspNet.Mvc.csproj" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Castle.Core" Version="5.1.1" />
<PackageReference Include="Moq" Version="4.18.4" />
<PackageReference Include="Twilio" Version="6.2.2" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.abstractions" Version="2.0.3" />
<PackageReference Include="xunit.analyzers" Version="1.1.0" />
<PackageReference Include="xunit.assert" Version="2.4.2" />
<PackageReference Include="xunit.core" Version="2.4.2" />
<PackageReference Include="xunit.extensibility.core" Version="2.4.2" />
<PackageReference Include="xunit.extensibility.execution" Version="2.4.2" />
<PackageReference Include="xunit.runner.console" Version="2.4.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project>
12 changes: 0 additions & 12 deletions src/Twilio.AspNet.Mvc.UnitTests/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,6 @@
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.IdentityModel.Tokens.Jwt" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.2.1.0" newVersion="5.2.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.IdentityModel.Tokens" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.2.1.0" newVersion="5.2.1.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
16 changes: 7 additions & 9 deletions src/Twilio.AspNet.Mvc/RequestValidationHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

namespace Twilio.AspNet.Mvc
{
/// <summary>
/// Class used to validate incoming requests from Twilio using 'Request Validation' as described
/// in the Security section of the Twilio TwiML API documentation.
/// </summary>
public static class RequestValidationHelper
/// <summary>
/// Class used to validate incoming requests from Twilio using 'Request Validation' as described
/// in the Security section of the Twilio TwiML API documentation.
/// </summary>
public static class RequestValidationHelper
{
/// <summary>
/// Performs request validation using the current HTTP context passed in manually or from
Expand All @@ -21,10 +21,8 @@ public static class RequestValidationHelper
/// Skip validation for local requests.
/// ⚠️ Only use this during development, as this will make your application vulnerable to Server-Side Request Forgery.
/// </param>
public static bool IsValidRequest(HttpContextBase context, string authToken, bool allowLocal = false)
{
return IsValidRequest(context, authToken, null, allowLocal);
}
public static bool IsValidRequest(HttpContextBase context, string authToken, bool allowLocal = false)
=> IsValidRequest(context, authToken, null, allowLocal);

/// <summary>
/// Performs request validation using the current HTTP context passed in manually or from
Expand Down
131 changes: 65 additions & 66 deletions src/Twilio.AspNet.Mvc/Twilio.AspNet.Mvc.csproj
Original file line number Diff line number Diff line change
@@ -1,69 +1,68 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net462</TargetFramework>
<Version>0.0.0-alpha</Version>
<PackageId>Twilio.AspNet.Mvc</PackageId>
<PackageVersion>0.0.0-alpha</PackageVersion>
<Authors>Twilio Labs</Authors>
<Description>Twilio helper library for ASP.NET MVC on .NET Framework.</Description>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<PackageReleaseNotes>Refer to the changelog at https://github.com/twilio-labs/twilio-aspnet/blob/main/CHANGELOG.md</PackageReleaseNotes>
<Copyright>Copyright 2022 (c) Twilio, Inc. All rights reserved.</Copyright>
<PackageTags>twilio;twiml;sms;voice;telephony;phone;aspnet</PackageTags>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/twilio-labs/twilio-aspnet</PackageProjectUrl>
<RepositoryUrl>https://github.com/twilio-labs/twilio-aspnet.git</RepositoryUrl>
<PackageIconUrl>https://s3.amazonaws.com/com.twilio.prod.twilio-docs/images/twilio-icon-64x64.png</PackageIconUrl>
<PackageIcon>icon.png</PackageIcon>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>
<PropertyGroup Condition="'$(CI)' == 'true'">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Configuration">
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.1\System.Configuration.dll</HintPath>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.Net" />
<Reference Include="System.Numerics" />
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="..\..\icon.png" Pack="true" PackagePath="\" />
<None Include="..\..\README.md" Pack="true" PackagePath="\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Twilio" Version="6.2.0" />
<PackageReference Include="Twilio.AspNet.Common" Version="0.0.0-alpha" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.AspNet.Mvc" Version="5.2.7" />
<PackageReference Include="NuGet.Build.Tasks.Pack" Version="6.1.0">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
<_Parameter1>Twilio.AspNet.Mvc.UnitTests</_Parameter1>
</AssemblyAttribute>
</ItemGroup>
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net462</TargetFramework>
<Version>0.0.0-alpha</Version>
<PackageId>Twilio.AspNet.Mvc</PackageId>
<PackageVersion>0.0.0-alpha</PackageVersion>
<Authors>Twilio Labs</Authors>
<Description>Twilio helper library for ASP.NET MVC on .NET Framework.</Description>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<PackageReleaseNotes>Refer to the changelog at https://github.com/twilio-labs/twilio-aspnet/blob/main/CHANGELOG.md</PackageReleaseNotes>
<Copyright>Copyright 2022 (c) Twilio, Inc. All rights reserved.</Copyright>
<PackageTags>twilio;twiml;sms;voice;telephony;phone;aspnet</PackageTags>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/twilio-labs/twilio-aspnet</PackageProjectUrl>
<RepositoryUrl>https://github.com/twilio-labs/twilio-aspnet.git</RepositoryUrl>
<PackageIconUrl>https://s3.amazonaws.com/com.twilio.prod.twilio-docs/images/twilio-icon-64x64.png</PackageIconUrl>
<PackageIcon>icon.png</PackageIcon>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>
<PropertyGroup Condition="'$(CI)' == 'true'">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>
<ItemGroup>
<Reference Include="System"/>
<Reference Include="System.ComponentModel.Composition"/>
<Reference Include="System.Configuration">
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.1\System.Configuration.dll</HintPath>
</Reference>
<Reference Include="System.Core"/>
<Reference Include="System.IO.Compression"/>
<Reference Include="System.Net"/>
<Reference Include="System.Numerics"/>
<Reference Include="System.Web"/>
<Reference Include="System.Xml.Linq"/>
<Reference Include="System.Data.DataSetExtensions"/>
<Reference Include="Microsoft.CSharp"/>
<Reference Include="System.Data"/>
<Reference Include="System.Net.Http"/>
<Reference Include="System.Xml"/>
</ItemGroup>
<ItemGroup>
<None Include="..\..\icon.png" Pack="true" PackagePath="\"/>
<None Include="..\..\README.md" Pack="true" PackagePath="\"/>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Twilio" Version="6.2.2"/>
<PackageReference Include="Twilio.AspNet.Common" Version="0.0.0-alpha"/>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.AspNet.Mvc" Version="5.2.9"/>
<PackageReference Include="NuGet.Build.Tasks.Pack" Version="6.4.0">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
<_Parameter1>Twilio.AspNet.Mvc.UnitTests</_Parameter1>
</AssemblyAttribute>
</ItemGroup>
</Project>
6 changes: 2 additions & 4 deletions src/Twilio.AspNet.Mvc/TwilioConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ public class TwilioSectionGroup : ConfigurationSectionGroup
{

[ConfigurationProperty("requestValidation", IsRequired = false)]
public RequestValidationConfigurationSection RequestValidation
{
get { return (RequestValidationConfigurationSection)Sections["requestValidation"]; }
}
public RequestValidationConfigurationSection RequestValidation
=> (RequestValidationConfigurationSection)Sections["requestValidation"];
}
}
11 changes: 0 additions & 11 deletions src/Twilio.AspNet.Mvc/app.config

This file was deleted.

3 changes: 1 addition & 2 deletions src/testapps/AspNetFramework/App_Start/FilterConfig.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc;

namespace AspNetFramework
{
Expand Down
6 changes: 1 addition & 5 deletions src/testapps/AspNetFramework/App_Start/RouteConfig.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc;
using System.Web.Routing;

namespace AspNetFramework
Expand Down
Loading

0 comments on commit 792381d

Please sign in to comment.