Skip to content

Commit f7dd371

Browse files
authored
Defaulting SwtAuthenticationEnabled to False (#10196)
1 parent f3c64e7 commit f7dd371

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

src/WebJobs.Script/Config/FunctionsHostingConfigOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public bool SwtAuthenticationEnabled
6060
{
6161
get
6262
{
63-
return GetFeatureOrDefault(ScriptConstants.HostingConfigSwtAuthenticationEnabled, "1") == "1";
63+
return GetFeatureOrDefault(ScriptConstants.HostingConfigSwtAuthenticationEnabled, "0") == "1";
6464
}
6565

6666
set

test/WebJobs.Script.Tests.Integration/WebHostEndToEnd/SamplesEndToEndTests_CSharp.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1294,6 +1294,10 @@ public override void ConfigureWebHost(IServiceCollection services)
12941294
{
12951295
base.ConfigureWebHost(services);
12961296

1297+
// SWT auth is disabled by default so we must enable to test
1298+
services.AddOptions<FunctionsHostingConfigOptions>()
1299+
.Configure(o => o.SwtAuthenticationEnabled = true);
1300+
12971301
// The legacy http tests use sync IO so explicitly allow this
12981302
var environment = new TestEnvironment();
12991303
string testSiteName = "somewebsite";

test/WebJobs.Script.Tests/Configuration/FunctionsHostingConfigOptionsTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ public void SwtAuthenticationEnabled_ReturnsExpectedValue()
106106
{
107107
FunctionsHostingConfigOptions options = new FunctionsHostingConfigOptions();
108108

109-
// defaults to true
110-
Assert.True(options.SwtAuthenticationEnabled);
109+
// defaults to false
110+
Assert.False(options.SwtAuthenticationEnabled);
111111

112112
// returns true when explicitly enabled
113113
options.Features[ScriptConstants.HostingConfigSwtAuthenticationEnabled] = "1";

test/WebJobs.Script.Tests/Security/Authentication/ArmAuthenticationHandlerTests.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using Microsoft.AspNetCore.Authentication;
88
using Microsoft.AspNetCore.Http;
99
using Microsoft.Azure.WebJobs.Extensions.Http;
10+
using Microsoft.Azure.WebJobs.Script.Config;
1011
using Microsoft.Azure.WebJobs.Script.Tests.Helpers;
1112
using Microsoft.Azure.WebJobs.Script.WebHost.Security;
1213
using Microsoft.Azure.WebJobs.Script.WebHost.Security.Authentication;
@@ -20,6 +21,11 @@ public class ArmAuthenticationHandlerTests
2021
private static DefaultHttpContext GetContext()
2122
{
2223
var services = new ServiceCollection().AddLogging();
24+
25+
// SWT auth is disabled by default so we must enable to test
26+
services.AddOptions<FunctionsHostingConfigOptions>()
27+
.Configure(o => o.SwtAuthenticationEnabled = true);
28+
2329
services.AddAuthentication(o =>
2430
{
2531
o.DefaultScheme = ArmAuthenticationDefaults.AuthenticationScheme;

0 commit comments

Comments
 (0)