-
Notifications
You must be signed in to change notification settings - Fork 619
Fix Bug in Agent Token obtain when email as username feature enabled #8118
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -204,6 +204,8 @@ | |||||||||||
| import javax.servlet.http.HttpServletRequest; | ||||||||||||
| import javax.servlet.http.HttpServletResponse; | ||||||||||||
|
|
||||||||||||
| import static org.wso2.carbon.identity.application.authentication.framework.util.FrameworkConstants.AUTH_ENTITY; | ||||||||||||
| import static org.wso2.carbon.identity.application.authentication.framework.util.FrameworkConstants.AUTH_ENTITY_AGENT; | ||||||||||||
| import static org.wso2.carbon.identity.application.authentication.framework.util.FrameworkConstants.AdaptiveAuthentication.AUTHENTICATOR_NAME_IN_AUTH_CONFIG; | ||||||||||||
| import static org.wso2.carbon.identity.application.authentication.framework.util.FrameworkConstants.Application.CONSOLE_APP; | ||||||||||||
| import static org.wso2.carbon.identity.application.authentication.framework.util.FrameworkConstants.Application.CONSOLE_APP_PATH; | ||||||||||||
|
|
@@ -4016,7 +4018,7 @@ | |||||||||||
| UserSessionException { | ||||||||||||
|
|
||||||||||||
| try { | ||||||||||||
| if (userStoreManager instanceof AbstractUserStoreManager) { | ||||||||||||
|
Check warning on line 4021 in components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/org/wso2/carbon/identity/application/authentication/framework/util/FrameworkUtils.java
|
||||||||||||
| String userId = ((AbstractUserStoreManager) userStoreManager).getUserIDFromUserName(username); | ||||||||||||
|
|
||||||||||||
| // If the user id is could not be resolved, probably user does not exist in the user store. | ||||||||||||
|
|
@@ -4053,7 +4055,7 @@ | |||||||||||
| UserSessionException { | ||||||||||||
|
|
||||||||||||
| try { | ||||||||||||
| if (userStoreManager instanceof AbstractUserStoreManager) { | ||||||||||||
|
Check warning on line 4058 in components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/org/wso2/carbon/identity/application/authentication/framework/util/FrameworkUtils.java
|
||||||||||||
| String userName = ((AbstractUserStoreManager) userStoreManager).getUserNameFromUserID(userId); | ||||||||||||
|
|
||||||||||||
| if (StringUtils.isBlank(userName)) { | ||||||||||||
|
|
@@ -4282,6 +4284,11 @@ | |||||||||||
| throws InvalidCredentialsException { | ||||||||||||
|
|
||||||||||||
| if (IdentityUtil.isEmailUsernameEnabled()) { | ||||||||||||
| if (context != null && context.getProperties() != null | ||||||||||||
| && context.getProperties().containsKey(AUTH_ENTITY) | ||||||||||||
| && AUTH_ENTITY_AGENT.equals(context.getProperty(AUTH_ENTITY))) { | ||||||||||||
| return; | ||||||||||||
| } | ||||||||||||
| String tenantAwareUsername = MultitenantUtils.getTenantAwareUsername(username); | ||||||||||||
| if (StringUtils.countMatches(tenantAwareUsername, "@") < 1) { | ||||||||||||
| context.setProperty(CONTEXT_PROP_INVALID_EMAIL_USERNAME, true); | ||||||||||||
|
Comment on lines
4293
to
4294
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Log Improvement Suggestion No: 2
Suggested change
|
||||||||||||
|
|
||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Log Improvement Suggestion No: 1