From a05513918510be4bdcae573f89a3577f4b7131a1 Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Mon, 7 Aug 2017 20:07:58 -0400 Subject: [PATCH] AuthorizationLevel.Function instead of Anonymous. --- src/DotNetFunction/SampleHelloDotNetFunction.cs | 2 +- .../SampleHelloDotNetFunctionTests.cs | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/DotNetFunction/SampleHelloDotNetFunction.cs b/src/DotNetFunction/SampleHelloDotNetFunction.cs index 9c28afd..ccffe84 100644 --- a/src/DotNetFunction/SampleHelloDotNetFunction.cs +++ b/src/DotNetFunction/SampleHelloDotNetFunction.cs @@ -9,7 +9,7 @@ namespace DotNetFunction public static class SampleHelloDotNetFunction { [FunctionName("SampleHelloDotNetFunction")] - public static HttpResponseMessage Run([HttpTrigger(AuthorizationLevel.Anonymous, "get")]HttpRequestMessage request) + public static HttpResponseMessage Run([HttpTrigger(AuthorizationLevel.Function, "get")]HttpRequestMessage request) { var name = request.GetQueryNameValuePairs() .FirstOrDefault(q => string.Compare(q.Key, "name", true) == 0) diff --git a/test/DotNetFunction.IntegrationTests/SampleHelloDotNetFunctionTests.cs b/test/DotNetFunction.IntegrationTests/SampleHelloDotNetFunctionTests.cs index 4ead091..5f5237d 100644 --- a/test/DotNetFunction.IntegrationTests/SampleHelloDotNetFunctionTests.cs +++ b/test/DotNetFunction.IntegrationTests/SampleHelloDotNetFunctionTests.cs @@ -30,8 +30,7 @@ public async Task Get_WrongFunctionKey_ShouldSendUnauthorized() var response = await httpClient.GetAsync(urlTested); //Assert - //Assert.Equal(HttpStatusCode.Unauthorized, response.StatusCode); - Assert.Equal(HttpStatusCode.OK, response.StatusCode);//TMP: should be replaced by the line above when this issue will be fixed: https://github.com/Azure/azure-webjobs-sdk-script/issues/1752 + Assert.Equal(HttpStatusCode.Unauthorized, response.StatusCode); } [Fact]