Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude username in password grant error message using OAuth config #2644

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -388,16 +388,8 @@ private AuthenticatedUser validateUserCredentials(OAuth2AccessTokenReqDTO tokenR
if (isPublishPasswordGrantLoginEnabled) {
publishAuthenticationData(tokenReq, false, serviceProvider);
}
if (MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equalsIgnoreCase(MultitenantUtils.getTenantDomain
(tokenReq.getResourceOwnerUsername()))) {
throw new IdentityOAuth2Exception("Authentication failed for " + tenantAwareUserName);
}
username = tokenReq.getResourceOwnerUsername();
if (IdentityTenantUtil.isTenantQualifiedUrlsEnabled()) {
// For tenant qualified urls, no need to send fully qualified username in response.
username = tenantAwareUserName;
}
throw new IdentityOAuth2Exception("Authentication failed for " + username);

throw new IdentityOAuth2Exception("Authentication failed");
} catch (UserStoreClientException e) {
if (isPublishPasswordGrantLoginEnabled) {
publishAuthenticationData(tokenReq, false, serviceProvider);
Expand Down Expand Up @@ -435,7 +427,7 @@ private AuthenticatedUser validateUserCredentials(OAuth2AccessTokenReqDTO tokenR
if (log.isDebugEnabled()) {
log.debug(message, e);
}
throw new IdentityOAuth2Exception(message);
throw new IdentityOAuth2Exception("Authentication failed");
} finally {
UserCoreUtil.removeUserMgtContextInThreadLocal();
if (log.isDebugEnabled()) {
Expand Down
Loading