@blakearoberts/visage 0.0.5-rc.26 → 0.0.5-rc.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -5
- package/dist/index.js +1 -4
- package/dist/render/nginx.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -105,11 +105,44 @@ visage({
|
|
|
105
105
|
});
|
|
106
106
|
```
|
|
107
107
|
|
|
108
|
-
OAuth2 Proxy
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
108
|
+
OAuth2 Proxy returns the canonical authenticated principal in
|
|
109
|
+
`X-Auth-Request-User`. Visage captures it as `$auth_user` and forwards it to the
|
|
110
|
+
Vite app. When `oauth2.scopes` includes `email`, Visage also captures
|
|
111
|
+
`X-Auth-Request-Email` as `$auth_email` and forwards it to the Vite app. Without
|
|
112
|
+
the `email` scope, `$auth_email` is empty and NGINX omits the header.
|
|
113
|
+
|
|
114
|
+
OAuth2 Proxy can also return `X-Auth-Request-Groups` and
|
|
115
|
+
`X-Auth-Request-Preferred-Username`, but Visage does not capture or forward them
|
|
116
|
+
automatically. Capture and forward optional identity values on each location
|
|
117
|
+
that needs them:
|
|
118
|
+
|
|
119
|
+
```ts
|
|
120
|
+
visage({
|
|
121
|
+
upstreams: {
|
|
122
|
+
api: {
|
|
123
|
+
locations: {
|
|
124
|
+
'/api/': {
|
|
125
|
+
directives: {
|
|
126
|
+
auth_request_set: [
|
|
127
|
+
'$auth_groups $upstream_http_x_auth_request_groups',
|
|
128
|
+
'$auth_preferred_username $upstream_http_x_auth_request_preferred_username',
|
|
129
|
+
],
|
|
130
|
+
},
|
|
131
|
+
headers: {
|
|
132
|
+
'X-Auth-Request-Groups': '$auth_groups',
|
|
133
|
+
'X-Auth-Request-Preferred-Username': '$auth_preferred_username',
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
});
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Requested scopes and identity provider claims determine whether OAuth2 Proxy can
|
|
143
|
+
populate these values. Visage clears incoming `X-Auth-Request-*` identity
|
|
144
|
+
headers before proxying to prevent callers from spoofing them; explicit location
|
|
145
|
+
headers such as those above override the corresponding clears.
|
|
113
146
|
|
|
114
147
|
Authenticated locations also get CSRF checks by default. The policy allows
|
|
115
148
|
same-origin requests and top-level `GET` document navigations, blocks other
|
package/dist/index.js
CHANGED
|
@@ -934,10 +934,7 @@ http {
|
|
|
934
934
|
auth_request_set $auth_user $upstream_http_x_auth_request_user;
|
|
935
935
|
<%_ /* Explicit clear when oauth2-proxy sets sub as email header value. */ %>
|
|
936
936
|
auth_request_set $auth_email <%~ it.email ? '$upstream_http_x_auth_request_email' : '""' %>;
|
|
937
|
-
|
|
938
|
-
auth_request_set $auth_preferred_username $upstream_http_x_auth_request_preferred_username;
|
|
939
|
-
|
|
940
|
-
# Propagate refreshed session cookie.
|
|
937
|
+
<%_ /* Propagate refreshed session cookie. */ %>
|
|
941
938
|
auth_request_set $auth_cookie $upstream_http_set_cookie;
|
|
942
939
|
add_header Set-Cookie $auth_cookie;
|
|
943
940
|
error_page 401 = $auth_error_page;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nginx.d.ts","sourceRoot":"","sources":["../../src/render/nginx.ts"],"names":[],"mappings":"AAKA,OAAO,EAAuB,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"nginx.d.ts","sourceRoot":"","sources":["../../src/render/nginx.ts"],"names":[],"mappings":"AAKA,OAAO,EAAuB,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AAyKnE,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAQ3D"}
|
package/package.json
CHANGED