accessProvider.replace()
Learn: Access providers |
---|
We recommend you use FSL to create and update access providers. See FSL access provider schema. |
Replace an access provider.
Description
The replace()
method replaces a provider with the supplied object.
This method removes any fields on the existing AccessProvider that are
not supplied by the object, with some exceptions. The audience
field
which is read-only, and the immutable metadata fields coll
and ts
are
not removed and can’t be replaced.
The object must include the required fields.
Considerations
If a database has staged schema, this method interacts with the database’s staged schema, not the active schema.
You can’t rename an access provider while a database has staged schema.
If the database has no staged schema, using this method is equivalent to making an unstaged schema change. Changes are applied immediately to the database’s active schema.
Avoid concurrent schema changes
Concurrent unstaged schema changes can cause contended transactions, even if the changes affect different resources. This includes unstaged changes made using:
-
FQL methods, such as
Collection.create()
orrole.update()
, that write to a schema’s underlying document. -
The Fauna CLI
-
The Fauna Dashboard.
A schema change triggers a transaction that validates the entire database schema. To avoid errors, do one of the following instead:
-
Perform unstaged schema changes sequentially
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
data |
Object describing the access provider. |
data fields
Name | Type | Required | Description |
---|---|---|---|
name |
Yes |
Unique access provider name. |
|
issuer |
Unique IdP HTTPS URL that you are using to grant access to
Fauna. This is typically an account or application URL supplied
by your IdP.
Use an exact copy of your IdP |
||
jwks_uri |
Valid HTTPS URI, which serves the JSON Web Key (JWK) that signs the JSON Web Tokens (JWT) from your IdP. |
Examples
AccessProvider.byName("someIssuer")?.replace({
name: "someIssuer",
issuer: "https://example.com/",
roles: "customer",
jwks_uri: "https://example.com/.well-known/jwks.json"
})
{
name: "someIssuer",
coll: AccessProvider,
ts: Time("2099-06-25T15:00:07.450Z"),
audience: "https://db.fauna.com/db/ysjowue14yyr1",
issuer: "https://example.com/",
roles: "customer",
jwks_uri: "https://example.com/.well-known/jwks.json"
}
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!