- docs/iap.md 写清 3 段配置 + 5 个 X-Auth-* 头 + Bearer/Cookie 双源 + 6 个踩坑
- docs/iap-demo/ 留 nginx.conf.template 与回显 backend.py,可复用
实测: ipass-sso-v0.7.0 .so 加载自签 RSA key,挂到 30089 端口
/iap-demo/ 走 sso_iap on; 注入 X-Auth-User/Sub/Email/Groups/Token
Co-Authored-By: Claude Code <[email protected]>
61 lines
1.8 KiB
Plaintext
61 lines
1.8 KiB
Plaintext
worker_processes 1;
|
|
error_log /dev/stderr info;
|
|
pid /tmp/nginx/nginx.pid;
|
|
|
|
load_module /usr/local/nginx/modules/libipass_sso_gateway.so;
|
|
|
|
env OAUTH_SIGNING_SECRET;
|
|
env OAUTH_ISSUER;
|
|
env OAUTH_COOKIE_DOMAIN;
|
|
|
|
events {
|
|
worker_connections 1024;
|
|
}
|
|
|
|
http {
|
|
include /usr/local/nginx/conf/mime.types;
|
|
default_type application/json;
|
|
sendfile on;
|
|
keepalive_timeout 65;
|
|
|
|
client_body_temp_path /tmp/nginx/client_body;
|
|
proxy_temp_path /tmp/nginx/proxy;
|
|
|
|
log_format iapfmt '$remote_addr - $remote_user [$time_local] "$request" '
|
|
'$status $body_bytes_sent '
|
|
'auth_user=$auth_user auth_sub=$auth_sub '
|
|
'auth_email=$auth_email auth_groups=$auth_groups';
|
|
access_log /dev/stdout iapfmt;
|
|
|
|
ipass_state state 16m;
|
|
ipass_data_dir /usr/local/nginx/data;
|
|
|
|
server {
|
|
listen 30089;
|
|
server_name _;
|
|
|
|
location = /healthz {
|
|
return 200 "ok\n";
|
|
}
|
|
|
|
location /iap-demo/ {
|
|
sso_iap on;
|
|
proxy_pass http://host.docker.internal:18200;
|
|
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Auth-User $auth_user;
|
|
proxy_set_header X-Auth-Sub $auth_sub;
|
|
proxy_set_header X-Auth-Email $auth_email;
|
|
proxy_set_header X-Auth-Groups $auth_groups;
|
|
proxy_set_header X-Auth-Token $auth_token;
|
|
proxy_set_header X-Original-URI $request_uri;
|
|
|
|
error_page 401 = @oauth_login;
|
|
}
|
|
|
|
location @oauth_login {
|
|
return 302 "http://192.168.1.26:30082/oauth/authorize?client_id=app-crm&redirect_uri=http%3A%2F%2F127.0.0.1%3A18101%2Fcallback&response_type=code&scope=openid+profile+email&state=iap_demo";
|
|
}
|
|
}
|
|
}
|