.getTenantUserRealm(tenantId) .getUserStoreManager(); userStoreManager.authenticate(userName, tempCredential);
isSuccessful = userRealm.getUserStoreManager().authenticate(tenantLessUsername, password);
isSuccessful = userRealm.getUserStoreManager().authenticate(tenantLessUsername, password);
isSuccessful = userRealm.getUserStoreManager().authenticate(tenantLessUsername, password);
.getTenantUserRealm(tenantId) .getUserStoreManager(); userStoreManager.authenticate(userName, tempCredential);
private boolean validateUserCredentials(OAuth2AccessTokenReqDTO tokenReq) throws IdentityOAuth2Exception { boolean authenticated; try { UserStoreManager userStoreManager = getUserStoreManager(tokenReq); String tenantAwareUserName = MultitenantUtils.getTenantAwareUsername(tokenReq.getResourceOwnerUsername()); authenticated = userStoreManager.authenticate(tenantAwareUserName, tokenReq.getResourceOwnerPassword()); if (log.isDebugEnabled()) { log.debug("user " + tokenReq.getResourceOwnerUsername() + " authenticated: " + authenticated); } if (!authenticated) { if (MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equalsIgnoreCase(MultitenantUtils.getTenantDomain (tokenReq.getResourceOwnerUsername()))) { throw new IdentityOAuth2Exception("Authentication failed for " + tenantAwareUserName); } throw new IdentityOAuth2Exception("Authentication failed for " + tokenReq.getResourceOwnerUsername()); } } catch (UserStoreException e) { String message = e.getMessage(); if (!(e.getCause() instanceof IdentityException)) { throw new IdentityOAuth2Exception(message, e); } IdentityException identityException = (IdentityException) (e.getCause()); // Set error code to message if available. if (StringUtils.isNotBlank(identityException.getErrorCode())) { message = identityException.getErrorCode() + " " + e.getMessage(); } throw new IdentityOAuth2Exception(message, e); } return true; }
try { userRealm = realmService.getTenantUserRealm(tenantId1); authentic1 = userRealm.getUserStoreManager().authenticate(tenantAwareUsername1, String.valueOf(password1)); } catch (UserStoreException e) { throw new UserAccountAssociationClientException(UserAccountAssociationConstants.ErrorMessages try { userRealm = realmService.getTenantUserRealm(tenantId2); authentic2 = userRealm.getUserStoreManager().authenticate(tenantAwareUsername2, String.valueOf(password2)); } catch (UserStoreException e) { throw new UserAccountAssociationClientException(UserAccountAssociationConstants.ErrorMessages
org.wso2.carbon.user.api.UserRealm userRealm = realmService.getTenantUserRealm(tenantId); String tenantAwareUsername = MultitenantUtils.getTenantAwareUsername(userName); boolean isAuthenticated = userRealm.getUserStoreManager().authenticate(tenantAwareUsername, String .valueOf(password)); if (!isAuthenticated) {
try { userStoreManager = realmService.getTenantUserRealm(tenantId).getUserStoreManager(); authStatus = userStoreManager.authenticate(tenantAwareUserName, oAuth2AccessTokenReqDTO.getResourceOwnerPassword());
try { userRealm = realmService.getTenantUserRealm(tenantId); authentic = userRealm.getUserStoreManager().authenticate(tenantAwareUsername, String.valueOf(password)); userName = UserCoreUtil.addDomainToName(userName, UserCoreUtil.getDomainFromThreadLocal()); } catch (UserStoreException e) {
/** * @param oldPassword * @param newPassword * @throws UserAdminException * @throws AxisFault */ public void changePasswordByUser(String userName, String oldPassword, String newPassword) throws UserAdminException { String result = null; try { String tenantDomain = MultitenantUtils.getTenantDomain(userName); UserRealmService realmService = UserMgtDSComponent.getRealmService(); int tenantId = realmService.getTenantManager().getTenantId(tenantDomain); org.wso2.carbon.user.api.UserRealm userRealm = realmService.getTenantUserRealm(tenantId); String tenantAwareUsername = MultitenantUtils.getTenantAwareUsername(userName); boolean isAuthenticated = userRealm.getUserStoreManager().authenticate(tenantAwareUsername, oldPassword); if (isAuthenticated) { getUserAdminProxy().changePasswordByUser(userName, oldPassword, newPassword); } else { throw new UserAdminException("Error while updating password. Wrong old credential provided "); } } catch (UserAdminException e) { throw e; } catch (org.wso2.carbon.user.api.UserStoreException e) { throw new UserAdminException("Error while updating password. Please enter tenant unaware username", e); } }
/** * @param oldPassword * @param newPassword * @throws UserAdminException * @throws AxisFault */ public void changePasswordByUser(String userName, String oldPassword, String newPassword) throws UserAdminException { String result = null; try { String tenantDomain = MultitenantUtils.getTenantDomain(userName); UserRealmService realmService = UserMgtDSComponent.getRealmService(); int tenantId = realmService.getTenantManager().getTenantId(tenantDomain); org.wso2.carbon.user.api.UserRealm userRealm = realmService.getTenantUserRealm(tenantId); String tenantAwareUsername = MultitenantUtils.getTenantAwareUsername(userName); boolean isAuthenticated = userRealm.getUserStoreManager().authenticate(tenantAwareUsername, oldPassword); if (isAuthenticated) { getUserAdminProxy().changePasswordByUser(userName, oldPassword, newPassword); } else { throw new UserAdminException("The current password you entered is incorrect. "); } } catch (UserAdminException e) { throw e; } catch (org.wso2.carbon.user.api.UserStoreException e) { throw new UserAdminException("Error while updating password. Please enter tenant unaware username", e); } }
try { userRealm = realmService.getTenantUserRealm(tenantIdOfInitiateUser); authentic = userRealm.getUserStoreManager().authenticate(initiator, String.valueOf(password)); } catch (UserStoreException e) { throw new UserAccountAssociationClientException(UserAccountAssociationConstants.ErrorMessages