Skip to content

Commit 1a6f4b5

Browse files
authored
(docs) Clarify RBAC everyone role, plus other small edits (#1217)
1 parent 57e8c2c commit 1a6f4b5

File tree

1 file changed

+14
-18
lines changed
  • fern/products/docs/pages/authentication

1 file changed

+14
-18
lines changed

fern/products/docs/pages/authentication/rbac.mdx

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,17 @@ Role-based access control is helpful for scenarios such as:
2424

2525
### How it works
2626

27-
If a user visits content not marked as visible to the `everyone` role, Fern will check for an authentication cookie to indicate what roles that user has. If the user does not have a role matching the viewers of the page, we will redirect them to the URL you provided during setup.
27+
Every user automatically has the `everyone` role, including unauthenticated visitors. Pages marked with the `everyone` role are publicly accessible without needing to log in.
28+
29+
If a user visits content that requires authentication (i.e., content not marked as visible to `everyone`), Fern checks for an authentication cookie to determine the user's roles. If the user lacks the required role or isn't authenticated, Fern redirects them to the login URL you provided during setup.
2830

2931
## Set up RBAC
3032

3133
<Steps>
34+
3235
### Define all the `roles` in your docs.yml
3336

34-
Start by defining all the different roles in your `docs.yml`. You can specify this under a `roles` key:
37+
Start by using a `roles` key to define all the different roles:
3538

3639
```yml docs.yml
3740
roles:
@@ -41,23 +44,17 @@ roles:
4144
- admins
4245
```
4346
44-
<Info>
45-
The `everyone` role is special. Every user has this role (including unauthenticated users).
46-
</Info>
47-
4847
### Configure authentication via a `fern_token`
4948

50-
In this step, we will configure authentication so that Fern can understand what roles a particular user has.
49+
Fern uses a browser cookie called `fern_token` to identify authenticated users and their roles. If this cookie is not present when a user tries to access restricted content, Fern redirects them to your login page.
5150

52-
Fern expects the user's browser session to have a cookie called `fern_token`. If
53-
the cookie is not present, the user will be redirected to your company's login
54-
page.
55-
56-
Below, we walk through each of the steps required to configure RBAC with either JWT or OAuth.
51+
You can set up this authentication using either JWT or OAuth:
5752

5853
<AccordionGroup>
5954
<Accordion title="JWT">
60-
**You are responsible for creating and setting the `fern_token` cookie in your authentication system.** Upon login, you must set a JWT for the user using a secret key that we will provide. The JWT must have a `fern` claim with a key called `roles`.
55+
**You are responsible for creating and setting the `fern_token` cookie in your authentication system.**
56+
57+
Upon login, set a JWT for the user using a secret key that Fern provides. The JWT must include a `fern` claim with a `roles` array:
6158

6259
```json
6360
{
@@ -72,8 +69,7 @@ Below, we walk through each of the steps required to configure RBAC with either
7269
</Accordion>
7370
<Accordion title="OAuth">
7471

75-
Fern initiates an OAuth flow when the user needs authentication, redirecting them to your authentication endpoint. Fern creates and sets the `fern-token` cookie after completing this flow.
76-
You are responsible for configuring your OAuth endpoints to return user role information.
72+
When a user needs authentication, Fern initiates an OAuth flow and redirects them to your authentication endpoint. You configure your OAuth endpoints to return user role information.
7773

7874
<Markdown src="/snippets/oauth-diagram.mdx"/>
7975

@@ -82,9 +78,9 @@ You are responsible for configuring your OAuth endpoints to return user role inf
8278

8379
### Contact Fern for setup
8480

85-
When you're ready to implement RBAC, **contact [email protected]**.
81+
When you're ready to implement RBAC, contact [email protected].
8682

87-
<Note>Optional: If you'd like restricted pages to be visible but locked to unauthenticated users (rather than completely hidden), let us know during this step.</Note>
83+
<Note title="Optional">If you'd like restricted pages to be visible but locked to unauthenticated users (rather than completely hidden), notify Fern during this step.</Note>
8884

8985
</Steps>
9086

@@ -99,7 +95,7 @@ You can designate viewers on the following navigation items:
9995
- `api references`
10096
- `changelogs`
10197

102-
If you don't specify viewers, the content will be visible to _any authenticated user_.
98+
If you don't specify viewers, the content will be visible to any _authenticated_ user. To make content publicly accessible, explicitly set viewers to `everyone`.
10399

104100
```yml docs.yml {6-7, 13-15}
105101
navigation:

0 commit comments

Comments
 (0)