Source:
public boolean validateGrant(OAuthTokenReqMessageContext tokReqMsgCtx) throws IdentityOAuth2Exception { boolean validGrant = super.validateGrant(tokReqMsgCtx); if (!validGrant) { return false; } String token = tokReqMsgCtx.getOauth2AccessTokenReqDTO().getWindowsToken(); IWindowsSecurityContext serverContext = null; if (token != null) { byte[] bytesToken = Base64.decode(token); int tokenType = getNLTMMessageType(bytesToken); if (log.isDebugEnabled()) { log.debug("Received NTLM token Type " + tokenType + ":" + token); } if (tokenType == 1) { serverContext = provider.acceptSecurityToken("server-connection", bytesToken, securityPackage); String type2Token = Base64.encode(serverContext.getToken()); if (log.isDebugEnabled()) { log.debug("Sent NTLM token Type 2:" + type2Token); } ResponseHeader[] responseHeaders = new ResponseHeader[1]; responseHeaders[0] = new ResponseHeader(); responseHeaders[0].setKey("WWW-Authenticate"); responseHeaders[0].setValue("NTLM " + type2Token); tokReqMsgCtx.addProperty("RESPONSE_HEADERS_PROPERTY", responseHeaders); return false; } else if (tokenType == 3) { serverContext = provider.acceptSecurityToken("server-connection", bytesToken, securityPackage); String resourceOwnerUserNameWithDomain = serverContext.getIdentity().getFqn(); String resourceOwnerUserName = resourceOwnerUserNameWithDomain.split("\\\\")[1]; tokReqMsgCtx.setAuthorizedUser(OAuth2Util.getUserFromUserName(resourceOwnerUserName)); return true; } else { log.error("Unknown NTLM token, Type " + tokenType + ":" + token); return false; } } else { log.error("Received NTLM token is null"); throw new IdentityOAuth2Exception("Received NTLM token is null"); } }

Target:
public boolean validateGrant(OAuthTokenReqMessageContext tokReqMsgCtx) throws IdentityOAuth2Exception { boolean validGrant = super.validateGrant(tokReqMsgCtx); if (!validGrant) { return false; } String token = tokReqMsgCtx.getOauth2AccessTokenReqDTO().getWindowsToken(); IWindowsSecurityContext serverContext = null; if (token != null) { byte[] bytesToken = Base64.decode(token); int tokenType = getNLTMMessageType(bytesToken); if (log.isDebugEnabled()) { log.debug("Received NTLM token Type " + tokenType + ":" + token); } if (tokenType == NTLM_TYPE_1_TOKEN) { serverContext = provider.acceptSecurityToken("server-connection", bytesToken, SECURITY_PACKAGE); String type2Token = Base64.encode(serverContext.getToken()); if (log.isDebugEnabled()) { log.debug("Sent NTLM token Type 2:" + type2Token); } ResponseHeader[] responseHeaders = new ResponseHeader[1]; responseHeaders[0] = new ResponseHeader(); responseHeaders[0].setKey("WWW-Authenticate"); responseHeaders[0].setValue("NTLM " + type2Token); tokReqMsgCtx.addProperty("RESPONSE_HEADERS_PROPERTY", responseHeaders); return false; } else if (tokenType == NTLM_TYPE_3_TOKEN) { serverContext = provider.acceptSecurityToken("server-connection", bytesToken, SECURITY_PACKAGE); String resourceOwnerUserNameWithDomain = serverContext.getIdentity().getFqn(); String resourceOwnerUserName = resourceOwnerUserNameWithDomain.split("\\\\")[1]; tokReqMsgCtx.setAuthorizedUser(OAuth2Util.getUserFromUserName(resourceOwnerUserName)); return true; } else { log.error("Unknown NTLM token, Type " + tokenType + ":" + token); return false; } } else { throw new IdentityOAuth2Exception("Received NTLM token is null"); } }