You will need to create a small web service that connects to that database, and when receives a redirect with those parameters prompts the user for username and password and then redirects the user back to Discourse.
You will need to create a small web service that connects to that database, and when receives a redirect with those parameters prompts the user for username and password and then redirects the user back to Discourse.