public UserRecoveryDataDO(String userName, int tenantId) { this.tenantId = tenantId; this.userName = userName; int expireTimeInMinutes = IdentityMgtConfig.getInstance().getNotificationExpireTime(); this.expireTime = Long.toString(System.currentTimeMillis() + (expireTimeInMinutes * 60 * 1000L)); this.isValid = true; }
public UserRecoveryDataDO(String userName, int tenantId, String code, String secret) { this.userName = userName; this.tenantId = tenantId; this.code = code; this.secret = secret; int expireTimeInMinutes = IdentityMgtConfig.getInstance().getNotificationExpireTime(); this.expireTime = Long.toString(System.currentTimeMillis() + (expireTimeInMinutes * 60 * 1000L)); this.isValid = true; }
public UserRecoveryDataDO(String userName, int tenantId) { this.tenantId = tenantId; this.userName = userName; int expireTimeInMinutes = IdentityMgtConfig.getInstance().getNotificationExpireTime(); this.expireTime = Long.toString(System.currentTimeMillis() + (expireTimeInMinutes * 60 * 1000L)); this.isValid = true; }
public UserRecoveryDataDO(String userName, int tenantId, String code, String secret) { this.userName = userName; this.tenantId = tenantId; this.code = code; this.secret = secret; int expireTimeInMinutes = IdentityMgtConfig.getInstance().getNotificationExpireTime(); this.expireTime = Long.toString(System.currentTimeMillis() + (expireTimeInMinutes * 60 * 1000L)); this.isValid = true; }
public IdentityMgtEventListener() { identityMgtConfig = IdentityMgtConfig.getInstance(); // Get the policy registry with the loaded policies. policyRegistry = identityMgtConfig.getPolicyRegistry(); module = IdentityMgtConfig.getInstance().getIdentityDataStore(); String isAdminUnlockSysProp = System.getProperty(UNLOCK_ADMIN_SYS_PROP); // If the system property unlockAdmin is set, then admin account will be unlocked if (StringUtils.isNotBlank(isAdminUnlockSysProp) && Boolean.parseBoolean(isAdminUnlockSysProp)) { log.info("unlockAdmin system property is defined. Hence unlocking admin account"); unlockAdmin(); } }
public IdentityMgtEventListener() { identityMgtConfig = IdentityMgtConfig.getInstance(); // Get the policy registry with the loaded policies. policyRegistry = identityMgtConfig.getPolicyRegistry(); module = IdentityMgtConfig.getInstance().getIdentityDataStore(); String isAdminUnlockSysProp = System.getProperty(UNLOCK_ADMIN_SYS_PROP); // If the system property unlockAdmin is set, then admin account will be unlocked if (StringUtils.isNotBlank(isAdminUnlockSysProp) && Boolean.parseBoolean(isAdminUnlockSysProp)) { log.info("unlockAdmin system property is defined. Hence unlocking admin account"); unlockAdmin(); } }
/** * Generates a random password * * @return */ public static char[] generateTemporaryPassword() { IdentityMgtConfig config = IdentityMgtConfig.getInstance(); return config.getPasswordGenerator().generatePassword(); }
public static void storeUserIdentityClaims(UserIdentityClaimsDO identityClaims, org.wso2.carbon.user.core.UserStoreManager userStoreManager) throws IdentityException { IdentityMgtConfig.getInstance().getIdentityDataStore() .store(identityClaims, userStoreManager); }
public RecoveryProcessor() { List<NotificationSendingModule> notificationSendingModules = IdentityMgtConfig.getInstance().getNotificationSendingModules(); this.defaultModule = notificationSendingModules.get(0); for (NotificationSendingModule module : notificationSendingModules) { this.modules.put(module.getNotificationType(), module); } this.dataStore = IdentityMgtConfig.getInstance().getRecoveryDataStore(); this.notificationSender = new NotificationSender(); questionProcessor = new ChallengeQuestionProcessor(); }
public RecoveryProcessor() { List<NotificationSendingModule> notificationSendingModules = IdentityMgtConfig.getInstance().getNotificationSendingModules(); this.defaultModule = notificationSendingModules.get(0); for (NotificationSendingModule module : notificationSendingModules) { this.modules.put(module.getNotificationType(), module); } this.dataStore = IdentityMgtConfig.getInstance().getRecoveryDataStore(); this.notificationSender = new NotificationSender(); questionProcessor = new ChallengeQuestionProcessor(); }
/** * Generates a random password * * @return */ public static char[] generateTemporaryPassword() { IdentityMgtConfig config = IdentityMgtConfig.getInstance(); return config.getPasswordGenerator().generatePassword(); }
public static void storeUserIdentityClaims(UserIdentityClaimsDO identityClaims, org.wso2.carbon.user.core.UserStoreManager userStoreManager) throws IdentityException { IdentityMgtConfig.getInstance().getIdentityDataStore() .store(identityClaims, userStoreManager); }
private static boolean isIdentityMgtListenerEnable() { String listenerClassName = IdentityMgtConfig.getInstance().getProperty (IdentityMgtConstants.PropertyConfig.IDENTITY_MGT_LISTENER_CLASS); if (StringUtils.isBlank(listenerClassName)) { listenerClassName = IdentityMgtEventListener.class.getName(); } IdentityEventListenerConfig identityEventListenerConfig = IdentityUtil.readEventListenerProperty (UserOperationEventListener.class.getName(), listenerClassName); if (identityEventListenerConfig == null) { return true; } if (StringUtils.isNotBlank(identityEventListenerConfig.getEnable())) { return Boolean.parseBoolean(identityEventListenerConfig.getEnable()); } else { return true; } }
private void deleteOldResourcesIfFound(Registry registry, String userName, String secretKeyPath) { boolean useRegistryIndexing = Boolean.parseBoolean(IdentityMgtConfig.getInstance().getProperty (REGISTRY_INDEXING_ENABLED)); if (useRegistryIndexing && RegistryConfigLoader.getInstance().IsStartIndexing()) { if (log.isDebugEnabled()) { log.debug("Property: " + REGISTRY_INDEXING_ENABLED + " is enabled. Switching to registry search mode " + "" + "to delete old confirmation codes."); } deleteOldConfirmationCodesByRegistrySearch(registry, userName, secretKeyPath); } else { if (log.isDebugEnabled()) { log.debug("Deleting old confirmation codes iterating over registry resource collection at: " + secretKeyPath); } deleteOldConfirmationCodesByResourceIteration(registry, userName, secretKeyPath); } }
public static UserDTO processUserId(String userId) throws IdentityException { if (userId == null || userId.trim().length() < 1) { throw IdentityException.error("Can not proceed with out a user id"); } UserDTO userDTO = new UserDTO(userId); if (!IdentityMgtConfig.getInstance().isSaasEnabled()) { validateTenant(userDTO); } userDTO.setTenantId(getTenantId(userDTO.getTenantDomain())); return userDTO; }
public static UserDTO processUserId(String userId) throws IdentityException { if (userId == null || userId.trim().length() < 1) { throw IdentityException.error("Can not proceed with out a user id"); } UserDTO userDTO = new UserDTO(userId); if (!IdentityMgtConfig.getInstance().isSaasEnabled()) { validateTenant(userDTO); } userDTO.setTenantId(getTenantId(userDTO.getTenantDomain())); return userDTO; }
/** * Returns security questions of the logged in user * * @param userStoreManager * @return * @throws IdentityMgtServiceException */ public static UserIdentityClaimDTO[] getUserSecurityQuestions(String userName, UserStoreManager userStoreManager) throws IdentityMgtServiceException { UserIdentityDataStore store = IdentityMgtConfig.getInstance().getIdentityDataStore(); UserIdentityClaimsDO userIdentityDO; userIdentityDO = store.load(userName, userStoreManager); if (userIdentityDO != null) { return userIdentityDO.getUserSequeiryQuestions(); } else { throw new IdentityMgtServiceException("No user account found for user " + userName); } }
/** * Update security questions of the logged in user. * * @param securityQuestion * @param userStoreManager * @throws IdentityException */ public static void updateUserSecurityQuestions(String userName, UserIdentityClaimDTO[] securityQuestion, UserStoreManager userStoreManager) throws IdentityException { UserIdentityDataStore store = IdentityMgtConfig.getInstance().getIdentityDataStore(); UserIdentityClaimsDO userIdentityDO = store.load(userName, userStoreManager); if (userIdentityDO != null) { userIdentityDO.updateUserSequeiryQuestions(securityQuestion); store.store(userIdentityDO, userStoreManager); } else { throw IdentityException.error("No user account found for user " + userName); } }
/** * Updates users recovery data such as the phone number, email etc * * @param userStoreManager * @param userIdentityRecoveryData * @throws IdentityException */ public static void updateUserIdentityClaims(String userName, UserStoreManager userStoreManager, UserIdentityClaimDTO[] userIdentityRecoveryData) throws IdentityException { UserIdentityDataStore store = IdentityMgtConfig.getInstance().getIdentityDataStore(); UserIdentityClaimsDO userIdentityDO = store.load(userName, userStoreManager); if (userIdentityDO != null) { userIdentityDO.updateUserIdentityRecoveryData(userIdentityRecoveryData); store.store(userIdentityDO, userStoreManager); } else { throw IdentityException.error("No user account found for user " + userName); } }
/** * Update security questions of the logged in user. * * @param securityQuestion * @param userStoreManager * @throws IdentityException */ public static void updateUserSecurityQuestions(String userName, UserIdentityClaimDTO[] securityQuestion, UserStoreManager userStoreManager) throws IdentityException { UserIdentityDataStore store = IdentityMgtConfig.getInstance().getIdentityDataStore(); UserIdentityClaimsDO userIdentityDO = store.load(userName, userStoreManager); if (userIdentityDO != null) { userIdentityDO.updateUserSequeiryQuestions(securityQuestion); store.store(userIdentityDO, userStoreManager); } else { throw IdentityException.error("No user account found for user " + userName); } }