Feature/fix #240 (#243)

* testing issue on train

* check multiple claims of the same type for authorisation
This commit is contained in:
Tom Pallister
2018-02-21 20:53:46 +00:00
committed by GitHub
parent 1e48a97294
commit 9f7478c91f
3 changed files with 153 additions and 7 deletions

View File

@ -27,7 +27,25 @@ namespace Ocelot.UnitTests.Authorization
{
this.Given(x => x.GivenAClaimsPrincipal(new ClaimsPrincipal(new ClaimsIdentity(new List<Claim>
{
new Claim("UserType", "registered")
new Claim("UserType", "registered"),
}))))
.And(x => x.GivenARouteClaimsRequirement(new Dictionary<string, string>
{
{"UserType", "registered"}
}))
.When(x => x.WhenICallTheAuthoriser())
.Then(x => x.ThenTheUserIsAuthorised())
.BDDfy();
}
[Fact]
public void should_authorise_user_multiple_claims_of_same_type()
{
this.Given(x => x.GivenAClaimsPrincipal(new ClaimsPrincipal(new ClaimsIdentity(new List<Claim>
{
new Claim("UserType", "guest"),
new Claim("UserType", "registered"),
}))))
.And(x => x.GivenARouteClaimsRequirement(new Dictionary<string, string>
{