Bases: keystone.tests.unit.core.BaseTestCase
A class for testing the mapping rule engine.
Check whether mapped properties object has ‘user’ within.
According to today’s rules, RuleProcessor does not have to issue user’s id or name. What’s actually required is user’s type and for ephemeral users that would be service domain named ‘Federated’.
Test that local users can have non-service domains assigned.
Test mapping engine when domain ‘ephemeral’ is explicitly set.
For that, we use mapping rule MAPPING_EPHEMERAL_USER and assertion EMPLOYEE_ASSERTION
Should return user’s name and group id EMPLOYEE_GROUP_ID.
The ADMIN_ASSERTION should successfully have a match in MAPPING_LARGE. They will test the case where any_one_of is valid, and there is a direct mapping for the users name.
Should return group CONTRACTOR_GROUP_ID.
The CONTRACTOR_ASSERTION should successfully have a match in MAPPING_SMALL. This will test the case where many rules must be matched, including an any_one_of, and a direct mapping.
Should return user’s group Developer.
The EMPLOYEE_ASSERTION_MULTIPLE_GROUPS should successfully have a match in MAPPING_GROUPS_BLACKLIST. It will test the case where ‘blacklist’ correctly filters out Manager and Developer and only allows Contractor.
Test matching multiple values before the blacklist.
Verifies that the local indexes are correct when matching multiple remote values for a field when the field occurs before the blacklist entry in the remote rules.
Test if the local rule is rejected upon missing domain value.
This is a variation with a blacklist filter.
Check whether RuleProcessor discards non string objects.
Despite the fact that assertion is malformed and contains non string objects, RuleProcessor should correctly discard them and successfully have a match in MAPPING_LARGE.
Check whether RuleProcessor discards non string objects.
Expect RuleProcessor to discard non string object, which is required for a correct rule match. RuleProcessor will result with ValidationError.
Test mapping engine when group_ids is explicitly set.
Also test blacklists on group ids
Test mapping engine when group_ids is explicitly set.
If the group ids list has only one group, test if the transformation is done correctly
Test mapping engine when group_ids is explicitly set.
Also test whitelists on group ids
Test mapping engine when groups is explicitly set.
If the groups list has only one group, test if the transformation is done correctly
Should return user mapped to no groups.
The EMPLOYEE_ASSERTION should successfully have a match in MAPPING_GROUPS_WHITELIST, but ‘whitelist’ should filter out the group values from the assertion and thus map to no groups.
Should deny authorization, the email of the tester won’t match.
This will not match since the email in the assertion will fail the regex test. It is set to match any @example.com address. But the incoming value is set to eviltester@example.org. RuleProcessor should raise ValidationError.
Should return user’s name and email.
The CUSTOMER_ASSERTION should successfully have a match in MAPPING_LARGE. This will test the case where a requirement has not_any_of, and direct mapping to a username, no group.
Should return group EMPLOYEE_GROUP_ID.
The EMPLOYEE_ASSERTION should successfully have a match in MAPPING_SMALL. This will test the case where many remote rules must be matched, including a not_any_of.
Should deny authorization.
The email in the assertion will fail the regex test. It is set to reject any @example.org address, but the incoming value is set to evildeveloper@example.org. RuleProcessor should yield ValidationError.
Should return group DEVELOPER_GROUP_ID.
The DEVELOPER_ASSERTION should successfully have a match in MAPPING_DEVELOPER_REGEX. This will test the case where many remote rules must be matched, including a not_any_of, with regex set to True.
Should return group CONTRACTOR_GROUP_ID.
The TESTER_ASSERTION should successfully have a match in MAPPING_TESTER_REGEX. This will test the case where many groups are in the assertion, and a regex value is used to try and find a match.
Should return group DEVELOPER_GROUP_ID and TESTER_GROUP_ID.
The TESTER_ASSERTION should successfully have a match in MAPPING_LARGE. This will test a successful regex match for an any_one_of evaluation type, and will have many groups returned.
Check whether RuleProcessor returns group names with their domains.
RuleProcessor should return ‘group_names’ entry with a list of dictionaries with two entries ‘name’ and ‘domain’ identifying group by its name and domain.
Should return user’s groups Developer and Contractor.
The EMPLOYEE_ASSERTION_MULTIPLE_GROUPS should successfully have a match in MAPPING_GROUPS_WHITELIST. It will test the case where ‘whitelist’ correctly filters out Manager and only allows Developer and Contractor.
Test if the local rule is rejected upon missing domain value.
This is a variation with a whitelist filter.
Test auto assigning service domain to ephemeral users.
Test that ephemeral users will always become members of federated service domain. The check depends on type value which must be set to ephemeral in case of ephemeral user.
Test that if the remote “type” is not in the assertion it fails.
Test varius mapping options and how users are identified.
This test calls mapped.setup_username() for propagating user object.
Test plan: - Check if the user has proper domain (‘federated’) set - Check if the user has propert type set (‘ephemeral’) - Check if user’s display_name is properly set and equal to unique_id, as it was not explicitly specified in the mapping.
Test varius mapping options and how users are identified.
This test calls mapped.setup_username() for propagating user object.
Test plan: - Check if the user has proper domain (‘federated’) set - Check if the user has proper type set (‘ephemeral’) - Check if display_name is properly set from the assertion - Check if unique_id is properly set and equal to value hardcoded in the mapping
This test does two iterations with different assertions used as input for the Mapping Engine. Different assertions will be matched with different rules in the ruleset, effectively issuing different user_id (hardcoded values). In the first iteration, the hardcoded user_id is not url-safe and we expect Keystone to make it url safe. In the latter iteration, provided user_id is already url-safe and we expect server not to change it.
Test varius mapping options and how users are identified.
This test calls mapped.setup_username() for propagating user object.
Test plan: - Check if the user has proper domain (‘federated’) set - Check if the user has property type set (‘ephemeral’) - Check if user’s name is properly mapped from the assertion - Check if unique_id is properly set and equal to display_name, as it was not explicitly specified in the mapping.
Test varius mapping options and how users are identified.
This test calls mapped.setup_username() for propagating user object.
Test plan: - Check if the user has proper domain (‘federated’) set - Check if the user has propert type set (‘ephemeral’) - Check if user’s name is properly mapped from the assertion - Check if the unique_id and display_name are properly set
Bases: keystone.tests.unit.core.BaseTestCase
Ensure that unicode data in the assertion headers works.
Bug #1525250 reported that something was not getting correctly encoded and/or decoded when assertion data contained non-ASCII characters.
This test class mimics what happens in a real HTTP request.