Simple authentication using Gremlin


#1

I want to achieve the following using Gremlin:

  1. Connect to a particular database in OrientDB.
  2. Use authentication.

Right now on server startup it picks up ‘gremlin-server.yaml’ to configure gremlin server. In the .yaml the configured
graphs: {
graph : …/config/demodb.properties
}
picks up the database as well as the username/password.

Is there any way to specify either ‘database’ or ‘username/password’ during connection to Gremlin server from Python?


#2

Hi @ashish

for username/password
you can specify the options on the python connections

http://tinkerpop.apache.org/docs/current/reference/#_configuration_2

OrientDB uses a custom authenticator that binds to Server Users.

For multiple database you can only configure multiple graph sources on gremlin server configuration…


#3

Thank you for the reply. Being new here some things are still not clear.

  1. Actually I used username/password from my python client as:
    g=traversal().withRemote(DriverRemoteConnection(‘ws://localhost:8182/gremlin’, ‘g’, username=‘admin’, password=‘admin’))

but it gives invalid authentication error when the following line is present in gremlin.server.yaml file to enable authentication

authentication: {
authenticator: com.orientechnologies.tinkerpop.server.auth.OGremlinServerAuthenticator
}

Should I do something more here for authentication?

  1. For multiple databases should I need to add multiple lines in gremlin.server.yaml file:
    graphs: {
    graph_1 : …/config/demodb.properties
    graph_2 : …/config/someotherdb.properties
    }

How do I then ask gremlin queries which graph to use?


#4

Hi @ashish

the authenticator works with Server users. Not database ones. admin is a database user.

Probably you should user root user. See here for more info

http://orientdb.com/docs/3.0.x/security/Server-Security.html .

When you configure more graph inside GremlinServer you will probably have more traversal exposed.

g, g1 … etc

g=traversal().withRemote(DriverRemoteConnection(‘ws://localhost:8182/gremlin’, ‘g’, username=‘admin’, password=‘admin’))

You should change the variable in the connection.


#5

Thank you for the reply. Your suggestions are working perfectly!