org.apache.tinkerpop.gremlin.groovy.jsr223.dsl.credential

## Class CredentialGraph

- java.lang.Object
- - org.apache.tinkerpop.gremlin.groovy.jsr223.dsl.credential.CredentialGraph

-     public class CredentialGraph
      extends Object

  A DSL for managing a "credentials graph" used by Gremlin Server for simple authentication functions. If the `Graph` is transactional, new transactions will be started for each method call.
  Author:
    Stephen Mallette (http://stephen.genoprime.com)

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CredentialGraph(Graph graph)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `long` | `countUsers()` Get a count of the number of users in the database.
    `Vertex` | `createUser(String username, String password)` Creates a new user.
    `static CredentialGraph` | `credentials(Graph graph)` Wrap up any `Graph` instance in the `CredentialGraph` DSL.
    `Vertex` | `findUser(String username)` Finds a user by username and return `null` if one could not be found.
    `long` | `removeUser(String username)` Removes a user by name.
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### CredentialGraph

          public CredentialGraph(Graph graph)

  - ### Method Detail

    - #### findUser

          public Vertex findUser(String username)

      Finds a user by username and return `null` if one could not be found.
      Throws:
        `IllegalStateException` - if there is more than one user with a particular username.

    - #### createUser

          public Vertex createUser(String username,
                                   String password)

      Creates a new user.
      Returns:
        the newly created user vertex

    - #### removeUser

          public long removeUser(String username)

      Removes a user by name.
      Returns:
        the number of users removed (which should be one or zero)

    - #### countUsers

          public long countUsers()

      Get a count of the number of users in the database.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### credentials

          public static CredentialGraph credentials(Graph graph)

      Wrap up any `Graph` instance in the `CredentialGraph` DSL.

Copyright © 2013–2018 Apache Software Foundation. All rights reserved.