Skip to content

Commit

Permalink
Update Claims reference
Browse files Browse the repository at this point in the history
  • Loading branch information
joemcbride committed Aug 2, 2017
1 parent 13245c5 commit b97decc
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/GraphQL.Authorization.Tests/AuthorizationSettingsTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using System.Linq;
using Shouldly;
using Xunit;

namespace GraphQL.Authorization.Tests
{
public class AuthorizationSettingsTests
{
private readonly AuthorizationSettings _settings;

public AuthorizationSettingsTests()
{
_settings = new AuthorizationSettings();
}

[Fact]
public void can_add_a_claim_policy()
{
_settings.AddPolicy("MyPolicy", _ =>
{
_.RequireClaim("Admin");
});

_settings.Policies.Count().ShouldBe(1);

var policy = _settings.Policies.Single();
policy.Requirements.Single().ShouldBeOfType<ClaimAuthorizationRequirement>();
}
}
}
3 changes: 3 additions & 0 deletions src/GraphQL.Authorization/GraphQL.Authorization.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
<ItemGroup>
<PackageReference Include="GraphQL" Version="0.17.2" />
<PackageReference Include="GraphQL-Parser" Version="2.0.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard1.3'">
<PackageReference Include="System.Security.Claims" Version="4.3.0" />
</ItemGroup>

Expand Down

0 comments on commit b97decc

Please sign in to comment.