Authentication - Using Stored Credentials

Instead of using plain text user credentials in Lua scripts, credentials should be stored in Stored Credential objects, which are then referenced by Lua scripts.

The following example illustrates how the Path is used to reference the Stored Credentials and how these are used to connect to a SQL database.

How Stored Credentials are used in a Lua Script
local DB = require("esi-odbc")
local credentialsPath = "/home/Stored Credentials Group/Stored Credentials"
local username = syslib.getvalue(credentialsPath .. ".DomainCredentials.UserName")
local pwd = syslib.getvalue(credentialsPath .. ".DomainCredentials.Password")
local sql = "SELECT TOP 1000 * FROM [dbo].[DemoData]"
local args = \{
  DSN = 'DemoData',
  USER = username,
  PWD = pwd,
  UTF8 = false
}
local rowset = DB:QUERYDATA(args, sql)

return "Rowset contains " .. #rowset .. " rows."