<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appSettings>
<add key="NODE_ENV" value="production" />
<add key="DB_SERVER" value="serverAddress" />
<add key="DB_NAME" value="dbName" />
<add key="DB_USERNAME" value="login" />
<add key="DB_PASSWORD" value="password" />
<add key="SESSION_SECRET" value="superSecret" />
</appSettings>
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Methods" value="GET,HEAD,POST,PUT,DELETE,OPTIONS" />
<add name="Access-Control-Allow-Headers" value="Access-Control-Allow-Origin,Special-Request-Headers,Access-Control-Allow-Headers,Origin,Accept,Authorization,X-Requested-With, X-Auth-Token,Content-Type,Access-Control-Request-Method,Access-Control-Request-Headers" />
<add name="Access-Control-Max-Age" value="240" />
</customHeaders>
</httpProtocol>
<rewrite>
<rules>
<rule name="server">
<match url="/*" />
<action type="Rewrite" url="start-server.js" />
</rule>
</rules>
</rewrite>
<iisnode nodeProcessCountPerApplication="0" logDirectory="..\..\logs\" devErrorsEnabled="true" promoteServerVars="AUTH_USER,AUTH_TYPE" />
<cors enabled="true" failUnlistedOrigins="true">
<add origin="*" />
<add origin="http://localhost:3000" allowCredentials="true" maxAge="240">
<allowHeaders allowAllRequestedHeaders="true">
<add header="Access-Control-Allow-Origin" />
<add header="Special-Request-Headers" />
<add header="Access-Control-Allow-Headers" />
<add header="Origin" />
<add header="Accept" />
<add header="Authorization" />
<add header="X-Requested-With" />
<add header="X-Auth-Token" />
<add header="Content-Type" />
<add header="Access-Control-Request-Method" />
<add header="Access-Control-Request-Headers" />
</allowHeaders>
<allowMethods>
<add method="HEAD" />
<add method="GET" />
<add method="POST" />
<add method="PUT" />
<add method="DELETE" />
<add method="OPTIONS" />
</allowMethods>
</add>
<add origin="http://*.domain2:8006" allowCredentials="true" maxAge="240">
<allowHeaders allowAllRequestedHeaders="true">
<add header="Access-Control-Allow-Origin" />
<add header="Special-Request-Headers" />
<add header="Access-Control-Allow-Headers" />
<add header="Origin" />
<add header="Accept" />
<add header="Authorization" />
<add header="X-Requested-With" />
<add header="X-Auth-Token" />
<add header="Content-Type" />
<add header="Access-Control-Request-Method" />
<add header="Access-Control-Request-Headers" />
</allowHeaders>
<allowMethods>
<add method="HEAD" />
<add method="GET" />
<add method="POST" />
<add method="PUT" />
<add method="DELETE" />
<add method="OPTIONS" />
</allowMethods>
</add>
</cors>
</system.webServer>
</configuration>
withCredentials: true
const dbLink = require('../../services/bd/mssqlLink');
const ActiveDirectory = require('activedirectory');
const ad_config = require('../../config/config_ad_connect');
async function checkUser(login, password) {
const ad = new ActiveDirectory(ad_config)
const user = await ad.authenticate(login, password, function(err, auth) {
if (err) {
return err
}
if (auth) {
return auth
}
})
return user
}
async function getUserData(login) {
const userLogin = login.split('\\')[1] + '@' + login.split('\\')[0]
const userData = await dbLink.select(userLogin)
return userData
}
module.exports = {
checkUser: checkUser,
getUserData: getUserData,
}