Skip to content

Commit

Permalink
usage
Browse files Browse the repository at this point in the history
  • Loading branch information
boruszak committed Jun 9, 2023
1 parent f6b1295 commit aaccd1a
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions website/content/docs/connect/intentions/jwt-authorization.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ By specifying a JSON Web Key Set (JWKS) in the configuration entry and referenci

The process to configure your network to enforce service intentions based on JSON web tokens consists of the following steps:

1. Create a JWT provider configuration entry. This configuration entry defines rules and behaviors for verifying tokens. These configurations apply at the level of the admin partition in Consul Enterprise, which is functionally equivalent to a datacenter in Consul OSS. Then, write the `jwt-provider` configuration entry to Consul. The ACL policy requirement to read and modify this configuration entry is `mesh:write`.
1. **Create a JWT provider configuration entry**. This configuration entry defines rules and behaviors for verifying tokens. These configurations apply at the level of the admin partition in Consul Enterprise, which is functionally equivalent to a datacenter in Consul OSS. Then, write the `jwt-provider` configuration entry to Consul. The ACL policy requirement to read and modify this configuration entry is `mesh:write`.

1. Create or update a service intentions configuration entry to reference the JWT provider. This configuration invokes the name of the `jwt-provider` configuration entry you created, which causes the Envoy proxy to verify the token and the permissions it authorizes before the incoming request is accepted. Then, write the `service-intentions` configuration entry that references the JWT to Consul. The ACL policy requirement to read and modify this configuration entry is `mesh:write`.
1. **Create or update a service intentions configuration entry to reference the JWT provider**. This configuration invokes the name of the `jwt-provider` configuration entry you created, which causes the Envoy proxy to verify the token and the permissions it authorizes before the incoming request is accepted. Then, write the `service-intentions` configuration entry that references the JWT to Consul. The ACL policy requirement to read and modify this configuration entry is `mesh:write`.

### Wildcards and intention defaults

Expand Down Expand Up @@ -78,3 +78,24 @@ $ consul config write okta.hcl

### Update service intentions

After you create the JWT provider entry, you can update your service intentions so that proxies validate the token before authorizing a request. The following example includes the minimum required configuration to enable JWT authorization with service intentions:

```hcl
Kind = "service-intentions"
Name = "web"
JWT = {
Providers = [
{
Provider = "okta"
}
]
}
```

You can include additional configuration information to require the token to match specific claims. You can also configure the `JWT` field to apply only to requests that come from certain HTTP paths. Refer to [JWT validations with intentions](/consul/docs/conntect/config-entries/service-intentions#jwt-validations-with-intentions) for an example configuration.

After you update the service intention, write the configuration to Consul so that it takes effect:

```shell-session
$ consul config write web.hcl
```

0 comments on commit aaccd1a

Please sign in to comment.