Skip to content

Commit

Permalink
Fix for masking username
Browse files Browse the repository at this point in the history
  • Loading branch information
kayathiri4 committed Feb 16, 2024
1 parent 998419e commit 2fe047c
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.wso2.carbon.identity.application.common.IdentityApplicationManagementException;
import org.wso2.carbon.identity.application.common.model.ServiceProvider;
import org.wso2.carbon.identity.application.mgt.ApplicationManagementService;
import org.wso2.carbon.identity.central.log.mgt.utils.LoggerUtils;
import org.wso2.carbon.identity.claim.metadata.mgt.ClaimMetadataManagementService;
import org.wso2.carbon.identity.claim.metadata.mgt.exception.ClaimMetadataException;
import org.wso2.carbon.identity.claim.metadata.mgt.model.ExternalClaim;
Expand Down Expand Up @@ -1122,13 +1123,15 @@ public User updateUser(User user, Map<String, Boolean> requiredAttributes) throw
}
return getUser(user.getId(), requiredAttributes);
} catch (UserStoreClientException e) {
String errorMessage = String.format("Error while updating attributes of user. %s", e.getMessage());
String errorMessage = "Error while updating attributes of user: " + (LoggerUtils.isLogMaskingEnable ?
LoggerUtils.getMaskedContent(user.getUserName()) : user.getUserName());
if (log.isDebugEnabled()) {
log.debug(errorMessage, e);
}
throw new BadRequestException(errorMessage, ResponseCodeConstants.INVALID_VALUE);
} catch (UserStoreException e) {
String errMsg = "Error while updating attributes of user: " + user.getUserName();
String errMsg = "Error while updating attributes of user: " + (LoggerUtils.isLogMaskingEnable ?
LoggerUtils.getMaskedContent(user.getUserName()) : user.getUserName());
log.error(errMsg, e);
// Sometimes client exceptions are wrapped in the super class.
// Therefore checking for possible client exception.
Expand Down

0 comments on commit 2fe047c

Please sign in to comment.