Skip to content

Commit d500861

Browse files
sungam3rjoemcbride
authored andcommitted
fixes #69 (#70)
1 parent 8e7b3c7 commit d500861

File tree

5 files changed

+40
-21
lines changed

5 files changed

+40
-21
lines changed

src/GraphQL.Authorization.Tests/ValidationTestBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ private IValidationResult Validate(ValidationTestConfig config)
8888
var documentBuilder = new GraphQLDocumentBuilder();
8989
var document = documentBuilder.Build(config.Query);
9090
var validator = new DocumentValidator();
91-
return validator.Validate(config.Query, config.Schema, document, config.Rules, userContext, config.Inputs);
91+
return validator.ValidateAsync(config.Query, config.Schema, document, config.Rules, userContext, config.Inputs).GetAwaiter().GetResult(); ;
9292
}
9393

9494
protected ClaimsPrincipal CreatePrincipal(string authenticationType = null, IDictionary<string, string> claims = null)

src/GraphQL.Authorization.sln

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,64 @@
1-
21
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 15
4-
VisualStudioVersion = 15.0.26430.16
2+
# Visual Studio Version 16
3+
VisualStudioVersion = 16.0.29613.14
54
MinimumVisualStudioVersion = 15.0.26124.0
65
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GraphQL.Authorization", "GraphQL.Authorization\GraphQL.Authorization.csproj", "{21771B0C-0FCE-41DA-BF0B-67D70368BB00}"
76
EndProject
87
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GraphQL.Authorization.Tests", "GraphQL.Authorization.Tests\GraphQL.Authorization.Tests.csproj", "{C482F1AF-6E9D-4D1C-96D7-3C0206312B66}"
98
EndProject
10-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Harness", "Harness\Harness.csproj", "{DEA32495-F7AA-45F0-8AF6-DE4FB089994F}"
9+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Harness", "Harness\Harness.csproj", "{DEA32495-F7AA-45F0-8AF6-DE4FB089994F}"
1110
EndProject
1211
Global
1312
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1413
Debug|Any CPU = Debug|Any CPU
15-
Release|Any CPU = Release|Any CPU
1614
Debug|x64 = Debug|x64
1715
Debug|x86 = Debug|x86
16+
Release|Any CPU = Release|Any CPU
1817
Release|x64 = Release|x64
1918
Release|x86 = Release|x86
2019
EndGlobalSection
2120
GlobalSection(ProjectConfigurationPlatforms) = postSolution
2221
{21771B0C-0FCE-41DA-BF0B-67D70368BB00}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
2322
{21771B0C-0FCE-41DA-BF0B-67D70368BB00}.Debug|Any CPU.Build.0 = Debug|Any CPU
23+
{21771B0C-0FCE-41DA-BF0B-67D70368BB00}.Debug|x64.ActiveCfg = Debug|Any CPU
24+
{21771B0C-0FCE-41DA-BF0B-67D70368BB00}.Debug|x64.Build.0 = Debug|Any CPU
25+
{21771B0C-0FCE-41DA-BF0B-67D70368BB00}.Debug|x86.ActiveCfg = Debug|Any CPU
26+
{21771B0C-0FCE-41DA-BF0B-67D70368BB00}.Debug|x86.Build.0 = Debug|Any CPU
2427
{21771B0C-0FCE-41DA-BF0B-67D70368BB00}.Release|Any CPU.ActiveCfg = Release|Any CPU
2528
{21771B0C-0FCE-41DA-BF0B-67D70368BB00}.Release|Any CPU.Build.0 = Release|Any CPU
29+
{21771B0C-0FCE-41DA-BF0B-67D70368BB00}.Release|x64.ActiveCfg = Release|Any CPU
30+
{21771B0C-0FCE-41DA-BF0B-67D70368BB00}.Release|x64.Build.0 = Release|Any CPU
31+
{21771B0C-0FCE-41DA-BF0B-67D70368BB00}.Release|x86.ActiveCfg = Release|Any CPU
32+
{21771B0C-0FCE-41DA-BF0B-67D70368BB00}.Release|x86.Build.0 = Release|Any CPU
2633
{C482F1AF-6E9D-4D1C-96D7-3C0206312B66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
2734
{C482F1AF-6E9D-4D1C-96D7-3C0206312B66}.Debug|Any CPU.Build.0 = Debug|Any CPU
35+
{C482F1AF-6E9D-4D1C-96D7-3C0206312B66}.Debug|x64.ActiveCfg = Debug|Any CPU
36+
{C482F1AF-6E9D-4D1C-96D7-3C0206312B66}.Debug|x64.Build.0 = Debug|Any CPU
37+
{C482F1AF-6E9D-4D1C-96D7-3C0206312B66}.Debug|x86.ActiveCfg = Debug|Any CPU
38+
{C482F1AF-6E9D-4D1C-96D7-3C0206312B66}.Debug|x86.Build.0 = Debug|Any CPU
2839
{C482F1AF-6E9D-4D1C-96D7-3C0206312B66}.Release|Any CPU.ActiveCfg = Release|Any CPU
2940
{C482F1AF-6E9D-4D1C-96D7-3C0206312B66}.Release|Any CPU.Build.0 = Release|Any CPU
41+
{C482F1AF-6E9D-4D1C-96D7-3C0206312B66}.Release|x64.ActiveCfg = Release|Any CPU
42+
{C482F1AF-6E9D-4D1C-96D7-3C0206312B66}.Release|x64.Build.0 = Release|Any CPU
43+
{C482F1AF-6E9D-4D1C-96D7-3C0206312B66}.Release|x86.ActiveCfg = Release|Any CPU
44+
{C482F1AF-6E9D-4D1C-96D7-3C0206312B66}.Release|x86.Build.0 = Release|Any CPU
3045
{DEA32495-F7AA-45F0-8AF6-DE4FB089994F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
3146
{DEA32495-F7AA-45F0-8AF6-DE4FB089994F}.Debug|Any CPU.Build.0 = Debug|Any CPU
32-
{DEA32495-F7AA-45F0-8AF6-DE4FB089994F}.Debug|x64.ActiveCfg = Debug|x64
33-
{DEA32495-F7AA-45F0-8AF6-DE4FB089994F}.Debug|x64.Build.0 = Debug|x64
34-
{DEA32495-F7AA-45F0-8AF6-DE4FB089994F}.Debug|x86.ActiveCfg = Debug|x86
35-
{DEA32495-F7AA-45F0-8AF6-DE4FB089994F}.Debug|x86.Build.0 = Debug|x86
47+
{DEA32495-F7AA-45F0-8AF6-DE4FB089994F}.Debug|x64.ActiveCfg = Debug|Any CPU
48+
{DEA32495-F7AA-45F0-8AF6-DE4FB089994F}.Debug|x64.Build.0 = Debug|Any CPU
49+
{DEA32495-F7AA-45F0-8AF6-DE4FB089994F}.Debug|x86.ActiveCfg = Debug|Any CPU
50+
{DEA32495-F7AA-45F0-8AF6-DE4FB089994F}.Debug|x86.Build.0 = Debug|Any CPU
3651
{DEA32495-F7AA-45F0-8AF6-DE4FB089994F}.Release|Any CPU.ActiveCfg = Release|Any CPU
3752
{DEA32495-F7AA-45F0-8AF6-DE4FB089994F}.Release|Any CPU.Build.0 = Release|Any CPU
38-
{DEA32495-F7AA-45F0-8AF6-DE4FB089994F}.Release|x64.ActiveCfg = Release|x64
39-
{DEA32495-F7AA-45F0-8AF6-DE4FB089994F}.Release|x64.Build.0 = Release|x64
40-
{DEA32495-F7AA-45F0-8AF6-DE4FB089994F}.Release|x86.ActiveCfg = Release|x86
41-
{DEA32495-F7AA-45F0-8AF6-DE4FB089994F}.Release|x86.Build.0 = Release|x86
53+
{DEA32495-F7AA-45F0-8AF6-DE4FB089994F}.Release|x64.ActiveCfg = Release|Any CPU
54+
{DEA32495-F7AA-45F0-8AF6-DE4FB089994F}.Release|x64.Build.0 = Release|Any CPU
55+
{DEA32495-F7AA-45F0-8AF6-DE4FB089994F}.Release|x86.ActiveCfg = Release|Any CPU
56+
{DEA32495-F7AA-45F0-8AF6-DE4FB089994F}.Release|x86.Build.0 = Release|Any CPU
4257
EndGlobalSection
4358
GlobalSection(SolutionProperties) = preSolution
4459
HideSolutionNode = FALSE
4560
EndGlobalSection
61+
GlobalSection(ExtensibilityGlobals) = postSolution
62+
SolutionGuid = {B582AABA-5414-45C5-920C-1A00B5B1FDB4}
63+
EndGlobalSection
4664
EndGlobal

src/GraphQL.Authorization/AuthorizationValidationRule.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System.Linq;
1+
using System.Linq;
2+
using System.Threading.Tasks;
23
using GraphQL.Language.AST;
34
using GraphQL.Types;
45
using GraphQL.Validation;
@@ -14,11 +15,11 @@ public AuthorizationValidationRule(IAuthorizationEvaluator evaluator)
1415
_evaluator = evaluator;
1516
}
1617

17-
public INodeVisitor Validate(ValidationContext context)
18+
public Task<INodeVisitor> ValidateAsync(ValidationContext context)
1819
{
1920
var userContext = context.UserContext as IProvideClaimsPrincipal;
2021

21-
return new EnterLeaveListener(_ =>
22+
return Task.FromResult((INodeVisitor)new EnterLeaveListener(_ =>
2223
{
2324
var operationType = OperationType.Query;
2425

@@ -56,7 +57,7 @@ public INodeVisitor Validate(ValidationContext context)
5657
// check returned graph type
5758
CheckAuth(fieldAst, fieldDef.ResolvedType.GetNamedType(), userContext, context, operationType);
5859
});
59-
});
60+
}));
6061
}
6162

6263
private void CheckAuth(

src/GraphQL.Authorization/GraphQL.Authorization.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<Description>A toolset for authorizing access to graph types for GraphQL .NET</Description>
@@ -24,7 +24,7 @@
2424
</ItemGroup>
2525

2626
<ItemGroup>
27-
<PackageReference Include="GraphQL" Version="3.0.0-preview-1268" />
27+
<PackageReference Include="GraphQL" Version="3.0.0-preview-1352" />
2828
</ItemGroup>
2929

3030
</Project>

src/Harness/Harness.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
</ItemGroup>
1414

1515
<ItemGroup>
16-
<PackageReference Include="GraphQL" Version="3.0.0-preview-1268" />
16+
<PackageReference Include="GraphQL" Version="3.0.0-preview-1352" />
1717
<PackageReference Include="GraphQL.Server.Ui.GraphiQL" Version="3.5.0-alpha0027" />
1818
<PackageReference Include="GraphQL.Server.Transports.AspNetCore" Version="3.5.0-alpha0027" />
1919
<PackageReference Include="Microsoft.AspNetCore.All" />

0 commit comments

Comments
 (0)