Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supporting authentications. #6

Open
jun92 opened this issue Aug 4, 2017 · 5 comments
Open

Supporting authentications. #6

jun92 opened this issue Aug 4, 2017 · 5 comments
Assignees

Comments

@jun92
Copy link

jun92 commented Aug 4, 2017

first of all, thanks for make this useful plugin for vs code.
during I've used it as editing cql statement, I found that It supports executing the statement within vs code.
but there is no way to authenticate to cassandra database. do you have any plan to add the feature at the plugin?

thanks.

@lawrencekgrant
Copy link
Owner

Thanks for taking the time to make a feature request! That is a great idea and one that makes perfect sense. I can get this implemented and updated pretty quickly.

@stefan505
Copy link

Any progress on this?

@chiluap
Copy link

chiluap commented Apr 25, 2018

Hi Lawrence,

May I suggest a full options Object in the user config to instantiate a cassandra-driver singleton.
something like:

"cql": {
    "contactPoints": ["10.0.0.1", "10.0.0.2"]
    "auth": { // will need a factory to get a new instance of authProvider
        "provider": "PlainTextAuthProvider",
        "user": "username",
        "password": "somapassword",
    }
    "keyspace": "somekeyspace", // none if empty
    "policies": // maybe later with localDatacenter and loadbalancing
}

Thank you for the work. If I get the time I will try to fix a PR.
In chrunchtime a.t.m. so it could be a while.

c

@jun92
Copy link
Author

jun92 commented Jul 29, 2018

I've written some code to support authentication in local files("cqlExecutor.js:24")
It seems to be worked well, but "cql.execute" error occured. because I don't have any idea of making plugins for vscode and nodejs & typescript, I can't find where to start finding the issue.
anyone suggests? or hints?

function executeCqlStatement(statement) {
    console.log('Configuring cql statement execution.');
    let cassandraAddress = vscode.workspace.getConfiguration("cql")["address"];
    let cassandraPort = vscode.workspace.getConfiguration("cql")["port"];
    let cassandraConnectionOptions = vscode.workspace.getConfiguration("cql")["connection"];
    let cassandraAuth = new cassandra.auth.PlainTextAuthProvider(workspace.getConfiguration("cql")["username"], workspace.getConfiguration("cql")["password"]);
    let cassandraKeyspace = workspace.getConfiguration("cql")["keyspace"];
    let clientOptions = !!cassandraConnectionOptions
        ? cassandraConnectionOptions
        : {
            contactPoints: [cassandraAddress],
            hosts: [cassandraAddress],
            authProvider: [cassandraAuth],
            keyspace : [cassandraKeyspace]
        };

@chiluap
Copy link

chiluap commented Jul 31, 2018

You can run your extension in debug mode in vscode.
https://code.visualstudio.com/docs/extensions/developing-extensions
If you post the error we might be able to help you =)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants