Source:
protected void processAuthenticationResponse(HttpServletRequest request, HttpServletResponse response, AuthenticationContext context) throws AuthenticationFailedException { HttpSession session = request.getSession(false); if (session.getAttribute(IWAConstants.SUBJECT_ATTRIBUTE) == null) { if (log.isDebugEnabled()) { log.debug("Attribute not set. Therefore authentication is failed."); } throw new AuthenticationFailedException("Authentication Failed"); } String username = session.getAttribute(IWAConstants.SUBJECT_ATTRIBUTE).toString(); if (username == null) { if (log.isDebugEnabled()) { log.debug("User name is null. Therefore authentication is failed."); } throw new AuthenticationFailedException("Authentication Failed"); } StringTokenizer stringTokenizer = new StringTokenizer(username, "@"); username = stringTokenizer.nextToken(); if (log.isDebugEnabled()) { log.debug("Authenticate request received : AuthType - " + request.getAuthType() + ", User - " + username); } boolean isAuthenticated; UserStoreManager userStoreManager; try { userStoreManager = (UserStoreManager) CarbonContext.getThreadLocalCarbonContext().getUserRealm() .getUserStoreManager(); isAuthenticated = userStoreManager.isExistingUser(MultitenantUtils.getTenantAwareUsername(username)); } catch (org.wso2.carbon.user.api.UserStoreException e) { throw new AuthenticationFailedException("IWAAuthenticator failed while trying to find user existence", e); } if (!isAuthenticated) { if (log.isDebugEnabled()) { log.debug("user authentication failed, user:" + username + " is not in the user store"); } throw new AuthenticationFailedException("Authentication Failed"); } username = FrameworkUtils.prependUserStoreDomainToName(username); context.setSubject(AuthenticatedUser.createLocalAuthenticatedUserFromSubjectIdentifier(username)); }

Target:
protected void processAuthenticationResponse(HttpServletRequest request, HttpServletResponse response, AuthenticationContext context) throws AuthenticationFailedException { HttpSession session = request.getSession(false); if (session.getAttribute(IWAConstants.SUBJECT_ATTRIBUTE) == null) { if (log.isDebugEnabled()) { log.debug("Subject attribute not set. Therefore authentication is failed."); } throw new AuthenticationFailedException("Authentication Failed"); } String username = (String)session.getAttribute(IWAConstants.SUBJECT_ATTRIBUTE); StringTokenizer stringTokenizer = new StringTokenizer(username, "@"); username = stringTokenizer.nextToken(); if (log.isDebugEnabled()) { log.debug("Authenticate request received : AuthType - " + request.getAuthType() + ", User - " + username); } boolean isAuthenticated; UserStoreManager userStoreManager; try { userStoreManager = (UserStoreManager) CarbonContext.getThreadLocalCarbonContext().getUserRealm() .getUserStoreManager(); isAuthenticated = userStoreManager.isExistingUser(MultitenantUtils.getTenantAwareUsername(username)); } catch (org.wso2.carbon.user.api.UserStoreException e) { throw new AuthenticationFailedException("IWAAuthenticator failed while trying to find user existence", e); } if (!isAuthenticated) { if (log.isDebugEnabled()) { log.debug("user authentication failed, user:" + username + " is not in the user store"); } throw new AuthenticationFailedException("Authentication Failed"); } username = FrameworkUtils.prependUserStoreDomainToName(username); context.setSubject(AuthenticatedUser.createLocalAuthenticatedUserFromSubjectIdentifier(username)); }