AccessProvider.all()

Learn: Access providers

Get a Set of all access providers.

Signature

AccessProvider.all() => Set<AccessProvider>

AccessProvider.all(range: { from: Any } | { to: Any } | { from: Any, to: Any }) => Set<AccessProvider>

Description

Gets a Set containing all AccessProvider documents in the database. To limit the returned Set, you can provide an optional range.

AccessProvider documents are FQL versions of a database’s FSL access provider schema. AccessProvider documents have the AccessProvider type. See Access providers.

If this method is the last expression in a query, the first page of the Set is returned. See Pagination.

Staged schema

If a database has staged schema, this method interacts with the database’s staged schema, not the active schema.

Parameters

Parameter Type Required Description

range

{ from: Any } | { to: Any } | { from: Any, to: Any }

Specifies a range of AccessProvider documents in the form { from: start, to: end }. from and to arguments should be in the order returned by an unbounded AccessProvider.all() call. See Range examples.

The Set only includes documents in this range (inclusive). Omit from or to to run unbounded range searches.

If a range is omitted, all access providers are returned.

Range parameters

Name Type Required Description

from

Any

Beginning of the range (inclusive). Must be an AccessProvider document.

to

Any

End of the range (inclusive). Must be an AccessProvider document.

Return value

Type Description

Set<AccessProvider>

Set of AccessProvider documents in the provided range. If a range is omitted, all access providers are returned.

The Set is empty if:

  • The database has no access providers.

  • There are no access providers in the provided range.

  • The provided range’s from value is greater than to.

Examples

Range examples

  1. Get all access providers for the database:

    AccessProvider.all()
    {
      data: [
        {
          name: "issuerFoo",
          coll: AccessProvider,
          ts: Time("2099-06-25T14:57:23.125Z"),
          ...
          issuer: "https://example.com/a",
          audience: "https://db.fauna.com/db/ysjowue14yyr1",
          jwks_uri: "https://example.com/a/.well-known/jwks.json"
        },
        {
          name: "issuerBaz",
          coll: AccessProvider,
          ts: Time("2099-06-25T14:57:23.125Z"),
          ...
          issuer: "https://example.com/b",
          audience: "https://db.fauna.com/db/ysjowue14yyr1",
          jwks_uri: "https://example.com/b/.well-known/jwks.json"
        },
        {
          name: "issuerBar",
          coll: AccessProvider,
          ts: Time("2099-06-25T14:57:23.125Z"),
          ...
          issuer: "https://example.com/c",
          audience: "https://db.fauna.com/db/ysjowue14yyr1",
          jwks_uri: "https://example.com/c/.well-known/jwks.json"
        },
        {
          name: "issuerQux",
          coll: AccessProvider,
          ts: Time("2099-06-25T14:57:23.125Z"),
          ...
          issuer: "https://example.com/d",
          audience: "https://db.fauna.com/db/ysjowue14yyr1",
          jwks_uri: "https://example.com/d/.well-known/jwks.json"
        },
        ...
      ]
    }
  2. Given the previous Set, get all access providers starting with issuerBaz (inclusive):

    AccessProvider.all({ from: AccessProvider.byName("issuerBaz") })
    {
      data: [
        {
          name: "issuerBaz",
          coll: AccessProvider,
          ts: Time("2099-06-25T14:57:23.125Z"),
          ...
          issuer: "https://example.com/b",
          audience: "https://db.fauna.com/db/ysjowue14yyr1",
          jwks_uri: "https://example.com/b/.well-known/jwks.json"
        },
        {
          name: "issuerBar",
          coll: AccessProvider,
          ts: Time("2099-06-25T14:57:23.125Z"),
          ...
          issuer: "https://example.com/c",
          audience: "https://db.fauna.com/db/ysjowue14yyr1",
          jwks_uri: "https://example.com/c/.well-known/jwks.json"
        },
        {
          name: "issuerQux",
          coll: AccessProvider,
          ts: Time("2099-06-25T14:57:23.125Z"),
          ...
          issuer: "https://example.com/d",
          audience: "https://db.fauna.com/db/ysjowue14yyr1",
          jwks_uri: "https://example.com/d/.well-known/jwks.json"
        },
        ...
      ]
    }
  3. Get a Set of access providers from issuerBaz (inclusive) to issuerBar (inclusive):

    AccessProvider.all({ from: AccessProvider.byName("issuerBaz"),
                     to: AccessProvider.byName("issuerBar") })
    {
      data: [
        {
          name: "issuerBaz",
          coll: AccessProvider,
          ts: Time("2099-06-25T14:57:23.125Z"),
          ...
          issuer: "https://example.com/b",
          audience: "https://db.fauna.com/db/ysjowue14yyr1",
          jwks_uri: "https://example.com/b/.well-known/jwks.json"
        },
        {
          name: "issuerBar",
          coll: AccessProvider,
          ts: Time("2099-06-25T14:57:23.125Z"),
          ...
          issuer: "https://example.com/bc",
          audience: "https://db.fauna.com/db/ysjowue14yyr1",
          jwks_uri: "https://example.com/c/.well-known/jwks.json"
        }
      ]
    }
  4. Get a Set of access providers up to issuerBar (inclusive):

    AccessProvider.all({ to: AccessProvider.byName("issuerBar") })
    {
      data: [
        {
          name: "issuerFoo",
          coll: AccessProvider,
          ts: Time("2099-06-25T14:57:23.125Z"),
          ...
          issuer: "https://example.com/a",
          audience: "https://db.fauna.com/db/ysjowue14yyr1",
          jwks_uri: "https://example.com/a/.well-known/jwks.json"
        },
        {
          name: "issuerBaz",
          coll: AccessProvider,
          ts: Time("2099-06-25T14:57:23.125Z"),
          ...
          issuer: "https://example.com/b",
          audience: "https://db.fauna.com/db/ysjowue14yyr1",
          jwks_uri: "https://example.com/b/.well-known/jwks.json"
        },
        {
          name: "issuerBar",
          coll: AccessProvider,
          ts: Time("2099-06-25T14:57:23.125Z"),
          ...
          issuer: "https://example.com/c",
          audience: "https://db.fauna.com/db/ysjowue14yyr1",
          jwks_uri: "https://example.com/c/.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!