|
23 | 23 | import org.apache.commons.lang.StringUtils; |
24 | 24 | import org.apache.commons.logging.Log; |
25 | 25 | import org.apache.commons.logging.LogFactory; |
| 26 | +import org.wso2.carbon.context.PrivilegedCarbonContext; |
26 | 27 | import org.wso2.carbon.identity.application.authentication.framework.util.FrameworkConstants; |
27 | 28 | import org.wso2.carbon.identity.application.authentication.handler.identifier.internal.IdentifierAuthenticatorServiceComponent; |
28 | 29 | import org.wso2.carbon.identity.central.log.mgt.utils.LoggerUtils; |
@@ -76,8 +77,11 @@ public String getName() { |
76 | 77 | public List<String> getInitiationData() { |
77 | 78 |
|
78 | 79 | List<String> initiationData = new ArrayList<>(); |
| 80 | + String tenantDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(); |
| 81 | + if (IdentifierAuthenticatorServiceComponent.getMultiAttributeLogin().isEnabled(tenantDomain)){ |
| 82 | + initiationData.add(USER_IDENTIFIER); |
| 83 | + } |
79 | 84 | initiationData.add(USERNAME_CLAIM_URI); |
80 | | - initiationData.add(USER_IDENTIFIER); |
81 | 85 | return initiationData; |
82 | 86 | } |
83 | 87 |
|
@@ -152,18 +156,14 @@ private ExecutorResponse resolveUser(String username, String tenantDomain, FlowE |
152 | 156 | * Retrieves the user realm for the given tenant domain. |
153 | 157 | * |
154 | 158 | * @param tenantDomain Tenant domain. |
155 | | - * @return UserRealm for the tenant, or null if not available. |
| 159 | + * @return UserRealm instance for the tenant. |
156 | 160 | * @throws UserStoreException If an error occurs while retrieving the user realm. |
157 | 161 | */ |
158 | 162 | private UserRealm getUserRealm(String tenantDomain) throws UserStoreException { |
159 | 163 |
|
160 | | - try { |
161 | | - RealmService realmService = IdentifierAuthenticatorServiceComponent.getRealmService(); |
162 | | - int tenantId = realmService.getTenantManager().getTenantId(tenantDomain); |
163 | | - return (UserRealm) realmService.getTenantUserRealm(tenantId); |
164 | | - } catch (Exception e) { |
165 | | - throw new UserStoreException("Error while retrieving user realm for tenant: " + tenantDomain, e); |
166 | | - } |
| 164 | + RealmService realmService = IdentifierAuthenticatorServiceComponent.getRealmService(); |
| 165 | + int tenantId = realmService.getTenantManager().getTenantId(tenantDomain); |
| 166 | + return (UserRealm) realmService.getTenantUserRealm(tenantId); |
167 | 167 | } |
168 | 168 |
|
169 | 169 | /** |
|
0 commit comments