use of com.evolveum.midpoint.xml.ns._public.common.common_3.RegistrationsPolicyType in project midpoint by Evolveum.
the class AuthUtil method isPostAuthenticationEnabled.
public static boolean isPostAuthenticationEnabled(TaskManager taskManager, ModelInteractionService modelInteractionService) {
MidPointPrincipal midpointPrincipal = getPrincipalUser();
if (midpointPrincipal != null) {
FocusType focus = midpointPrincipal.getFocus();
Task task = taskManager.createTaskInstance(OPERATION_LOAD_FLOW_POLICY);
OperationResult parentResult = new OperationResult(OPERATION_LOAD_FLOW_POLICY);
RegistrationsPolicyType registrationPolicyType;
try {
registrationPolicyType = modelInteractionService.getFlowPolicy(focus.asPrismObject(), task, parentResult);
if (registrationPolicyType == null) {
return false;
}
SelfRegistrationPolicyType postAuthenticationPolicy = registrationPolicyType.getPostAuthentication();
if (postAuthenticationPolicy == null) {
return false;
}
String requiredLifecycleState = postAuthenticationPolicy.getRequiredLifecycleState();
if (StringUtils.isNotBlank(requiredLifecycleState) && requiredLifecycleState.equals(focus.getLifecycleState())) {
return true;
}
} catch (CommonException e) {
LoggingUtils.logException(LOGGER, "Cannot determine post authentication policies", e);
}
}
return false;
}
Aggregations