/** * Admin resets the password of the user. * * @param userName * @param newPassword * @throws IdentityMgtServiceException */ public void resetUserPassword(String userName, String newPassword) throws IdentityMgtServiceException { try { UserStoreManager userStoreManager = getUserStore(userName); String userNameWithoutDomain = UserCoreUtil.removeDomainFromName(userName); userStoreManager.updateCredentialByAdmin(userNameWithoutDomain, newPassword); log.info("User password reset for: " + userName); } catch (UserStoreException e) { String message = "Error occurred while resetting password for: " + userName; log.error(message, e); throw new IdentityMgtServiceException(message, e); } }
/** * Admin resets the password of the user. * * @param userName * @param newPassword * @throws IdentityMgtServiceException */ public void resetUserPassword(String userName, String newPassword) throws IdentityMgtServiceException { try { UserStoreManager userStoreManager = getUserStore(userName); String userNameWithoutDomain = UserCoreUtil.removeDomainFromName(userName); userStoreManager.updateCredentialByAdmin(userNameWithoutDomain, newPassword); log.info("User password reset for: " + userName); } catch (UserStoreException e) { String message = "Error occurred while resetting password for: " + userName; log.error(message, e); throw new IdentityMgtServiceException(message, e); } }
/** * Update Password with the user input * * @return true - if password was successfully reset * @throws IdentityException */ public static boolean updatePassword(String userId, int tenantId, String password) throws IdentityException { String tenantDomain = null; if (userId == null || userId.trim().length() < 1 || password == null || password.trim().length() < 1) { String msg = "Unable to find the required information for updating password"; log.error(msg); throw IdentityException.error(msg); } try { UserStoreManager userStoreManager = IdentityMgtServiceComponent. getRealmService().getTenantUserRealm(tenantId).getUserStoreManager(); userStoreManager.updateCredentialByAdmin(userId, password); if (log.isDebugEnabled()) { String msg = "Password is updated for user: " + userId; log.debug(msg); } return true; } catch (UserStoreException e) { String msg = "Error in changing the password, user name: " + userId + " domain: " + tenantDomain + "."; log.error(msg, e); throw IdentityException.error(msg, e); } }
/** * Update Password with the user input * * @return true - if password was successfully reset * @throws IdentityException */ public static boolean updatePassword(String userId, int tenantId, String password) throws IdentityException { String tenantDomain = null; if (userId == null || userId.trim().length() < 1 || password == null || password.trim().length() < 1) { String msg = "Unable to find the required information for updating password"; log.error(msg); throw IdentityException.error(msg); } try { UserStoreManager userStoreManager = IdentityMgtServiceComponent. getRealmService().getTenantUserRealm(tenantId).getUserStoreManager(); userStoreManager.updateCredentialByAdmin(userId, password); if (log.isDebugEnabled()) { String msg = "Password is updated for user: " + userId; log.debug(msg); } return true; } catch (UserStoreException e) { String msg = "Error in changing the password, user name: " + userId + " domain: " + tenantDomain + "."; log.error(msg, e); throw IdentityException.error(msg, e); } }
userStoreManager.updateCredentialByAdmin(userName, new String(tempPassword));
userStoreManager.updateCredentialByAdmin(userName, new String(tempPassword));
userStoreManager.updateCredentialByAdmin(userName, tempPassword);
userStoreManager.updateCredentialByAdmin(userName, tempPassword);
userStoreManager.updateCredentialByAdmin(domainQualifiedName, password); if (RecoveryScenarios.ADMIN_FORCED_PASSWORD_RESET_VIA_EMAIL_LINK.equals (userRecoveryData.getRecoveryScenario()) || RecoveryScenarios.ADMIN_FORCED_PASSWORD_RESET_VIA_OTP.