Skip to content

Commit 7c74549

Browse files
committed
review edits
1 parent e4c0968 commit 7c74549

File tree

10 files changed

+26
-34
lines changed

10 files changed

+26
-34
lines changed

docs/auth/faq.mdx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ keywords:
1212

1313
## Should I choose JWT or Webhook mode?
1414

15-
JWT mode is the default mode and is recommended for most use cases. It's easy to set up, integrates with many 3rd party
16-
providers and provides a robust security model.
15+
JWT mode is recommended for most use cases. It's easy to set up, integrates with many 3rd party providers and provides a
16+
robust security model.
1717

1818
Webhook mode is more flexible and can be useful for custom authentication scenarios. Webhook mode will be slightly
1919
slower than JWT mode due to the additional network request.
@@ -41,7 +41,8 @@ objects.
4141

4242
## How do I enable a fully open production API where any user can query anything without any auth in their queries?
4343

44-
Use [NoAuth](/auth/noauth-mode.mdx) mode.
44+
Use [NoAuth](/auth/noauth-mode.mdx) mode and set the API to public via the console in Settings > Summary > API Access
45+
Mode or by using the `ddn project set-api-access-mode public` command.
4546

4647
## How do I enable a **mostly** fully public API with no authentication but where **some** fields are not public?
4748

docs/auth/jwt/index.mdx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,6 @@ In JWT mode, session variables are passed to the Hasura Engine on each request i
3333
- [Firebase JWT integration](/auth/jwt/tutorials/integrations/3-firebase.mdx)
3434
- [Clerk JWT integration](/auth/jwt/tutorials/integrations/4-clerk.mdx)
3535

36-
- [JWT configuration information](/auth/jwt/jwt-configuration.mdx)
37-
38-
## Integrations with 3rd party services
36+
## JWT configuration information
3937

40-
- [Auth0 JWT integration](/auth/jwt/tutorials/integrations/1-auth0.mdx)
41-
- [AWS Cognito JWT integration](/auth/jwt/tutorials/integrations/2-aws-cognito.mdx)
42-
- [Firebase JWT integration](/auth/jwt/tutorials/integrations/3-firebase.mdx)
43-
- [Clerk JWT integration](/auth/jwt/tutorials/integrations/4-clerk.mdx)
38+
- [JWT configuration information](/auth/jwt/jwt-configuration.mdx)

docs/auth/jwt/jwt-configuration.mdx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ As a minimum, either the `type` **and** `key` values OR the `jwk_url` value **ha
4646
{
4747
"iat": 1735916718,
4848
"exp": 1796916677,
49-
"https://hasura.io/jwt/claims": {
49+
"claims.jwt.hasura.io": {
5050
"x-hasura-default-role": "user",
5151
"x-hasura-allowed-roles": ["user", "admin"],
5252
"x-hasura-user-id": "123",
@@ -73,7 +73,8 @@ of this example JWT token. The signature secret to verify this token with the HS
7373
The `x-hasura-role` value can be sent as a plain **header** in the request to indicate the role which should be used.
7474

7575
When your auth server generates the JWT, the custom claims in the JWT **must contain the following** in a custom
76-
`https://hasura.io/jwt/claims` [namespace](#claims-namespace):
76+
namespace. This namespace can be any string you choose, as long as it matches the `claims_namespace` defined in your
77+
AuthConfig. Using `claims.jwt.hasura.io` will match our examples:
7778

7879
1. A `x-hasura-default-role` field. The role that will be used when the optional `x-hasura-role` _header_ is **not
7980
passed**.
@@ -236,7 +237,7 @@ The JWT token should be in the following format if the `claims_namespace_path` i
236237
:::info Claims namespace values
237238

238239
The JWT config can only have one of either `claims_namespace` or `claims_namespace_path` values set. If neither keys are
239-
set, then the default value of `claims_namespace` i.e. `https://hasura.io/jwt/claims` will be used.
240+
set, then the default value of `claims_namespace` i.e. `claims.jwt.hasura.io` will be used.
240241

241242
:::
242243

@@ -261,7 +262,7 @@ If `claims_format` is `json` then the JWT claims should look like:
261262
"name": "John Doe",
262263
"admin": true,
263264
"iat": 1516239022,
264-
"https://hasura.io/jwt/claims": {
265+
"claims.jwt.hasura.io": {
265266
"x-hasura-allowed-roles": ["editor", "user", "mod"],
266267
"x-hasura-default-role": "user",
267268
"x-hasura-user-id": "1234567890",
@@ -279,7 +280,7 @@ If `claims_format` is `stringified_json` then the JWT claims should look like:
279280
"name": "John Doe",
280281
"admin": true,
281282
"iat": 1516239022,
282-
"https://hasura.io/jwt/claims": "{\"x-hasura-allowed-roles\":[\"editor\",\"user\",\"mod\"],\"x-hasura-default-role\":\"user\",\"x-hasura-user-id\":\"1234567890\",\"x-hasura-org-id\":\"123\",\"x-hasura-custom\":\"custom-value\"}"
283+
"claims.jwt.hasura.io": "{\"x-hasura-allowed-roles\":[\"editor\",\"user\",\"mod\"],\"x-hasura-default-role\":\"user\",\"x-hasura-user-id\":\"1234567890\",\"x-hasura-org-id\":\"123\",\"x-hasura-custom\":\"custom-value\"}"
283284
}
284285
```
285286

docs/auth/jwt/jwt-mode.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ used. If this is not provided, the engine will use the `x-hasura-default-role` v
4646

4747
You can enable your Hasura DDN instance to use JWTs in just a few steps.
4848

49-
## Step 1. Update your AuthConfig
49+
### Step 1. Update your AuthConfig
5050

5151
Hasura utilizes an [AuthConfig](/supergraph-modeling/auth-config.mdx) object that allows you to define the configuration
5252
for your authentication service. In a standard setup the `auth-config.hml` file can be found in your `globals`
@@ -87,7 +87,7 @@ definition:
8787
8888
Read more about other setup options [here](/supergraph-modeling/auth-config.mdx#authconfig-jwtconfig).
8989
90-
## Step 2. Define the JWT with custom claims
90+
### Step 2. Define the JWT with custom claims
9191
9292
Your auth service should include an object with a key of `claims.jwt.hasura.io` in the JWT. Within this, each claim
9393
should be prefixed with `x-hasura-*` and include the relevant information. Note that an extra optional `x-hasura-role`
@@ -133,11 +133,11 @@ vulnerability**. Learn how to set this [here](supergraph-modeling/auth-config.md
133133

134134
:::
135135

136-
## Step 3. Add permissions to an object in your supergraph
136+
### Step 3. Add permissions to an object in your supergraph
137137

138138
{/* TODO: Add permissions to an object in your supergraph */}
139139

140-
## Step 3. Rebuild your supergraph
140+
### Step 4. Rebuild your supergraph
141141

142142
Once you've updated your `AuthConfig` object in `auth-config.hml` and updated your claims, you can rebuild your
143143
supergraph and test it locally.
@@ -146,7 +146,7 @@ supergraph and test it locally.
146146
ddn supergraph build local
147147
```
148148

149-
## Step 4. Make an authenticated request
149+
### Step 5. Make an authenticated request
150150

151151
In the example above, we're using the `BearerAuthorization` method. As such, as we can make a request to our Hasura DDN
152152
instance by including a header with the key-value of `Authorization: Bearer <our-encoded-token>`. For testing, you can

docs/auth/overview.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ keywords:
1616
- data security
1717
- jwt mode
1818
- hasura integration
19-
hide_table_of_contents: true
2019
seoFrontMatterUpdated: true
2120
---
2221

docs/auth/permissions/command-permissions.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ keywords:
77
- role-based access
88
- supergraph
99
- argument presets
10-
sidebar_label: Command Permissions Guide
10+
sidebar_label: Command Permissions
1111
---
1212

1313
# Command Permissions

docs/auth/permissions/index.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ user can access.
2121

2222
The following types of permissions can be defined:
2323

24-
- To define which **fields** are accessible by a role in the API, configure the appropriate
25-
[`TypePermissions`](/auth/permissions/type-permissions.mdx)
2624
- To define what **data** within a model are allowed to be accessed by a role, configure the appropriate
2725
[`ModelPermissions`](/auth/permissions/model-permissions.mdx)
26+
- To define which **fields** are accessible by a role in the API, configure the appropriate
27+
[`TypePermissions`](/auth/permissions/type-permissions.mdx)
2828
- To define whether the command is **executable** by a role, configure the appropriate
2929
[`CommandPermissions`](/auth/permissions/command-permissions.mdx)

docs/auth/permissions/model-permissions.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ keywords:
44
- model permissions
55
- supergraph
66
- data access control
7-
sidebar_position: 2
7+
sidebar_position: 1
88
sidebar_label: Model Permissions
99
---
1010

docs/auth/permissions/type-permissions.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
sidebar_position: 1
2+
sidebar_position: 2
33
description: "Guide on defining Type Permissions for API fields in a supergraph."
44
keywords:
55
- type permissions

docs/auth/webhook/webhook-mode.mdx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,13 @@ import Thumbnail from "@site/src/components/Thumbnail";
2323

2424
You can enable your Hasura DDN instance to use an auth webhook in just a few steps.
2525

26-
This requires specifying a URL - which Hasura calls with the original request headers - that then returns a body
27-
containing the session variables after authenticating the request.
26+
You will need to provide a URL that Hasura will call with the original request headers, and it should return a body with
27+
the session variables after the request is authenticated.
2828

2929
<Thumbnail src="/img/auth/auth-webhook-overview-diagram.png" alt="Authentication using webhooks" width="1000px" />
3030

3131
## Enabling Webhook authentication
3232

33-
You can enable your Hasura DDN instance to use webhooks in just a few steps.
34-
3533
## Step 1. Update your AuthConfig {#update-authconfig}
3634

3735
Hasura utilizes an [AuthConfig](/supergraph-modeling/auth-config.mdx) object that allows you to define the configuration
@@ -131,17 +129,15 @@ Content-Type: application/json
131129

132130
{/* TODO: Write this section */}
133131

134-
## Step 3. Rebuild your supergraph
135-
136-
Once you've updated your `auth-config.hml`, you can rebuild your supergraph and test it locally.
132+
## Step 4. Rebuild your supergraph
137133

138134
```bash title="For example, from the root of your project, run:"
139135
ddn supergraph build local \
140136
--supergraph supergraph.yaml \
141137
--env-file .env
142138
```
143139

144-
## Step 4. Make an authenticated request
140+
## Step 5. Make an authenticated request
145141

146142
In the example above, we're using the `BearerAuthorization` method. As such, as we can make a request to our Hasura DDN
147143
instance by including a header with the key-value of `Authorization: Bearer <our-encoded-token>`. For testing, you can

0 commit comments

Comments
 (0)