Hi,
This thread both reports and resolves a similar problem.
Basically the solution is to use SecureURLParams, a different method of authentication.
Daren
No, no.
Standart authentication works fine. Add publisher via web interface and it works fine
ffmpeg rtmp://user:pass@ip/live/etc
But it doesn’t work for SQL authentication.
Here is my code sample
public void onConnect(IClient client, RequestFunction function,
AMFDataList params) {
getLogger().info("onConnect: DbAuth ");
String userName = getParamString(params, PARAM1);
String password = getParamString(params, PARAM2);
getLogger().info("onConnect: param1 " +userName+ ", param2 "+password);
Connection conn = null;
try
{
getLogger().info("onConnect: try ");
conn = DriverManager.getConnection("jdbc:postgresql://localhost/pdb?user=puser&password=p1");
Statement stmt = null;
ResultSet rs = null;
try
{
getLogger().info("onConnect: connect ok ");
stmt = conn.createStatement();
rs = stmt.executeQuery("SELECT count(*) as userCount FROM users where login = '"+userName+"' and enc_password = '"+password+"'");
if (rs.next() == true)
{
getLogger().info("onConnect: select ok ");
if (rs.getInt("userCount") > 0)
{
getLogger().info("onConnect: accept ok ");
client.acceptConnection();
}
}
}
catch (SQLException sqlEx)
{
getLogger().error("sqlexecuteException: " + sqlEx.toString());
}
finally
{
// it is a good idea to release
// resources in a finally{} block
// in reverse-order of their creation
// if they are no-longer needed
if (rs != null)
{
try
{
rs.close();
}
catch (SQLException sqlEx)
{
rs = null;
}
}
if (stmt != null)
{
try
{
stmt.close();
}
catch (SQLException sqlEx)
{
stmt = null;
}
}
}
conn.close();
}
catch (SQLException ex)
{
// handle any errors
System.out.println("SQLException: " + ex.getMessage());
System.out.println("SQLState: " + ex.getSQLState());
System.out.println("VendorError: " + ex.getErrorCode());
}
getLogger().info("onConnect: " + client.getClientId());
}
I got null, null for param1 and param2