public void TokenWithoutUser_DoesNotMatch() { SecurityToken token = TestHelper.CreateTokenWithoutUser(); SecurityTokenMatcher matcher = new SecurityTokenMatcher(_ace); Assert.That(matcher.MatchesToken(token), Is.False); }
public void TokenWithoutOwningTenant_DoesNotMatch() { User principal = CreateUser(_companyHelper.CompanyTenant, null); SecurityToken token = TestHelper.CreateTokenWithOwningTenant(principal, null); SecurityTokenMatcher matcher = new SecurityTokenMatcher(_ace); Assert.That(matcher.MatchesToken(token), Is.False); }
public void EmptyToken_DoesNotMatch() { AccessControlEntry entry = TestHelper.CreateAceWithAbstractRole(); SecurityTokenMatcher matcher = new SecurityTokenMatcher(entry); SecurityToken token = TestHelper.CreateTokenWithoutUser(); Assert.That(matcher.MatchesToken(token), Is.False); }
public void TokenWithAbstractRole_Matches() { AccessControlEntry entry = TestHelper.CreateAceWithAbstractRole(); SecurityTokenMatcher matcher = new SecurityTokenMatcher(entry); SecurityToken token = TestHelper.CreateTokenWithAbstractRole(entry.SpecificAbstractRole); Assert.That(matcher.MatchesToken(token), Is.True); }
public void TokenWithPrincipal_Matches() { SecurityToken token = TestHelper.CreateTokenWithOwningUser(_ace.SpecificUser, null); SecurityTokenMatcher matcher = new SecurityTokenMatcher(_ace); Assert.That(matcher.MatchesToken(token), Is.True); }
public void TokenWithPrincipal_Matches() { User principal = CreateUser(_companyHelper.CompanyTenant, null); SecurityToken token = TestHelper.CreateTokenWithOwningUser(principal, null); SecurityTokenMatcher matcher = new SecurityTokenMatcher(_ace); Assert.That(matcher.MatchesToken(token), Is.True); }
public void TokenWithPrincipalAndDifferentSpecificTenant_DoesNotMatch() { User principal = CreateUser(TestHelper.CreateTenant("Tenant"), null); SecurityToken token = TestHelper.CreateTokenWithOwningUser(principal, null); SecurityTokenMatcher matcher = new SecurityTokenMatcher(_ace); Assert.That(matcher.MatchesToken(token), Is.False); }
public void EmptyAce_Matches() { AccessControlEntry entry = AccessControlEntry.NewObject(); SecurityTokenMatcher matcher = new SecurityTokenMatcher(entry); SecurityToken token = TestHelper.CreateTokenWithoutUser(); Assert.That(matcher.MatchesToken(token), Is.True); }
public void TokenWithNullPrincipal_NotMatches() { AccessControlEntry entry = AccessControlEntry.NewObject(); SecurityTokenMatcher matcher = new SecurityTokenMatcher(entry); SecurityToken token = TestHelper.CreateTokenWithNullPrincipal(); Assert.That(matcher.MatchesToken(token), Is.False); }
public void TokenWithAbstractRole_Matches() { AccessControlEntry entry = AccessControlEntry.NewObject(); SecurityTokenMatcher matcher = new SecurityTokenMatcher(entry); SecurityToken token = TestHelper.CreateTokenWithAbstractRole(TestHelper.CreateTestAbstractRole()); Assert.That(matcher.MatchesToken(token), Is.True); }
// methods and properties protected override void OnLoaded(LoadMode loadMode) { base.OnLoaded(loadMode); if (loadMode == LoadMode.WholeDomainObjectInitialized) { _matcher = new SecurityTokenMatcher(this); } }
protected AccessControlEntry() { // ReSharper disable DoNotCallOverridableMethodsInConstructor TenantCondition = TenantCondition.None; GroupCondition = GroupCondition.None; UserCondition = UserCondition.None; // ReSharper restore DoNotCallOverridableMethodsInConstructor _matcher = new SecurityTokenMatcher(this); }
public void TokenWithoutUser_DoesNotMatch() { _ace.GroupHierarchyCondition = GroupHierarchyCondition.This; SecurityToken token = TestHelper.CreateTokenWithoutUser(); SecurityTokenMatcher matcher = new SecurityTokenMatcher(_ace); Assert.That(matcher.MatchesToken(token), Is.False); }
public void TokenWithPositionBelowBranchRoot_DoesNotMatch() { User user = CreateUser(_companyHelper.CompanyTenant, null); TestHelper.CreateRole(user, _companyHelper.AustrianProjectsDepartment, _companyHelper.HeadPosition); SecurityToken token = TestHelper.CreateTokenWithOwningGroup(user, _companyHelper.AustrianProjectsDepartment); SecurityTokenMatcher matcher = new SecurityTokenMatcher(_ace); Assert.That(matcher.MatchesToken(token), Is.False); }
public void TokenWithPrincipalFromOtherGroupType_DoesNotMatch() { User user = CreateUser(_companyHelper.CompanyTenant, null); TestHelper.CreateRole(user, _companyHelper.AustrianCarTeam, _companyHelper.HeadPosition); SecurityToken token = TestHelper.CreateTokenWithOwningGroup(user, null); SecurityTokenMatcher matcher = new SecurityTokenMatcher(_ace); Assert.That(matcher.MatchesToken(token), Is.False); }
public void TokenWithTenantDifferentFromOwningTenant_DoesNotMatch() { SecurityToken token = SecurityToken.Create( PrincipalTestHelper.Create(TestHelper.CreateTenant("tenant"), null, new Role[0]), _companyHelper.CompanyTenant, null, null, Enumerable.Empty <IDomainObjectHandle <AbstractRoleDefinition> >()); SecurityTokenMatcher matcher = new SecurityTokenMatcher(_ace); Assert.That(matcher.MatchesToken(token), Is.False); }
public void TokenWithoutPrincipalUser_Matches() { SecurityToken token = SecurityToken.Create( PrincipalTestHelper.Create(_companyHelper.CompanyTenant, null, new Role[0]), _companyHelper.CompanyTenant, null, null, Enumerable.Empty <IDomainObjectHandle <AbstractRoleDefinition> >()); SecurityTokenMatcher matcher = new SecurityTokenMatcher(_ace); Assert.That(matcher.MatchesToken(token), Is.True); }
public void TokenWithOtherPositionInBranchRoot_DoesNotMatch() { User user = CreateUser(_companyHelper.CompanyTenant, null); TestHelper.CreateRole(user, _companyHelper.AustrianDivsion, _companyHelper.MemberPosition); SecurityToken token = TestHelper.CreateTokenWithOwningGroup(user, _companyHelper.AustrianDivsion); SecurityTokenMatcher matcher = new SecurityTokenMatcher(_ace); Assert.That(matcher.MatchesToken(token), Is.False); }
public void TokenWithPrincipalAndOtherPosition_DoesNotMatch() { User user = CreateUser(_companyHelper.CompanyTenant, null); TestHelper.CreateRole(user, _companyHelper.AustrianProjectsDepartment, _companyHelper.MemberPosition); SecurityToken token = TestHelper.CreateTokenWithOwningUser(user, null); SecurityTokenMatcher matcher = new SecurityTokenMatcher(_ace); Assert.That(matcher.MatchesToken(token), Is.False); }
public void TokenWithPrincipal_Matches() { User user = CreateUser(_companyHelper.CompanyTenant, null); TestHelper.CreateRole(user, _ace.SpecificGroup, _companyHelper.HeadPosition); SecurityToken token = TestHelper.CreateTokenWithOwningUser(user, null); SecurityTokenMatcher matcher = new SecurityTokenMatcher(_ace); Assert.That(matcher.MatchesToken(token), Is.True); }
public void TokenWithTenantAndAbstractRole_AceForOwningTenant_Matches() { Tenant tenant = TestHelper.CreateTenant("Testtenant"); Position managerPosition = TestHelper.CreatePosition("Manager"); Group group = TestHelper.CreateGroup("Testgroup", null, tenant); User user = CreateUser(tenant, group); AccessControlEntry entry = TestHelper.CreateAceWithOwningTenant(); SecurityTokenMatcher matcher = new SecurityTokenMatcher(entry); SecurityToken token = TestHelper.CreateToken(user, tenant, null, null, new[] { TestHelper.CreateTestAbstractRole() }); Assert.That(matcher.MatchesToken(token), Is.True); }
public void TokenWithPrincipalInChild_DoesNotMatch() { User user = CreateUser(_companyHelper.CompanyTenant, null); Group childGroup = _ace.SpecificGroup.Children[0]; TestHelper.CreateRole(user, childGroup, _companyHelper.HeadPosition); SecurityToken token = TestHelper.CreateTokenWithOwningUser(user, null); SecurityTokenMatcher matcher = new SecurityTokenMatcher(_ace); Assert.That(matcher.MatchesToken(token), Is.False); }
public void AceWithExactGroup_TokenWithPrincipalAndOtherOwningUser_DoesNotMatch() { _ace.GroupHierarchyCondition = GroupHierarchyCondition.This; User owningUser = _companyHelper.CarTeamMember; User user = CreateUser(_companyHelper.CompanyTenant, null); Group owningGroup = _companyHelper.AustrianCarTeam; SecurityToken token = TestHelper.CreateToken(user, null, owningGroup, owningUser, null); SecurityTokenMatcher matcher = new SecurityTokenMatcher(_ace); Assert.That(matcher.MatchesToken(token), Is.False); }
public void AceWithExactGroup_TokenWithPrincipalFromOwningUser_Matches() { _ace.GroupHierarchyCondition = GroupHierarchyCondition.This; User owningUser = _companyHelper.CarTeamMember; Group owningGroup = _companyHelper.AustrianCarTeam; User user = owningUser; SecurityToken token = TestHelper.CreateToken(user, null, owningGroup, owningUser, null); SecurityTokenMatcher matcher = new SecurityTokenMatcher(_ace); Assert.That(matcher.MatchesToken(token), Is.True); }
public void TokenWithPrincipalInGroupMatchingGroupType_Matches() { User user = CreateUser(_companyHelper.CompanyTenant, null); Group userGroup = _companyHelper.AustrianProjectsDepartment; TestHelper.CreateRole(user, userGroup, _companyHelper.HeadPosition); SecurityToken token = TestHelper.CreateTokenWithOwningGroup(user, null); SecurityTokenMatcher matcher = new SecurityTokenMatcher(_ace); Assert.That(matcher.MatchesToken(token), Is.True); }
public void AceForOwningTenantAndAbstractRole_DoesNotMatch() { Tenant tenant = TestHelper.CreateTenant("Testtenant"); Group group = TestHelper.CreateGroup("Testgroup", null, tenant); User user = CreateUser(tenant, group); AccessControlEntry entry = TestHelper.CreateAceWithOwningTenant(); entry.SpecificAbstractRole = TestHelper.CreateTestAbstractRole(); SecurityTokenMatcher matcher = new SecurityTokenMatcher(entry); SecurityToken token = TestHelper.CreateTokenWithOwningTenant(user, tenant); Assert.That(matcher.MatchesToken(token), Is.False); }
public void TokenWithPrincipalInOwningGroup_OwningGroupIsBranchRoot_Matches() { User user = CreateUser(_companyHelper.CompanyTenant, null); Group owningGroup = _companyHelper.AustrianDivsion; TestHelper.CreateRole(user, owningGroup, _companyHelper.HeadPosition); SecurityToken token = TestHelper.CreateTokenWithOwningGroup(user, owningGroup); SecurityTokenMatcher matcher = new SecurityTokenMatcher(_ace); Assert.That(matcher.MatchesToken(token), Is.True); }
public void TokenWithRoleAndAbstractRole_AceForPositionFromOwningGroup_Matches() { Tenant tenant = TestHelper.CreateTenant("Testtenant"); Position managerPosition = TestHelper.CreatePosition("Manager"); Group group = TestHelper.CreateGroup("Testgroup", null, tenant); User user = CreateUser(tenant, group); Role role = TestHelper.CreateRole(user, group, managerPosition); AccessControlEntry entry = TestHelper.CreateAceWithPositionAndGroupCondition(managerPosition, GroupCondition.OwningGroup); SecurityTokenMatcher matcher = new SecurityTokenMatcher(entry); SecurityToken token = TestHelper.CreateToken(user, null, group, null, new[] { TestHelper.CreateTestAbstractRole() }); Assert.That(matcher.MatchesToken(token), Is.True); }
public void TokenWithoutPrincipalRoles_DoesNotMatch() { SecurityToken token = SecurityToken.Create( PrincipalTestHelper.Create(_companyHelper.CompanyTenant, _companyHelper.CarTeamMember, new Role[0]), null, _companyHelper.AustrianCarTeam, null, Enumerable.Empty <IDomainObjectHandle <AbstractRoleDefinition> >()); SecurityTokenMatcher matcher = new SecurityTokenMatcher(_ace); Assert.That(matcher.MatchesToken(token), Is.False); }
public void AceWithExactGroup_TokenWithPrincipalAndOtherPosition_DoesNotMatch() { _ace.GroupHierarchyCondition = GroupHierarchyCondition.This; User user = CreateUser(_companyHelper.CompanyTenant, null); Group owningGroup = _companyHelper.AustrianProjectsDepartment; TestHelper.CreateRole(user, owningGroup, _companyHelper.MemberPosition); SecurityToken token = TestHelper.CreateTokenWithOwningGroup(user, owningGroup); SecurityTokenMatcher matcher = new SecurityTokenMatcher(_ace); Assert.That(matcher.MatchesToken(token), Is.False); }