๊ฐ์ ๋๋ฉ์ธ์ ์์ด๋ Windows ์ธ์ฆ์ ์ํด ์ฌ์ฉ์ ์ด๋ฆ/๋น๋ฐ๋ฒํธ๋ฅผ ์ง์ ํด์ผ ํฉ๋๋ค. ์ด ์๋๋ฆฌ์ค์์๋ ADO.NET์ ์ฌ์ฉํ์ฌ ์ฌ์ฉ์ ์ด๋ฆ/์ํธ๋ฅผ ์ง์ ํ ํ์๊ฐ ์์ต๋๋ค. ๋๋ผ์ด๋ฒ๊ฐ ์๊ฒฉ ์ฆ๋ช ์ ์ฅ์์์ Kerberos ํ ํฐ์ ๊ฐ์ ธ์ค๊ณ ์๋ค๊ณ ๊ฐ์ ํฉ๋๋ค.
์ด ๊ธฐ๋ฅ์ ํ์ฌ Tedious์์ ์ฌ์ฉํ ์ ์์ต๋๊น? ์๋๋ฉด ์ฌ์ฉ์ ์ด๋ฆ/๋น๋ฐ๋ฒํธ๋ฅผ ์ง์ ํ์ง ์๊ณ ๋ Windows ์ธ์ฆ์ด ์๋ํ๋๋ก ํ๋ ๊ตฌ์ฑ์ด ์์ต๋๊น?
@arobson @arthurschreiber - ์ ๋ฐ ์๊ฐํด์ฃผ์ธ์.
๋๋ ์ด๊ฒ์ ์กฐ์ฌํ๋ค. ๋ด๊ฐ ์ง๊ธ๊น์ง ๋ฐฐ์ด ๊ฒ์ Windows ํตํฉ ์ธ์ฆ์ ๋ํ ์ง์์ SSPI๋ฅผ ์ฌ์ฉํ๊ณ NodeJS๋ ํ์ฌ SSPI๋ฅผ ์ง์ํ์ง ์๋๋ค๋ ๊ฒ์ ๋๋ค. node-sspi npm ํจํค์ง๊ฐ ์์ง๋ง ์๋ฒ ์ธก๋ง ์ง์ํฉ๋๋ค. ๋ํ HTTP ์๋ฒ์์๋ง ์๋ํฉ๋๋ค. JavaScript ๋ฐ์ธ๋ฉ์ ์ฌ์ฉํ ๊ธฐ๋ณธ ๊ตฌํ์ ๋๋ค. ํด๋ผ์ด์ธํธ ์ธก SSPI ๊ตฌํ๋ JavaScript ๋ฐ์ธ๋ฉ์ด ์๋ ๊ธฐ๋ณธ ์ฝ๋์ฌ์ผ ํฉ๋๋ค.
๋ด ์ ์์ Tedious๊ฐ ์ฌ์ฉํ๊ธฐ์ ์ ํฉํ API๋ฅผ ์ฌ์ฉํ์ฌ ์๋ก์ด npm ํจํค์ง์์ ํด๋ผ์ด์ธํธ ์ธก SSPI ์ง์์ ๊ตฌ์ถํ๊ณ Tedious๊ฐ SQL Server Windows ํตํฉ ์ธ์ฆ์ฉ ํจํค์ง์ ์ข ์๋๋๋ก ํ๋ ๊ฒ์ ๋๋ค.
์ด๋ค ์๊ฐ์ด๋ผ๋ ๊ฐ์ฌํ๊ฒ ์ต๋๋ค. ๊ฐ์ฌ ํด์.
์, ํฉ๋ฆฌ์ ์ผ๋ก ๋ค๋ฆฝ๋๋ค. ๋๋ ๋ฐ์ด๋๋ฆฌ ๋ชจ๋์ด ์ง๋ฃจํ ๋ถ๋ถ์ด ๋์ด์๋ ์ ๋๋ค๊ณ ์๊ฐํ๋ค. ๊ทธ๋์ ๐ ๋ณ๋์ npm ๋ชจ๋๋ก ๊ฐ๋ ์์ด๋์ด์ ๋ํด.
๋ฉ์๋. ์ฒซ ๋ฒ์งธ ์ปท์ Windows๋ง ์ง์ํฉ๋๋ค. Windows ์ ์ฉ ๊ธฐ๋ฅ์ผ๋ก ์์ํด๋ ๊ด์ฐฎ์ต๋๊น?
Windows์ Linux๋ Windows ํตํฉ ์ธ์ฆ์ ์ง์ํ๋ API๊ฐ ๋ค๋ฆ ๋๋ค. ๋ ํ๋ซํผ์ ๋ํ ์ง์์ ํ๋์ ํจํค์ง๋ก ๊ตฌ์ถํ ์ ์์ด์ผ ํฉ๋๋ค. ๊ทธ๋ฌ๋ Windows์ Linux์ ๋ค๋ฅธ ํจํค์ง์ ๋ํ ์ข ์์ฑ์ ๋ํ ์ ๋ก๊ฐ ์๋์ง ๊ถ๊ธํฉ๋๋ค.
๋ฉ์๋. ์ฒซ ๋ฒ์งธ ์ปท์ Windows๋ง ์ง์ํฉ๋๋ค. Windows ์ ์ฉ ๊ธฐ๋ฅ์ผ๋ก ์์ํด๋ ๊ด์ฐฎ์ต๋๊น?
๊ด์ฐฎ์. ๋๋ ์ด๊ฒ์ด ์ ํ์ ๊ธฐ๋ฅ์ด ๋ ๊ฒ์ด๋ผ๊ณ ์๊ฐํ๋ฏ๋ก ์ฒ์์๋ Windows๋ง ์ง์ํ๋ ๊ฒ์ด ์ข์ต๋๋ค. ๐
๋ด๊ฐ ์ผ๋์ ๋๊ณ ์๋ ClientSspi ํด๋์ค ์ธํฐํ์ด์ค๋ฅผ ์ฌ์ฉํ์ฌ ์งง์ ์ค๋ํซ์ ๊ณต์ ํ๊ณ ์์ต๋๋ค. API์ ํํ์ ๋ํ ํผ๋๋ฐฑ์ ๊ณต์ ํด ์ฃผ์ญ์์ค.
ClientSspi = require('ClientSspi');
serverName = 'servername.example.com';
// Server name should be the only configuration. Windows SSPI APIs will get
// the tokens to be presented to the server to authenticate the logged in user.
clientSspi = new ClientSspi(serverName);
// authprotocol parameter can take three values.
// Negotiate, Kerberos, Ntlm
// Negotiate: With this option client will negotiate with the server
// on security protocol using SPNEGO.
//
// If nothing is specified, the first supported protocol will be used. The
// protocols will be attempted in the sequence listed above.
clientSspi.initialize(authprotocol, function(errorCode, errorString) {
if (errorCode || errorString) {
throw('SSPI intialization failed: ', errorCode, ': ', errorString);
}
var sspiServerResponse = new Uint8Array([]);
var sspiDone = false;
while (!sspiDone) {
// This call gets the next set of bytes to send to the server as part of the
// SSPI dance.
clientSspi.getNextSspiBlob(sspiServerResponse, function (sspiClientResponse, isDone, errorCode, errorString) {
if (errorCode || errorString) {
throw('SSPI intialization failed: ', errorCode, ': ', errorString);
}
sspiDone = isDone;
// This function will send the sspiClientResponse to the server and invokes the
// callback when the response from the server becomes available.
SendSspiBlobToSqlServerAndGetResponse(sspiClientResponse, function (serverResponse, errorString) {
if (errorString) {
throw(errorString);
}
sspiServerResponse = serverResponse;
});
});
}
});
https://github.com/tvrprasad/sspi-client์ API์ ์คํ ๊ตฌํ์ด
@arthurschreiber ๊ธฐํ๊ฐ ๋๋ฉด ๋น ๋ฅด๊ฒ ํจ์คํด์ฃผ์ธ์. ๋ฆฌํฌ์งํ ๋ฆฌ์ ๋ํ ํผ๋๋ฐฑ์ด๋ ๋ฏธํด๊ฒฐ ๋ฌธ์ ๋ฅผ ์ ์๊ฒ ๋ณด๋ด์ฃผ์ญ์์ค. ๊ตฌํ์ ์ฑ์ฐ๋ฉด ์ด๋ฅผ ์ฌ์ฉํ์ฌ Tedious์์ Windows ํตํฉ ์ธ์ฆ์ ๊ตฌํํ ๊ณํ์ ๋๋ค.
๋๋ sspi-client๋ฅผ ์ง๋ฃจํ๊ฒ ํตํฉํ๊ณ ์๋ํ๋์ง ํ์ธํ๊ธฐ ์ํด ๋ฌด์ธ๊ฐ๋ฅผ ํจ๊ป ๋์ก์ต๋๋ค! ntlm, kerberos๋ฅผ ์ฌ์ฉํ์ฌ ์ฐ๊ฒฐํ๊ณ ์ํธ๋ฅผ ์ง์ ํ์ง ์๊ณ ๋ณด์ ํจํค์ง๋ฅผ ํ์ํ ์ ์์์ต๋๋ค!
@arthurschreiber ์ฌ๊ธฐ์์ ํดํน์ ์ฐพ์ ์ ์์ต๋๋ค. ์ด๊ฒ์ ์ด๋ค ๋ฐฉ๋ฒ์ผ๋ก๋ PR์ ์ํ ์ค๋น๊ฐ ๋์ง ์์์ง๋ง ๋์ ์์ค์์ ๋ฌธ์ ๊ฐ ๋ฐ๊ฒฌ๋๋ฉด ์๋ ค์ฃผ์ญ์์ค.
https://github.com/tvrprasad/tedious/tree/windows-integrated-auth-draft
์ด ๋ฌธ์ ๋ฅผ ๋ค์ ์ด์ด Windows ํตํฉ ์ธ์ฆ์ด ํ๋ฌ๊ทธ์ธ ๊ฐ๋ฅํด์ง ๋๊น์ง ์ถ์ ํ ์ ์์ต๋๋ค. ์์ธํ ๋ด์ฉ์
@v-suhame ์ด๊ฒ์ ์ต์ ์ ๋ณด๋ ๋ฌด์์ ๋๊น? #624๋ฅผ ๊ธฐ๋ค๋ฆฌ์ญ๋๊น?
๊ทธ๊ฒ์ ์์ง์ด๊ธฐ ์ํด ๋ด๊ฐ ํ ์ ์๋ ์ผ์ด ์์ต๋๊น?
์ต์ ์ ๋ฐ์ดํธ๋ฅผ ์ป์ ์ @arthurschreiber์ ๋ฐ๋ณต ๋์์ ์ ์ ๐์ ๋ํ ๊ฐ์ฌ๋ฅผ @kevinkuszyk.
Linux ์๋ฒ์์ Windows ํตํฉ ์ธ์ฆ์ ์ง๊ธ ์ฌ์ฉํ ์ ์์ต๋๊น?
@sxpati2 Windows ํตํฉ ์ธ์ฆ์ ์ด๋ฆ์์ ์ ์ ์๋ฏ์ด Windows OS์ฉ์ ๋๋ค. Linux์ ๊ฒฝ์ฐ Kerberos ํตํฉ ์ธ์ฆ์ด ๋ฉ๋๋ค. Tedious๋ ํ์ฌ Windows ๋๋ Kerberos ํตํฉ ์ธ์ฆ์ ์ง์ํ์ง ์์ผ๋ฉฐ ํฅํ ๊ณํ์ ์์ต๋๋ค.
๋๋ ์ด๊ฒ์ ๋ํด ํ์ธํ๊ณ ์ถ์ต๋๋ค. ๋๋์ ์ธ ๋ฆฌํฉํ ๋ง์ด ์์๋ ๊ฒ ๊ฐ์ต๋๋ค. msnodesqlv8์ ์ง๋ฃจํ๊ฒ ๋ฐ๋ณตํ ์ ์๋ ๋ฐฉ๋ฒ์ด ์์ต๋๊น? ๋๋ msnodesqlv8์ด ์ํธํ์ ๋น ์ง ๊ฒ์ด๋ผ๊ณ ์๊ฐํ์ง๋ง ๊ทธ๋ ์ง ์์์ต๋๋ค.
@arthurschreiber ์์ด๋/๋น๋ฐ๋ฒํธ ์์ด ์ฐฝ ์ธ์ฆ์ด ๊ฐ๋ฅํ PR #497 Windows ํตํฉ ์ธ์ฆ์ด ๋ณํฉ๋ ๊ฒ ๊ฐ์๋ฐ, ์ง๋ฃจํ ์ต์ ๋ฒ์ ์์๋ ๋ ์ด์ ์ฐพ์ ์ ์๋ ๊ฒ ๊ฐ์ต๋๋ค. ๊ทธ ๊ธฐ๋ฅ์ด ์ด๋ป๊ฒ ๋์๋์ง ๊ถ๊ธํ์์ฃ ?
๊ทธ ์ดํ๋ก ์ํฉ์ด ๋ฐ๋์์ต๋๊น? ์๋๋ฉด ํด๋น ๊ธฐ๋ฅ์ด ๋ฆฌํฉํฐ๋ง์์ ์ผ์์ ์ผ๋ก ์์ค๋์์ต๋๊น?
๊ทธ ์ดํ๋ก ์ํฉ์ด ๋ฐ๋์์ต๋๊น? ์๋๋ฉด ํด๋น ๊ธฐ๋ฅ์ด ๋ฆฌํฉํฐ๋ง์์ ์ผ์์ ์ผ๋ก ์์ค๋์์ต๋๊น?
์ ๋ ์๊ณ ์ถ์ต๋๋ค!
์๋ ํ์ธ์, ์ด ๊ธฐ๋ฅ์ด ํฌํจ๋ ๋จ์ด๋ ๋ฌด์์ ๋๊น? ๊ฐ์ฌ ํด์!
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
๋๋ sspi-client๋ฅผ ์ง๋ฃจํ๊ฒ ํตํฉํ๊ณ ์๋ํ๋์ง ํ์ธํ๊ธฐ ์ํด ๋ฌด์ธ๊ฐ๋ฅผ ํจ๊ป ๋์ก์ต๋๋ค! ntlm, kerberos๋ฅผ ์ฌ์ฉํ์ฌ ์ฐ๊ฒฐํ๊ณ ์ํธ๋ฅผ ์ง์ ํ์ง ์๊ณ ๋ณด์ ํจํค์ง๋ฅผ ํ์ํ ์ ์์์ต๋๋ค!
@arthurschreiber ์ฌ๊ธฐ์์ ํดํน์ ์ฐพ์ ์ ์์ต๋๋ค. ์ด๊ฒ์ ์ด๋ค ๋ฐฉ๋ฒ์ผ๋ก๋ PR์ ์ํ ์ค๋น๊ฐ ๋์ง ์์์ง๋ง ๋์ ์์ค์์ ๋ฌธ์ ๊ฐ ๋ฐ๊ฒฌ๋๋ฉด ์๋ ค์ฃผ์ญ์์ค.
https://github.com/tvrprasad/tedious/tree/windows-integrated-auth-draft