kj-9 / sqltools-redshift-driver

redshift driver for vscode sqltools extention
MIT License
4 stars 1 forks source link

Driver fails to connect with Auth Failure for a user not specified in connection string. #4

Closed ShaunDave closed 1 year ago

ShaunDave commented 1 year ago

When trying to use a Connection String to connect to Redshift, connection fails immediately with Authentication Failed for User X error. However, that user is not a part of the connection string, I'm not sure where the driver is even getting it from.

[1668002585917] INFO (ls): Connection instance created for Redshift SAML Test. ns: "conn-manager" [1668002585989] ERROR (ls): Connecting error: {"code":-32001,"data":{"driver":"AWS Redshift","driverOptions":{}},"name":"error"} ns: "conn-manager" [1668002585990] ERROR (ls): Open connection error ns: "conn-manager" [1668002585994] ERROR (ext): ERROR: Error opening connection password authentication failed for user "XXXXX", {"code":-32001,"data":{"driver":"AWS Redshift","driverOptions":{}}} ns: "error-handler"

This is the connection info: "name": "Redshift SAML Test", "driver": "AWS Redshift", "askForPassword": true, "connectString": "redshift://myclusterXYZ.eu-west-1.redshift.amazonaws.com:5439/dev;ssl=true;StsEndpointUrl=https://sts.eu-west-1.amazonaws.com;login_url=https://XXXXX.awsapps.com/start/#/saml/default/XXXXX;IdP_Response_Timeout=90;User=XXXX@Domain"

I get the same error whether I use the AWS Redshift driver, or the Redshift (Dedicated Ver) driver.

kj-9 commented 1 year ago

I think it is because you are passing the username at the end of the connection string: User=XXXX@Domain

Also, your connection string does not seem to follow this manual. Can you try to connect with this connection string by means other than extensions?

ShaunDave commented 1 year ago

Hi @kj-9 , we have a similar connection up and running via DBeaver for some of our devs, but we want to be able to give those that want to the ability to use VSCode. I'll try with the user sooner in the connection string and see if that makes a difference, but I have had no joy with the default connection string format from the AWS manual because the connection string parser doesn't read jdbc:redshift:iam://host.... correctly - it seems to assume that the second argument in any string is the Host. So in the case of jdbc:redshift:iam://host.... the driver tries to connect to a server called 'redshift'. I suppose I should have started there and logged that issue first, sorry.

kj-9 commented 1 year ago

same as #5