Package com.fauna.client
Class FaunaScope
- java.lang.Object
-
- com.fauna.client.FaunaScope
-
public final class FaunaScope extends java.lang.Object
Represents a FaunaScope, a structure that encapsulates a Fauna database and a role within that database. The FaunaScope is used to generate a token that is used for authorization.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FaunaScope.Builder
A builder class for creating instances of FaunaScope.
-
Constructor Summary
Constructors Constructor Description FaunaScope(java.lang.String database, FaunaRole role)
Creates a FaunaScope with the specified database and role.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static FaunaScope.Builder
builder(java.lang.String database)
Creates a new Builder instance for a FaunaScope.java.lang.String
getToken(java.lang.String secret)
Generates a token for this scope using the provided secret.
-
-
-
Constructor Detail
-
FaunaScope
public FaunaScope(java.lang.String database, FaunaRole role)
Creates a FaunaScope with the specified database and role.- Parameters:
database
- the name of the databaserole
- the FaunaRole associated with this scope
-
-
Method Detail
-
getToken
public java.lang.String getToken(java.lang.String secret)
Generates a token for this scope using the provided secret.- Parameters:
secret
- the secret used to generate the token- Returns:
- a token string formed by concatenating secret, database, and role
-
builder
public static FaunaScope.Builder builder(java.lang.String database)
Creates a new Builder instance for a FaunaScope.- Parameters:
database
- the name of the database- Returns:
- a new Builder instance
-
-