use of com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType 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.ActivationType in project midpoint by Evolveum.
the class TestOpenLdap method test700CheckBarbossaLockoutStatus.
@Test
public void test700CheckBarbossaLockoutStatus() throws Exception {
final String TEST_NAME = "test700CheckBarbossaLockoutStatus";
TestUtil.displayTestTile(this, TEST_NAME);
// WHEN
TestUtil.displayWhen(TEST_NAME);
PrismObject<ShadowType> shadow = getShadowModel(accountBarbossaOid);
// THEN
TestUtil.displayThen(TEST_NAME);
display("Shadow (model)", shadow);
ActivationType activation = shadow.asObjectable().getActivation();
if (activation != null) {
LockoutStatusType lockoutStatus = shadow.asObjectable().getActivation().getLockoutStatus();
if (lockoutStatus != null && lockoutStatus != LockoutStatusType.NORMAL) {
AssertJUnit.fail("Barbossa is locked!");
}
}
assertLdapPassword(USER_BARBOSSA_USERNAME, USER_BARBOSSA_PASSWORD_2);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType in project midpoint by Evolveum.
the class TestOpenLdap method test702LockOutBarbossa.
@Test
public void test702LockOutBarbossa() throws Exception {
final String TEST_NAME = "test702LockOutBarbossa";
TestUtil.displayTestTile(this, TEST_NAME);
Entry entry = getLdapAccountByUid(USER_BARBOSSA_USERNAME);
display("LDAP Entry before", entry);
// WHEN
TestUtil.displayWhen(TEST_NAME);
for (int i = 0; i < 10; i++) {
LdapNetworkConnection conn;
try {
conn = ldapConnect(null, entry.getDn().toString(), "this password is wrong");
} catch (SecurityException e) {
// Good bad attempt
continue;
}
assertNotReached();
}
// THEN
TestUtil.displayThen(TEST_NAME);
entry = assertLdapAccount(USER_BARBOSSA_USERNAME, USER_BARBOSSA_FULL_NAME);
display("LDAP Entry after", entry);
PrismObject<ShadowType> shadow = getShadowModel(accountBarbossaOid);
display("Shadow (model)", shadow);
ActivationType activation = shadow.asObjectable().getActivation();
assertNotNull("No activation", activation);
LockoutStatusType lockoutStatus = shadow.asObjectable().getActivation().getLockoutStatus();
assertEquals("Wrong lockout status", LockoutStatusType.LOCKED, lockoutStatus);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType in project midpoint by Evolveum.
the class ActivationComputer method computeEffective.
public void computeEffective(String lifecycleStatus, ActivationType activationType, XMLGregorianCalendar referenceTime) {
ActivationStatusType effectiveStatus = null;
if (lifecycleStatus != null && !lifecycleStatus.equals(SchemaConstants.LIFECYCLE_ACTIVE) && !lifecycleStatus.equals(SchemaConstants.LIFECYCLE_DEPRECATED)) {
effectiveStatus = ActivationStatusType.DISABLED;
}
if (SchemaConstants.LIFECYCLE_ARCHIVED.equals(lifecycleStatus)) {
effectiveStatus = ActivationStatusType.ARCHIVED;
}
ActivationStatusType administrativeStatus = activationType.getAdministrativeStatus();
if (effectiveStatus == null && administrativeStatus != null) {
// Explicit administrative status overrides everything
effectiveStatus = administrativeStatus;
}
TimeIntervalStatusType validityStatus = getValidityStatus(activationType);
if (effectiveStatus == null) {
if (validityStatus == null) {
// No administrative status, no validity. Defaults to enabled.
effectiveStatus = ActivationStatusType.ENABLED;
} else {
switch(validityStatus) {
case AFTER:
case BEFORE:
effectiveStatus = ActivationStatusType.DISABLED;
break;
case IN:
effectiveStatus = ActivationStatusType.ENABLED;
break;
}
}
}
activationType.setEffectiveStatus(effectiveStatus);
activationType.setValidityStatus(validityStatus);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType in project midpoint by Evolveum.
the class TestActivationComputer method createActivationType.
private ActivationType createActivationType(ActivationStatusType administrativeStatus, XMLGregorianCalendar validFrom, XMLGregorianCalendar validTo) {
ActivationType activationType = new ActivationType();
activationType.setAdministrativeStatus(administrativeStatus);
activationType.setValidFrom(validFrom);
activationType.setValidTo(validTo);
return activationType;
}
Aggregations