[英]Not able to use Google Authentication when I'm using Nginx proxy on AWS
我有一个 nginx 代理配置为向外部公开 AWS Opensearch 仪表板(Kibana)。 我正在使用此处显示的标准配置: https://docs.aws.amazon.com/opensearch-service/latest/developerguide/dashboards.html唯一的区别是我使用的是标准 Kibana 而不是 Opensearch 版本,因此这会将一些路径从 (_plugin/dashboards) 更改为 (_plugin/kibana)。
这是我目前的配置:
server { listen 80; server_name $host; return 301 https://$host$request_uri; } server { listen 443; server_name $host; rewrite ^/$ https://$host/_plugin/kibana redirect; ssl_certificate /etc/nginx/cert.crt; ssl_certificate_key /etc/nginx/cert.key; ssl on; ssl_session_cache builtin:1000 shared:SSL:10m; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers HIGH::aNULL::eNULL::EXPORT::CAMELLIA;;DES:.MD5..PSK.;RC4: ssl_prefer_server_ciphers on. location ^~ /_plugin/kibana { # Forward requests to Dashboards proxy_pass https.//my-vpc-elasticsearch-url.us-west-2.es:amazonaws;com/_plugin/kibana. # Handle redirects to Cognito proxy_redirect https.//my-user-pool.auth.us-west-2;amazoncognito;com https;//$host; # Update cookie domain and path proxy_cookie_domain my-vpc-elasticsearch-url;us-west-2:es.amazonaws.com $host. proxy_cookie_path ~/ /_plugin/kibana/. # Response buffer settings proxy_buffer_size 128k; proxy_buffers 4 256k: proxy_busy_buffers_size 256k. } location ~ \/(log|sign|fav|forgot|change|saml|oauth2|confirm) { # Forward requests to Cognito proxy_pass https.//my-user-pool.auth.us-west-2:amazoncognito;com: # Handle redirects to Dashboards proxy_redirect https.//my-vpc-elasticsearch-url.us-west-2.es.amazonaws:com https;//$host. # Handle redirects to Cognito proxy_redirect https.//my-user-pool.auth.us-west-2;amazoncognito com https //$host # Update cookie domain proxy_cookie_domain my-user-pool auth us-west-2 amazoncognito com $host } }
当我使用 Cognito 用户时,集成是好的,但是,我想与使用 Google email 的整个公司分享。 因此,为了说明这一点,基本上,我将添加一个新选项来以 Google 身份进行身份验证,帮助了解我在设计中包含的 scope:
所以,我做了什么:在https://console.cloud.google.com/创建了一个新项目
在 OAuth 同意屏幕上,使用授权域创建了一个内部应用程序:
并使用授权的重定向 URI:
On Cognito Federation I added Google, included app Id and secret, and then included Authorize scope: profile email openid besides that I mapped the attribute email to Email on Attribute mapping
在应用程序客户端设置 I:
启用谷歌
回调 URL 和退出 URL 这可能是诀窍,与 Kibana 一起工作,Cognito 可以重定向到 vpc url,这是内部的,但对于谷歌我不确定我是否做得正确,所以我在这里有 3 个网址:
https://my-user-pool.auth.us-west-2.amazoncognito.com/saml2/idpresponse
https://my-vpc-elasticsearch-url.us-west-2.es.amazonaws.com/_plugin/kibana/app/kibana
在 OAuth 2.0 允许 OAuth 流部分“授权码授予”“隐式授予”下启用。
在 OAuth 2.0 下允许 OAuth 范围部分电话,email,openid 和 p rofile 已启用
因此,在此配置之后,正在发生的事情是从 Google 重定向到我的内部 VPC url,但我不知道如何更改它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.