authenticate to remote cassandra server from virgil

22 views
Skip to first unread message

vutukuruv...@gmail.com

unread,
Jul 30, 2014, 8:06:02 AM7/30/14
to virgil...@googlegroups.com
Hi,

I am trying to connect to my remote cassandra server from virgil.
Though virgil doesnt show any exceptions while starting up, when I try to access the rest API (ex: http://localhost:8080/virgil/data/playground1/), it gives"You have not logged in" response.
I think this is because I did not provide username and password of the cassandra database while starting virgil.
Can you please let me know if we have a way to do this.

thanks in advance.

Vamshidhar Vutukuru

unread,
Jul 31, 2014, 4:01:15 AM7/31/14
to virgil...@googlegroups.com
I could figure this out.
In the com.hmsonline.virgil.pool.VirgilConnection class, we have to add the following code:

 //added by vamshi
          AuthenticationRequest authRequest = new AuthenticationRequest();
Map<String, String> credentials = new HashMap<String, String>();
credentials.put("username", "cassandra");
credentials.put("password", "cassandra");
authRequest.setCredentials(credentials);

try {

if (this.connection != null)
this.connection.login(authRequest);
} catch (AuthenticationException e2) {

System.out.println("unable to login" +e2);
throw new TTransportException("Could not log in: " + e2, e2);
} catch (AuthorizationException e2) {

System.out.println("unable to login" +e2);
throw new TTransportException("Could not log in: " + e2, e2);
} catch (TException e2) {

System.out.println("unable to login" +e2);
throw new TTransportException("Could not log in: " + e2, e2);
}
//          //added by vamshi end

Reply all
Reply to author
Forward
0 new messages