use of com.evolveum.midpoint.xml.ns._public.common.common_3.SecurityPolicyType in project midpoint by Evolveum.
the class SecurityHelper method locateSecurityPolicy.
/**
* Returns security policy applicable for the specified user. It looks for organization and global policies and takes into account
* deprecated properties and password policy references. The resulting security policy has all the (non-deprecated) properties set.
* If there is also referenced value policy, it is will be stored as "object" in the value policy reference inside the
* returned security policy.
*/
public <F extends FocusType> SecurityPolicyType locateSecurityPolicy(PrismObject<F> user, PrismObject<SystemConfigurationType> systemConfiguration, Task task, OperationResult result) throws SchemaException {
PrismObject<SecurityPolicyType> orgSecurityPolicy = objectResolver.searchOrgTreeWidthFirstReference(user, o -> o.asObjectable().getSecurityPolicyRef(), "security policy", task, result);
LOGGER.trace("Found organization security policy: {}", orgSecurityPolicy);
if (orgSecurityPolicy != null) {
SecurityPolicyType orgSecurityPolicyType = orgSecurityPolicy.asObjectable();
postProcessSecurityPolicy(orgSecurityPolicyType, task, result);
traceSecurityPolicy(orgSecurityPolicyType, user);
return orgSecurityPolicyType;
}
if (systemConfiguration != null) {
SecurityPolicyType globalSecurityPolicy = resolveGlobalSecurityPolicy(user, systemConfiguration.asObjectable(), task, result);
if (globalSecurityPolicy != null) {
return globalSecurityPolicy;
}
}
// DEPRECATED, legacy
PrismObject<ValuePolicyType> orgPasswordPolicy = objectResolver.searchOrgTreeWidthFirstReference(user, o -> o.asObjectable().getPasswordPolicyRef(), "security policy", task, result);
LOGGER.trace("Found organization password policy: {}", orgPasswordPolicy);
if (orgPasswordPolicy != null) {
SecurityPolicyType policy = postProcessPasswordPolicy(orgPasswordPolicy.asObjectable());
traceSecurityPolicy(policy, user);
return policy;
}
if (systemConfiguration != null) {
SecurityPolicyType globalPasswordPolicy = resolveGlobalPasswordPolicy(user, systemConfiguration.asObjectable(), task, result);
if (globalPasswordPolicy != null) {
return globalPasswordPolicy;
}
}
return null;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.SecurityPolicyType in project midpoint by Evolveum.
the class SecurityHelper method postProcessPasswordPolicy.
private SecurityPolicyType postProcessPasswordPolicy(ValuePolicyType passwordPolicyType) {
SecurityPolicyType securityPolicyType = new SecurityPolicyType();
CredentialsPolicyType creds = new CredentialsPolicyType();
PasswordCredentialsPolicyType passwd = new PasswordCredentialsPolicyType();
ObjectReferenceType passwordPolicyRef = new ObjectReferenceType();
passwordPolicyRef.asReferenceValue().setObject(passwordPolicyType.asPrismObject());
passwd.setValuePolicyRef(passwordPolicyRef);
creds.setPassword(passwd);
securityPolicyType.setCredentials(creds);
setDeprecatedPasswordPolicyProperties(passwordPolicyType, passwd);
return securityPolicyType;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.SecurityPolicyType in project midpoint by Evolveum.
the class SecurityHelper method postProcessSecurityPolicy.
private void postProcessSecurityPolicy(SecurityPolicyType securityPolicyType, Task task, OperationResult result) {
CredentialsPolicyType creds = securityPolicyType.getCredentials();
if (creds != null) {
PasswordCredentialsPolicyType passwd = creds.getPassword();
if (passwd != null) {
postProcessPasswordCredentialPolicy(securityPolicyType, passwd, task, result);
}
for (NonceCredentialsPolicyType nonce : creds.getNonce()) {
postProcessCredentialPolicy(securityPolicyType, nonce, "nonce credential policy", task, result);
}
SecurityQuestionsCredentialsPolicyType securityQuestions = creds.getSecurityQuestions();
if (securityQuestions != null) {
postProcessCredentialPolicy(securityPolicyType, securityQuestions, "security questions credential policy", task, result);
}
}
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.SecurityPolicyType in project midpoint by Evolveum.
the class ResetPolicyDto method initResetPolicy.
private void initResetPolicy(AbstractCredentialsResetPolicyType resetPolicy, SecurityPolicyType securityPolicyType) throws SchemaException {
this.formRef = resetPolicy.getFormRef();
AbstractAuthenticationPolicyType authPolicy = SecurityPolicyUtil.getAuthenticationPolicy(resetPolicy.getAdditionalAuthenticationName(), securityPolicyType);
if (authPolicy instanceof MailAuthenticationPolicyType) {
this.mailAuthentication = (MailAuthenticationPolicyType) authPolicy;
noncePolicy = SecurityPolicyUtil.getCredentialPolicy(mailAuthentication.getMailNonce(), securityPolicyType);
} else if (authPolicy instanceof SmsAuthenticationPolicyType) {
this.smsAuthentication = (SmsAuthenticationPolicyType) authPolicy;
this.noncePolicy = SecurityPolicyUtil.getCredentialPolicy(smsAuthentication.getSmsNonce(), securityPolicyType);
}
this.name = resetPolicy.getName();
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.SecurityPolicyType in project midpoint by Evolveum.
the class ResetPolicyDto method initResetPolicyDto.
public void initResetPolicyDto(SecurityPolicyType securityPolicyType) throws SchemaException {
if (securityPolicyType == null) {
return;
}
if (securityPolicyType.getCredentialsReset() == null) {
return;
}
MailResetPolicyType mailResetPolicy = securityPolicyType.getCredentialsReset().getMailReset();
if (mailResetPolicy != null) {
this.resetMethod = ResetMethod.MAIL;
initResetPolicy(mailResetPolicy, securityPolicyType);
return;
}
SmsResetPolicyType smsResetPolicy = securityPolicyType.getCredentialsReset().getSmsReset();
if (smsResetPolicy != null) {
this.resetMethod = ResetMethod.SMS;
initResetPolicy(smsResetPolicy, securityPolicyType);
return;
}
SecurityQuestionsResetPolicyType securityQuestionsResetPolicy = securityPolicyType.getCredentialsReset().getSecurityQuestionReset();
if (securityQuestionsResetPolicy != null) {
this.resetMethod = ResetMethod.SECURITY_QUESTIONS;
initResetPolicy(securityQuestionsResetPolicy, securityPolicyType);
return;
}
}
Aggregations