use of com.evolveum.midpoint.xml.ns._public.common.common_3.AuthorizationType in project midpoint by Evolveum.
the class UserProfileServiceMock method initializePrincipalFromAssignments.
private void initializePrincipalFromAssignments(MidPointPrincipal principal, PrismObject<SystemConfigurationType> systemConfiguration) {
OperationResult result = new OperationResult(UserProfileServiceMock.class.getName() + ".addAuthorizations");
principal.setApplicableSecurityPolicy(locateSecurityPolicy(principal, systemConfiguration, result));
if (systemConfiguration != null) {
principal.setAdminGuiConfiguration(systemConfiguration.asObjectable().getAdminGuiConfiguration());
}
AuthorizationType authorizationType = new AuthorizationType();
authorizationType.getAction().add("FAKE");
principal.getAuthorities().add(new Authorization(authorizationType));
ActivationType activation = principal.getUser().getActivation();
if (activation != null) {
activationComputer.computeEffective(principal.getUser().getLifecycleState(), activation);
}
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.AuthorizationType in project midpoint by Evolveum.
the class AbstractSecurityTest method test000Sanity.
@Test
public void test000Sanity() throws Exception {
final String TEST_NAME = "test000Sanity";
TestUtil.displayTestTile(this, TEST_NAME);
assertLoggedInUser(USER_ADMINISTRATOR_USERNAME);
// WHEN
PrismObject<RoleType> roleSelf = getRole(ROLE_SELF_OID);
// THEN
display("Role self", roleSelf);
List<AuthorizationType> authorizations = roleSelf.asObjectable().getAuthorization();
assertEquals("Wrong number of authorizations", 2, authorizations.size());
AuthorizationType authRead = findAutz(authorizations, ModelAuthorizationAction.READ.getUrl());
assertEquals("Wrong action in authorization", ModelAuthorizationAction.READ.getUrl(), authRead.getAction().get(0));
List<OwnedObjectSelectorType> objectSpecs = authRead.getObject();
assertEquals("Wrong number of object specs in authorization", 1, objectSpecs.size());
SubjectedObjectSelectorType objectSpec = objectSpecs.get(0);
List<SpecialObjectSpecificationType> specials = objectSpec.getSpecial();
assertEquals("Wrong number of specials in object specs in authorization", 1, specials.size());
SpecialObjectSpecificationType special = specials.get(0);
assertEquals("Wrong special in object specs in authorization", SpecialObjectSpecificationType.SELF, special);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.AuthorizationType in project midpoint by Evolveum.
the class SelfRegistrationAuthenticationChannel method resolveAuthorities.
@Override
public Collection<Authorization> resolveAuthorities(Collection<Authorization> authorities) {
ArrayList<Authorization> newAuthorities = new ArrayList<>();
AuthorizationType authorizationType = new AuthorizationType();
authorizationType.getAction().add(AuthorizationConstants.AUTZ_UI_SELF_REGISTRATION_FINISH_URL);
Authorization selfServiceCredentialsAuthz = new Authorization(authorizationType);
newAuthorities.add(selfServiceCredentialsAuthz);
authorities.addAll(newAuthorities);
return authorities;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.AuthorizationType in project midpoint by Evolveum.
the class TestSecurityMultitenant method test116AutzLetoProtectTenantAdminRole.
/**
* Make sure that tenant admin cannot break tenant admin role.
*/
@Test
public void test116AutzLetoProtectTenantAdminRole() throws Exception {
// GIVEN
cleanupAutzTest(null);
login(USER_LETO_ATREIDES_NAME);
// WHEN
when();
assertAddDeny(ROLE_ATREIDES_HACKER_FILE);
AuthorizationType superuserAuthorization = new AuthorizationType().action(AuthorizationConstants.AUTZ_ALL_URL);
assertDeny("add authorizations to atreides admin", (task, result) -> modifyObjectAddContainer(RoleType.class, ROLE_ATREIDES_ADMIN_OID, RoleType.F_AUTHORIZATION, task, result, superuserAuthorization));
assertDeny("induce superuser", (task, result) -> induceRole(ROLE_ATREIDES_ADMIN_OID, ROLE_SUPERUSER_OID, task, result));
assertDeny("add dummy account", (task, result) -> assignAccount(UserType.class, USER_PAUL_ATREIDES_OID, RESOURCE_DUMMY_OID, null, task, result));
PolicyRuleType policyRule = new PolicyRuleType();
policyRule.beginPolicyConstraints().beginMinAssignees().multiplicity("1");
assertDeny("assign policy rule", (task, result) -> assignPolicyRule(RoleType.class, ROLE_ATREIDES_ADMIN_OID, policyRule, task, result));
AssignmentType policyExceptionAssignment = new AssignmentType();
policyExceptionAssignment.beginPolicyException().ruleName("foobar");
assertDeny("assign policy exception", (task, result) -> assign(RoleType.class, ROLE_ATREIDES_ADMIN_OID, policyExceptionAssignment, task, result));
PolicyExceptionType policyException = new PolicyExceptionType().ruleName("foofoo");
assertDeny("add policyException to atreides admin", (task, result) -> modifyObjectAddContainer(RoleType.class, ROLE_ATREIDES_ADMIN_OID, RoleType.F_POLICY_EXCEPTION, task, result, policyException));
// THEN
then();
assertGlobalStateUntouched();
}
Aggregations