Source:
protected void executeQuery(DirectorySearcher directorySearcher) { log.debug("Executing LdapAuthenticateUserCommand"); directorySearcher.setExplicitAuth(true); LdapUser user = null; LdapQueryData queryData = new LdapQueryDataImpl(); if (getLoginName().contains("@")) { queryData.setLdapQueryType(LdapQueryType.getUserByPrincipalName); String[] loginNameParts = getLoginName().split("@"); String principalName = constructPrincipalName(loginNameParts[0], loginNameParts[1]); String domain = loginNameParts[1].toLowerCase(); queryData.setFilterParameters(new Object[] { principalName }); queryData.setDomain(domain); setDomain(domain); setAuthenticationDomain(domain); } Object searchResult = directorySearcher.findOne(queryData); if (searchResult == null) { log.errorFormat("Failed authenticating user: {0} to domain {1}. Ldap Query Type is {2}", getLoginName(), getAuthenticationDomain(), queryData.getLdapQueryType().name()); setSucceeded(false); Exception ex = directorySearcher.getException(); handleDirectorySearcherException(ex); } else { user = populateUserData((LdapUser) searchResult, getAuthenticationDomain()); if (user != null) { getParameters().getOutputMap().mput( Authn.InvokeKeys.RESULT, Authn.AuthResult.SUCCESS ).mput( Authn.InvokeKeys.AUTH_RECORD, new ExtMap().mput( Authn.AuthRecord.PRINCIPAL, user.getUserName() ) ); setSucceeded(true); } else { log.errorFormat("Failed authenticating. Domain is {0}. User is {1}. The user doesn't have a UPN", getAuthenticationDomain(), getLoginName()); getParameters().getOutputMap().put(Authn.InvokeKeys.RESULT, Authn.AuthResult.CREDENTIALS_INCORRECT); } } if (!getSucceeded()) { getParameters().getOutputMap().put(Authn.InvokeKeys.RESULT, Authn.AuthResult.GENERAL_ERROR); } }

Target:
protected void executeQuery(DirectorySearcher directorySearcher) { log.debug("Executing LdapAuthenticateUserCommand"); directorySearcher.setExplicitAuth(true); LdapUser user = null; LdapQueryData queryData = new LdapQueryDataImpl(); String loginName = getLoginName(); if (!loginName.contains("@")) { loginName = loginName + "@" + getDomain(); } queryData.setLdapQueryType(LdapQueryType.getUserByPrincipalName); String[] loginNameParts = loginName.split("@"); String domain = loginNameParts[1].toLowerCase(); queryData.setFilterParameters(new Object[] { loginName }); queryData.setDomain(domain); setDomain(domain); setAuthenticationDomain(domain); Object searchResult = directorySearcher.findOne(queryData); if (searchResult == null) { log.errorFormat("Failed authenticating user: {0} to domain {1}. Ldap Query Type is {2}", getLoginName(), getAuthenticationDomain(), queryData.getLdapQueryType().name()); setSucceeded(false); Exception ex = directorySearcher.getException(); handleDirectorySearcherException(ex); } else { user = populateUserData((LdapUser) searchResult, getAuthenticationDomain()); if (user != null) { getParameters().getOutputMap().mput( Authn.InvokeKeys.RESULT, Authn.AuthResult.SUCCESS ).mput( Authn.InvokeKeys.AUTH_RECORD, new ExtMap().mput( Authn.AuthRecord.PRINCIPAL, user.getUserName() ) ); setSucceeded(true); } else { log.errorFormat("Failed authenticating. Domain is {0}. User is {1}. The user doesn't have a UPN", getAuthenticationDomain(), getLoginName()); getParameters().getOutputMap().put(Authn.InvokeKeys.RESULT, Authn.AuthResult.CREDENTIALS_INCORRECT); } } if (!getSucceeded()) { getParameters().getOutputMap().put(Authn.InvokeKeys.RESULT, Authn.AuthResult.GENERAL_ERROR); } }