use of com.evolveum.midpoint.xml.ns._public.common.common_3.NonceCredentialsPolicyType 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.NonceCredentialsPolicyType in project midpoint by Evolveum.
the class PageForgotPassword method generateNonce.
private <O extends ObjectType> String generateNonce(NonceCredentialsPolicyType noncePolicy, Task task, PrismObject<O> user, OperationResult result) throws ExpressionEvaluationException, SchemaException, ObjectNotFoundException {
ValuePolicyType policy = null;
if (noncePolicy != null && noncePolicy.getValuePolicyRef() != null) {
PrismObject<ValuePolicyType> valuePolicy = WebModelServiceUtils.loadObject(ValuePolicyType.class, noncePolicy.getValuePolicyRef().getOid(), PageForgotPassword.this, task, result);
policy = valuePolicy.asObjectable();
}
return getModelInteractionService().generateValue(policy != null ? policy.getStringPolicy() : null, 24, false, user, "nonce generation", task, result);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.NonceCredentialsPolicyType in project midpoint by Evolveum.
the class PageSelfRegistration method createCredentials.
private void createCredentials(UserType user, NonceCredentialsPolicyType noncePolicy, Task task, OperationResult result) throws ExpressionEvaluationException, SchemaException, ObjectNotFoundException {
NonceType nonceType = createNonce(noncePolicy, task, result);
// PasswordType password = createPassword();
CredentialsType credentials = user.getCredentials();
if (user.getCredentials() == null) {
credentials = new CredentialsType();
user.setCredentials(credentials);
}
credentials.setNonce(nonceType);
// credentials.setPassword(password);
// return credentials;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.NonceCredentialsPolicyType in project midpoint by Evolveum.
the class PageForgotPassword method saveUserNonce.
private OperationResult saveUserNonce(final UserType user, final NonceCredentialsPolicyType noncePolicy) {
return runPrivileged(new Producer<OperationResult>() {
@Override
public OperationResult run() {
Task task = createAnonymousTask("generateUserNonce");
task.setChannel(SchemaConstants.CHANNEL_GUI_RESET_PASSWORD_URI);
task.setOwner(user.asPrismObject());
OperationResult result = new OperationResult("generateUserNonce");
ProtectedStringType nonceCredentials = new ProtectedStringType();
try {
nonceCredentials.setClearValue(generateNonce(noncePolicy, task, user.asPrismObject(), result));
NonceType nonceType = new NonceType();
nonceType.setValue(nonceCredentials);
ObjectDelta<UserType> nonceDelta;
nonceDelta = ObjectDelta.createModificationReplaceContainer(UserType.class, user.getOid(), SchemaConstants.PATH_NONCE, getPrismContext(), nonceType);
WebModelServiceUtils.save(nonceDelta, result, task, PageForgotPassword.this);
} catch (SchemaException | ExpressionEvaluationException | ObjectNotFoundException e) {
result.recordFatalError("Failed to generate nonce for user");
LoggingUtils.logException(LOGGER, "Failed to generate nonce for user: " + e.getMessage(), e);
}
result.computeStatusIfUnknown();
return result;
}
});
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.NonceCredentialsPolicyType in project midpoint by Evolveum.
the class PageSelfRegistration method createNonce.
private NonceType createNonce(NonceCredentialsPolicyType noncePolicy, Task task, OperationResult result) throws ExpressionEvaluationException, SchemaException, ObjectNotFoundException {
ProtectedStringType nonceCredentials = new ProtectedStringType();
nonceCredentials.setClearValue(generateNonce(noncePolicy, null, task, result));
NonceType nonceType = new NonceType();
nonceType.setValue(nonceCredentials);
return nonceType;
}
Aggregations