[英]How to do grafana authentication with Nginx and Okta
您如何配置 Grafana 身份驗證以通過 Okta?
我已經查看了幾個不同的資源,所以目前我擁有的是一個 Nginx 服務器,它將請求代理到我的 Grafana 服務器。 但是,當我嘗試向 Okta 添加反向代理時,我得到了 500 響應。 我一直在嘗試設置 Grafana 的 auth.proxy 以及 Nginx 的 http_auth_proxy_request_module。
這是我的 grafana 配置:
[服務器]
root_url = %(protocol)s://$(domain)s:/grafana
[授權代理]
啟用 = 真
header_name = X-Webauth-User
header_property = 用戶名
auto_sign_up = 真
這是我的 nginx 配置:
服務器{
位置 /grafana {
auth_request /auth;
auth_request_set $user $upstream_http_x_user;
proxy_set_header x-user $user;
proxy_pass http://localhost:3000 ;
重寫 ^/grafana(.*) /$1 break;
}位置/身份驗證{
proxy_pass https://myorg.okta.com/home/app/key ;
proxy_pass_request_body 關閉;
proxy_set_header 內容長度“”;
proxy_set_header X-Original_URI $request_uri;
}
我對所有這些都不熟悉,因此任何提示或幫助以及一些解釋將不勝感激。 干杯!
將 Grafana 與 Okta 集成的最簡單方法是使用通用 OAuth2.0 登錄模塊。 您需要在 Okta 中將 Grafana 設置為 OpenID 客戶端“Web 應用程序”。 將 Base URIs 設置為https://<grafana domain>/
並將登錄重定向 URIs 設置為https://<grafana domain>/login/generic_oauth
。
然后在 Grafana 中設置通用 oauth 模塊,如:
[auth.generic_oauth]
name = Okta
enabled = true
scopes = openid profile email
client_id = <okta application Client ID>
client_secret = <okta application Client Secret>
auth_url = https://<okta domain>/oauth2/v1/authorize
token_url = https://<okta domain>/oauth2/v1/token
api_url = https://<okta domain>/oauth2/v1/userinfo
我也遇到過這種情況。 而且,我使用了 Grafana 和 Nginx 的 docker 鏡像,並啟用了 SSL。 我在這里寫了我的解決方案: https : //www.gyanblog.com/gyan/how-configure-grafana-dashboard-oauth-okta-ssl-docker-nginx/
您只需要獲取 Okta 客戶端 ID 和密碼即可。 另外,將登錄重定向 url 配置為:https:///login/generic_oauth
休息很簡單。
我有類似的問題,但使用Okta配置NGINX時,會收到400錯誤請求頁面,並顯示以下消息:身份提供程序:未知錯誤代碼:invalid_request說明:“ redirect_uri”參數必須是在客戶端應用程序設置中列入白名單的絕對URI。
有什么想法嗎?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.