Skip to content

Commit

Permalink
typo PageEmailNonse -> PageEmailNonce
Browse files Browse the repository at this point in the history
  • Loading branch information
KaterynaHonchar committed Mar 9, 2022
1 parent 1a6349b commit 073d589
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@
@PageDescriptor(urls = {
@Url(mountUrl = "/emailNonce", matchUrlForSecurity = "/emailNonce")
}, permitAll = true, loginPage = true, authModule = AuthenticationModuleNameConstants.MAIL_NONCE)
public class PageEmailNonse extends PageAuthenticationBase {
public class PageEmailNonce extends PageAuthenticationBase {
private static final long serialVersionUID = 1L;

private static final Trace LOGGER = TraceManager.getTrace(PageEmailNonse.class);
private static final Trace LOGGER = TraceManager.getTrace(PageEmailNonce.class);

private static final String DOT_CLASS = com.evolveum.midpoint.web.page.forgetpassword.PageSecurityQuestions.class.getName() + ".";
private static final String OPERATION_LOAD_USER = DOT_CLASS + "loaduser";
Expand All @@ -75,7 +75,7 @@ public class PageEmailNonse extends PageAuthenticationBase {

private boolean submited;

public PageEmailNonse() {
public PageEmailNonce() {
}

protected void initCustomLayer() {
Expand All @@ -94,7 +94,7 @@ public boolean isVisible() {

initStaticLayout(form);

initDynamicLayout(form, PageEmailNonse.this);
initDynamicLayout(form, PageEmailNonce.this);

initButtons(form);

Expand Down Expand Up @@ -146,24 +146,24 @@ private void processResetPassword(AjaxRequestTarget target) {

if (user == null) {
getSession().error(getString("pageForgetPassword.message.user.not.found"));
throw new RestartResponseException(PageEmailNonse.class);
throw new RestartResponseException(PageEmailNonce.class);
}
LOGGER.trace("Reset Password user: {}", user);

if (getResetPasswordPolicy() == null) {
LOGGER.debug("No policies for reset password defined");
getSession().error(getString("pageForgetPassword.message.policy.not.found"));
throw new RestartResponseException(PageEmailNonse.class);
throw new RestartResponseException(PageEmailNonce.class);
}

OperationResult result = saveUserNonce(user, getMailNoncePolicy(user.asPrismObject()));
if (result.getStatus() == OperationResultStatus.SUCCESS) {
submited = true;
target.add(PageEmailNonse.this);
target.add(PageEmailNonce.this);
} else {
getSession().error(getString("PageForgotPassword.send.nonce.failed"));
LOGGER.error("Failed to send nonce to user: {} ", result.getMessage());
throw new RestartResponseException(PageEmailNonse.this);
throw new RestartResponseException(PageEmailNonce.this);
}
}

Expand All @@ -176,29 +176,29 @@ private NonceCredentialsPolicyType getMailNoncePolicy(PrismObject<UserType> user
LOGGER.error("No security policy, cannot process nonce credential");
// Just log the error, but do not display it. We are still in unprivileged part of the web
// we do not want to provide any information to the attacker.
throw new RestartResponseException(PageEmailNonse.class);
throw new RestartResponseException(PageEmailNonce.class);
}
if (securityPolicy.getCredentials() == null) {
getSession().error(getString("PageForgotPassword.send.nonce.failed"));
LOGGER.error("No credential for security policy, cannot process nonce credential");
// Just log the error, but do not display it. We are still in unprivileged part of the web
// we do not want to provide any information to the attacker.
throw new RestartResponseException(PageEmailNonse.class);
throw new RestartResponseException(PageEmailNonce.class);
}
if (securityPolicy.getCredentials().getNonce() == null) {
getSession().error(getString("PageForgotPassword.send.nonce.failed"));
LOGGER.error("No nonce credential for security policy, cannot process nonce credential");
// Just log the error, but do not display it. We are still in unprivileged part of the web
// we do not want to provide any information to the attacker.
throw new RestartResponseException(PageEmailNonse.class);
throw new RestartResponseException(PageEmailNonce.class);
}

Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
if (!(authentication instanceof MidpointAuthentication)) {
getSession().error(getString("PageForgotPassword.send.nonce.failed"));
LOGGER.error("Bad type of authentication, support only MidpointAuthentication, but is "
+ authentication != null ? authentication.getClass().getName() : null);
throw new RestartResponseException(PageEmailNonse.class);
throw new RestartResponseException(PageEmailNonce.class);
}

ModuleAuthentication moduleAuthentication = ((MidpointAuthentication) authentication).getProcessingModuleAuthentication();
Expand All @@ -207,15 +207,15 @@ private NonceCredentialsPolicyType getMailNoncePolicy(PrismObject<UserType> user
getSession().error(getString("PageForgotPassword.send.nonce.failed"));
LOGGER.error("Bad type of module authentication, support only EmailNonceModuleAuthentication, but is "
+ moduleAuthentication != null ? moduleAuthentication.getClass().getName() : null);
throw new RestartResponseException(PageEmailNonse.class);
throw new RestartResponseException(PageEmailNonce.class);
}
CredentialModuleAuthentication nonceAuth = (CredentialModuleAuthentication) moduleAuthentication;
String credentialName = nonceAuth.getCredentialName();

if (credentialName == null) {
getSession().error(getString("PageForgotPassword.send.nonce.failed"));
LOGGER.error("EmailNonceModuleAuthentication " + nonceAuth.getNameOfModule() + " haven't define name of credential");
throw new RestartResponseException(PageEmailNonse.class);
throw new RestartResponseException(PageEmailNonce.class);
}

NonceCredentialsPolicyType credentialByName = null;
Expand All @@ -228,7 +228,7 @@ private NonceCredentialsPolicyType getMailNoncePolicy(PrismObject<UserType> user
if (credentialByName == null) {
getSession().error(getString("PageForgotPassword.send.nonce.failed"));
LOGGER.error("Couldn't find nonce credentials by name " + credentialName);
throw new RestartResponseException(PageEmailNonse.class);
throw new RestartResponseException(PageEmailNonce.class);
}

return credentialByName;
Expand Down Expand Up @@ -348,7 +348,7 @@ public OperationResult run() {
.createModificationReplaceProperty(UserType.class, user.getOid(),
SchemaConstants.PATH_NONCE_VALUE, nonceCredentials);

WebModelServiceUtils.save(nonceDelta, result, task, PageEmailNonse.this);
WebModelServiceUtils.save(nonceDelta, result, task, PageEmailNonce.this);
} catch (SchemaException | ExpressionEvaluationException | ObjectNotFoundException | CommunicationException | ConfigurationException | SecurityViolationException e) {
result.recordFatalError(getString("PageForgotPassword.message.saveUserNonce.fatalError"));
LoggingUtils.logException(LOGGER, "Failed to generate nonce for user: " + e.getMessage(),
Expand All @@ -369,7 +369,7 @@ private <O extends ObjectType> String generateNonce(NonceCredentialsPolicyType n

if (noncePolicy != null && noncePolicy.getValuePolicyRef() != null) {
PrismObject<ValuePolicyType> valuePolicy = WebModelServiceUtils.loadObject(ValuePolicyType.class,
noncePolicy.getValuePolicyRef().getOid(), PageEmailNonse.this, task, result);
noncePolicy.getValuePolicyRef().getOid(), PageEmailNonce.this, task, result);
policy = valuePolicy.asObjectable();
}

Expand Down

0 comments on commit 073d589

Please sign in to comment.