@Override public boolean doPostUpdateCredential(String userName, Object credential, UserStoreManager userStoreManager) throws UserStoreException { if (!isEnable()) { return true; } Map<String, String> userClaims = new HashMap<>(); userClaims.put(IdentityMgtConstants.LAST_PASSWORD_UPDATE_TIME, Long .toString(System.currentTimeMillis())); userStoreManager.setUserClaimValues(userName, userClaims, null); return true; }
@Override public boolean doPostUpdateCredentialByAdmin(String userName, Object credential, UserStoreManager userStoreManager) throws UserStoreException { if (!isEnable()) { return true; } Map<String, String> userClaims = new HashMap<>(); userClaims.put(IdentityMgtConstants.LAST_PASSWORD_UPDATE_TIME, Long .toString(System.currentTimeMillis())); userStoreManager.setUserClaimValues(userName, userClaims, null); return true; }
@Override public boolean doPostUpdateCredential(String userName, Object credential, UserStoreManager userStoreManager) throws UserStoreException { if (!isEnable()) { return true; } Map<String, String> userClaims = new HashMap<>(); userClaims.put(IdentityMgtConstants.LAST_PASSWORD_UPDATE_TIME, Long .toString(System.currentTimeMillis())); userStoreManager.setUserClaimValues(userName, userClaims, null); return true; }
@Override public boolean doPostUpdateCredentialByAdmin(String userName, Object credential, UserStoreManager userStoreManager) throws UserStoreException { if (!isEnable()) { return true; } Map<String, String> userClaims = new HashMap<>(); userClaims.put(IdentityMgtConstants.LAST_PASSWORD_UPDATE_TIME, Long .toString(System.currentTimeMillis())); userStoreManager.setUserClaimValues(userName, userClaims, null); return true; }
protected void setUserClaim(String claimName, String claimValue, UserStoreManager userStoreManager, User user) throws IdentityEventException { HashMap<String, String> userClaims = new HashMap<>(); userClaims.put(claimName, claimValue); try { userStoreManager.setUserClaimValues(user.getUserName(), userClaims, null); } catch (UserStoreException e) { throw new IdentityEventException("Error while setting user claim value :" + user.getUserName(), e); } }
public void setUserClaimValues(String userName, ClaimValue[] claims, String profileName) throws UserStoreException { getUserStoreManager().setUserClaimValues(userName, convertClaimValueToMap(claims), profileName); }
@Override public void handleEvent(Event event) throws IdentityEventException { boolean isEnabled = isSuspensionNotificationEnabled(event); if (!isEnabled) { return; } if (IdentityEventConstants.Event.POST_AUTHENTICATION.equals(event.getEventName())) { Map<String, Object> eventProperties = event.getEventProperties(); String userName = (String) eventProperties.get(IdentityEventConstants.EventProperty.USER_NAME); UserStoreManager userStoreManager = (UserStoreManager) eventProperties .get(IdentityEventConstants.EventProperty.USER_STORE_MANAGER); if (!(Boolean) eventProperties.get(IdentityEventConstants.EventProperty.OPERATION_STATUS)) { return; } try { HashMap<String, String> userClaims = new HashMap<>(); userClaims.put(NotificationConstants.LAST_LOGIN_TIME, Long.toString(System.currentTimeMillis())); userStoreManager.setUserClaimValues(userName, userClaims, null); } catch (UserStoreException e) { log.error("Error occurred while updating last login claim for user: ", e); } } }
userStoreManager.setUserClaimValues(userName, newClaims, null); userStoreManager.setUserClaimValues(userName, newClaims, null); } catch (UserStoreException e) { throw new AccountLockException("Error occurred while locking user account");
newClaims.put(AccountConstants.FAILED_LOGIN_ATTEMPTS_CLAIM, "0"); try { userStoreManager.setUserClaimValues(userName, newClaims, null); } catch (UserStoreException e) { throw new AccountLockException("Error occurred while storing " + AccountConstants
.setUserClaimValues(adminUsername, scimClaims, UserCoreConstants.DEFAULT_PROFILE); userStoreManager.setUserClaimValues(adminUsername, scimClaims, UserCoreConstants.DEFAULT_PROFILE);
Map<String,String> claimMap = new HashMap<String,String>(); claimMap.put(claim, value); userStoreManager.setUserClaimValues(userName, claimMap, UserCoreConstants.DEFAULT_PROFILE);
Map<String,String> claimMap = new HashMap<String,String>(); claimMap.put(claim, value); userStoreManager.setUserClaimValues(userName, claimMap, UserCoreConstants.DEFAULT_PROFILE);
claimsList.put(SCIMConstants.META_CREATED_URI, createdDate); claimsList.put(SCIMConstants.META_LAST_MODIFIED_URI, createdDate); userStoreManager.setUserClaimValues(adminUsername, claimsList, UserCoreConstants.DEFAULT_PROFILE);
.setUserClaimValues(adminUsername, scimClaims, UserCoreConstants.DEFAULT_PROFILE); userStoreManager.setUserClaimValues(adminUsername, scimClaims, UserCoreConstants.DEFAULT_PROFILE);
/** * Set claim to user store manager * * @param user user * @param claim claim uri * @param value claim value * @throws IdentityException if fails */ public static void setClaimInUserStoreManager(User user, String claim, String value) throws UserStoreException { String fullUserName = IdentityUtil.addDomainToName(user.getUserName(), user.getUserStoreDomain()); int tenantId = IdentityTenantUtil.getTenantId(user.getTenantDomain()); org.wso2.carbon.user.core.UserStoreManager userStoreManager = null; RealmService realmService = IdentityRecoveryServiceDataHolder.getInstance().getRealmService(); if (realmService.getTenantUserRealm(tenantId) != null) { userStoreManager = (org.wso2.carbon.user.core.UserStoreManager) realmService.getTenantUserRealm(tenantId). getUserStoreManager(); } if (userStoreManager != null) { Map<String, String> values = userStoreManager.getUserClaimValues(fullUserName, new String[]{ claim}, UserCoreConstants.DEFAULT_PROFILE); String oldValue = values.get(claim); if (oldValue == null || !oldValue.equals(value)) { Map<String, String> claimMap = new HashMap<String, String>(); claimMap.put(claim, value); userStoreManager.setUserClaimValues(fullUserName, claimMap, UserCoreConstants.DEFAULT_PROFILE); } } }
userStoreManager.setUserClaimValues(username, userClaims, null);
userStoreManager.setUserClaimValues(user.getUserName() , userClaims, null); if (log.isDebugEnabled()) { log.debug("Locked user account: " + user.getUserName());
updatedClaims.put(NotificationConstants.PASSWORD_RESET_FAIL_ATTEMPTS_CLAIM, "0"); try { userStoreManager.setUserClaimValues(IdentityUtil.addDomainToName(receiver.getUsername(), receiver.getUserStoreDomain()), updatedClaims, UserCoreConstants.DEFAULT_PROFILE); } catch (org.wso2.carbon.user.core.UserStoreException e) {
updatedClaims.put(IdentityRecoveryConstants.ACCOUNT_UNLOCK_TIME_CLAIM, "0"); try { userStoreManager.setUserClaimValues(IdentityUtil.addDomainToName(user.getUserName(), user.getUserStoreDomain()), updatedClaims, UserCoreConstants.DEFAULT_PROFILE); throw Utils.handleClientException(IdentityRecoveryConstants.ErrorMessages String.valueOf(currentAttempts + 1)); try { userStoreManager.setUserClaimValues(IdentityUtil.addDomainToName(user.getUserName(), user.getUserStoreDomain()), updatedClaims, UserCoreConstants.DEFAULT_PROFILE); } catch (org.wso2.carbon.user.core.UserStoreException e) {
updatedClaims.put(IdentityRecoveryConstants.PASSWORD_RESET_FAIL_ATTEMPTS_CLAIM, "0"); try { userStoreManager.setUserClaimValues(IdentityUtil.addDomainToName(user.getUserName(), user.getUserStoreDomain()), updatedClaims, UserCoreConstants.DEFAULT_PROFILE); } catch (org.wso2.carbon.user.core.UserStoreException e) {