AccessProvider.create()
Create an AccessProvider.
Description
The AccessProvider.create()
method creates an AccessProvider
document
with the provided data. The provider document controls access to the current
database by a third-party identity provider (IdP), such as Auth0.
After an AccessProvider
document is created and the IdP is configured,
callers can authenticate using the IdP service, then
access Fauna resources as configured by the document.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
data |
Object describing the access provider. |
data fields
Name | Type | Required | Description |
---|---|---|---|
name |
Yes |
Unique external identity provider (IdP) name. Can’t be |
|
issuer |
Unique IdP HTTPS URL used to grant access to
Fauna, typically, an account or application URL supplied
by the IdP. Use an exact copy of the IdP issuer URL, including a
trailing slash ( |
||
jwks_uri |
Valid HTTPS URI. This should be the JSON Web Key (JWK) that signs the JSON Web Token (JWT) from the IdP. |
||
roles |
Roles to evaluate JWT token access. No privileges are defined if roles is omitted and queries with JWT tokens from issuer can’t be processed. If a predicate is defined, the predicate must use long form syntax. If roles is a single role string, it has the following format:
If roles is an array of role strings, it has the following format:
If roles is a single role:predicate object, it has the following format:
If roles is an array of role:predicate objects, it has the following format:
The If the |
||
data |
User-defined |
Return value
An object with metadata for the results of the create()
call.
Type | Description |
---|---|
New access provider. |
Examples
{
name: "anAccessProvider",
coll: AccessProvider,
ts: Time("2023-07-28T03:46:30.150Z"),
audience: "https://db.fauna.com/db/ywtfhw4poyynr",
data: {
custom: "some data"
},
roles: [
"mgmtTeam",
{
role: "mgmtTeam",
predicate: "_ => true"
}
],
jwks_uri: "https://fauna.auth0.com/.well-known/jwks.json",
issuer: "https://fauna.auth0.com"
}
Is this article helpful?
Tell Fauna how the article can be improved:
Visit Fauna's forums
or email docs@fauna.com
Thank you for your feedback!