You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: daprdocs/content/en/reference/components-reference/supported-middleware/middleware-oauth2.md
+64Lines changed: 64 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,6 +36,8 @@ spec:
36
36
value: "authorization"
37
37
- name: forceHTTPS
38
38
value: "false"
39
+
- name: pathFilter
40
+
value: ".*/users/.*"
39
41
```
40
42
41
43
{{% alert title="Warning" color="warning" %}}
@@ -54,6 +56,7 @@ The above example uses secrets as plain strings. It is recommended to use a secr
54
56
| redirectURL | The URL of your web application that the authorization server should redirect to once the user has authenticated | `"https://myapp.com"`
55
57
| authHeaderName | The authorization header name to forward to your application | `"authorization"`
56
58
| forceHTTPS | If true, enforces the use of TLS/SSL | `"true"`,`"false"` |
59
+
| pathFilter | Applies the middleware only to requests matching the given path pattern | `".*/users/.*"`
57
60
58
61
## Dapr configuration
59
62
@@ -71,6 +74,67 @@ spec:
71
74
type: middleware.http.oauth2
72
75
```
73
76
77
+
## Request path filtering
78
+
79
+
The `pathFilter` field allows you to selectively apply OAuth2 authentication based on the HTTP request path using a regex pattern. This enables scenarios such as configuring multiple OAuth2 middlewares with different scopes for different API endpoints, implementing the least privilege principle by ensuring users only receive the minimum permissions necessary for their intended operation.
80
+
81
+
### Example: Separate read-only and admin user access
82
+
In the following configuration:
83
+
- Requests to `/api/users/*` endpoints receive tokens with a read-only user scopes
84
+
- Requests to `/api/admin/*` endpoints receive tokens with full admin scopes
85
+
86
+
This reduces security risk by preventing unnecessary privilege access and limiting the blast radius of compromised tokens.
Copy file name to clipboardExpand all lines: daprdocs/content/en/reference/components-reference/supported-middleware/middleware-oauth2clientcredentials.md
@@ -47,6 +49,7 @@ The above example uses secrets as plain strings. It is recommended to use a secr
47
49
| headerName | The authorization header name to forward to your application | `"authorization"`
48
50
| endpointParamsQuery | Specifies additional parameters for requests to the token endpoint | `true`
49
51
| authStyle | Optionally specifies how the endpoint wants the client ID & client secret sent. See the table of possible values below | `0`
52
+
| pathFilter | Applies the middleware only to requests matching the given path pattern | `".*/users/.*"`
50
53
51
54
### Possible values for `authStyle`
52
55
@@ -72,6 +75,63 @@ spec:
72
75
type: middleware.http.oauth2clientcredentials
73
76
```
74
77
78
+
## Request path filtering
79
+
80
+
The `pathFilter` field allows you to selectively apply OAuth2 authentication based on the HTTP request path using a regex pattern. This enables scenarios such as configuring multiple OAuth2 middlewares with different scopes for different API endpoints, implementing the least privilege principle by ensuring users only receive the minimum permissions necessary for their intended operation.
81
+
82
+
### Example: Separate read-only and admin user access
83
+
84
+
In the following configuration:
85
+
- Requests to `/api/users/*` endpoints receive tokens with a read-only user scopes
86
+
- Requests to `/api/admin/*` endpoints receive tokens with full admin scopes
87
+
This reduces security risk by preventing unnecessary privilege access and limiting the blast radius of compromised tokens.
0 commit comments