如何修复在 Hue 应用程序中使用 SAML 的错误

Posted

技术标签:

【中文标题】如何修复在 Hue 应用程序中使用 SAML 的错误【英文标题】:How do I fix error with using SAML in Hue application 【发布时间】:2020-01-24 03:49:08 【问题描述】:

我在 hue 应用程序中使用 saml 函数时遇到问题。

我做了所有我需要做的事情:https://docs.gethue.com/latest/administrator/configuration/server/#saml

环境

操作系统:ubuntu 色调:4.5.0

第 1 步。 在下方安装

git gcc python-dev swig openssl xmlsec1 libxmlsec1-openssl

步骤 2. 将元数据从 Idp 复制到本地

步骤 3. 使用 openssl 制作私钥和认证

第四步设置配置ini文件

[[auth]] 
backend=libsaml.backend.SAML2Backend 
[libsaml]
xmlsec_binary=/usr/bin/xmlsec1
metadata_file=/opt/cloudera/security/saml/idp-openam-metadata.xml
key_file=/opt/cloudera/security/saml/host.key
cert_file=/opt/cloudera/security/saml/host.pem username_source=nameid
entity_id=https://myhuedomainname.com/saml2/metadata

步骤 5. 获取色调元数据并在 Idp 中注册

我的色调元数据位于:https://myhuedomainname.com/saml2/metadata 我在我们公司使用的 Idp 注册了它。

我认为我做的一切都是正确的。

但是当我访问https://myhuedomainname.com时, 我的浏览器被重定向到:https://myhuedomainname.com/saml2/login/?next=/ 然后我得到了我无法解决的错误

它是一次又一次重定向到同一个url的空白屏幕。

在浏览器控制台中,我收到此错误

i18n.js:17 Uncaught ReferenceError: HUE_I18n is not defined 在 I18n (i18n.js:17) 在 Module../desktop/core/src/desktop/js/jquery/plugins/jquery.filechooser.js (hue-bundle-facb48d1fb2c72ee1343.js:sourcemap:47211) 在 webpack_require (hue-bundle-facb48d1fb2c72ee1343.js:sourcemap:104) 在 Module../desktop/core/src/desktop/js/jquery/jquery.common.js (hue-bundle-facb48d1fb2c72ee1343.js:sourcemap:46742) 在 webpack_require (hue-bundle-facb48d1fb2c72ee1343.js:sourcemap:104) 在 Module../desktop/core/src/desktop/js/hue.js (hue-bundle-facb48d1fb2c72ee1343.js:sourcemap:46485) 在 webpack_require (hue-bundle-facb48d1fb2c72ee1343.js:sourcemap:104) 在 Object.0 (hue-bundle-facb48d1fb2c72ee1343.js:sourcemap:104841) 在 webpack_require (hue-bundle-facb48d1fb2c72ee1343.js:sourcemap:104) 在 checkDeferredModules (hue-bundle-facb48d1fb2c72ee1343.js:sourcemap:65)

I18n@i18n.js:17 ./desktop/core/src/desktop/js/jquery/plugins/jquery.filechooser.js @ 色调捆绑 facb48d1fb2c72ee1343.js:sourcemap:47211 webpack_require @hue-bundle-facb48d1fb2c72ee1343.js:sourcemap:104 ./desktop/core/src/desktop/js/jquery/jquery.common.js @ 色调捆绑 facb48d1fb2c72ee1343.js:sourcemap:46742 webpack_require @hue-bundle-facb48d1fb2c72ee1343.js:sourcemap:104 ./desktop/core/src/desktop/js/hue.js @ 色调捆绑 facb48d1fb2c72ee1343.js:sourcemap:46485 webpack_require @hue-bundle-facb48d1fb2c72ee1343.js:sourcemap:104 0 @hue-bundle-facb48d1fb2c72ee1343.js:sourcemap:104841 webpack_require @hue-bundle-facb48d1fb2c72ee1343.js:sourcemap:104 checkDeferredModules @hue-bundle-facb48d1fb2c72ee1343.js:sourcemap:65 (匿名)@ hue-bundle-facb48d1fb2c72ee1343.js:sourcemap:241 (匿名)@hue-bundle-facb48d1fb2c72ee1343.js:sourcemap:244

bootstrap-tooltip.js:326 Uncaught TypeError: Cannot read property 'fn' 未定义的 在引导工具提示.js:326 在 bootstrap-tooltip.js:361(匿名)@bootstrap-tooltip.js:326(匿名)@bootstrap-tooltip.js:361

bootstrap-typeahead-touchscreen.js:317 Uncaught TypeError: 无法读取 未定义的属性“fn” 在 bootstrap-typeahead-touchscreen.js:317 在 bootstrap-typeahead-touchscreen.js:358(匿名)@bootstrap-typeahead-touchscreen.js:317(匿名)@ bootstrap-typeahead-touchscreen.js:358

bootstrap-better-typeahead.min.js:12 Uncaught TypeError: 无法读取 未定义的属性“扩展” 在 bootstrap-better-typeahead.min.js:12 在 bootstrap-better-typeahead.min.js:12(匿名)@bootstrap-better-typeahead.min.js:12(匿名)@ bootstrap-better-typeahead.min.js:12

popover-extra-placements.js:113 Uncaught ReferenceError: jQuery is not 定义 在 popover-extra-placements.js:113(匿名)@popover-extra-placements.js:113

?next=/:123 Uncaught ReferenceError: Dropzone is not defined 在 ?next=/:123(匿名)@ ?next=/:123

以下是hue的日志

[23/Sep/2019 21:50:34 +0000] 中间件 INFO 重定向到 登录页面:/ [23/Sep/2019 21:50:34 +0000] 访问 INFO 210.94.41.89, 34.96.109.171 -anon- - "GET / HTTP/1.1" (mem: 158mb)--登录重定向 [23/Sep/2019 21:50:34 +0000] 访问 INFO 210.94.41.89、34.96.109.171 -anon- - “GET / HTTP/1.1”在 1 毫秒内返回(内存:158mb)[23/Sep/2019 21:50:34]“GET / HTTP/1.1”302 0 [2019 年 9 月 23 日 21:50:34] “获取 /静态/桌面/js/bundles/hue/hue-bundle-facb48d1fb2c72ee1343.js.map HTTP/1.1" 200 7139914 [23/Sep/2019 21:50:35 +0000] 访问调试 210.94.41.89、34.96.109.171 -anon- - “GET /saml2/login/ HTTP/1.1”(内存:158mb)[23/Sep/2019 21:50:35 +0000] mdstore 调试 服务 => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST': ['binding': 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST', '': 'urn:oasis:names:tc:SAML:2.0:metadata&SingleSignOnService', '位置': 'https://sts.secsso.net/adfs/ls/'], 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect': ['binding': 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect', 'class': 'urn:oasis:names:tc:SAML:2.0:metadata&SingleSignOnService', '位置':'https://sts.secsso.net/adfs/ls/'] [23/Sep/2019 21:50:35 +0000] mdstore 调试服务 => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST': ['binding': 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST', 'class': 'urn:oasis:names:tc:SAML:2.0:metadata&SingleSignOnService', '位置': 'https://sts.secsso.net/adfs/ls/'], 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect': ['binding': 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect', 'class': 'urn:oasis:names:tc:SAML:2.0:metadata&SingleSignOnService', '位置':'https://sts.secsso.net/adfs/ls/'] [23/Sep/2019 21:50:35 +0000] mdstore 调试服务(http://sts.secsso.net/adfs/services/trust, idpsso_descriptor, single_sign_on_service,无)[2019 年 9 月 23 日 21:50:35 +0000] mdstore 调试服务 => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST': ['binding': 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST', '': 'urn:oasis:names:tc:SAML:2.0:metadata&SingleSignOnService', '位置': 'https://sts.secsso.net/adfs/ls/'], 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect': ['binding': 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect', 'class': 'urn:oasis:names:tc:SAML:2.0:metadata&SingleSignOnService', '位置':'https://sts.secsso.net/adfs/ls/'] [23/Sep/2019 21:50:35 +0000] mdstore 调试服务(http://sts.secsso.net/adfs/services/trust, idpsso_descriptor, single_sign_on_service, urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect) [23/Sep/2019 21:50:35 +0000] mdstore 调试服务 => ['binding': 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect', 'class': 'urn:oasis:names:tc:SAML:2.0:metadata&SingleSignOnService', '位置':'https://sts.secsso.net/adfs/ls/'] [2019 年 9 月 23 日 21:50:35 +0000] 客户端信息目的地到提供者:https://sts.secsso.net/adfs/ls/ [23/Sep/2019 21:50:35 +0000] 实体 信息请求: https://sbc-hue.mgmt.dev.com/saml2/metadata/ [23/Sep/2019 21:50:35 +0000] 客户信息 AuthNReq:https://sbc-hue.mgmt.dev.com/saml2/metadata/ [23/Sep/2019 21:50:35 +0000] 实体信息 HTTP REDIRECT [23/Sep/2019 21:50:35 +0000] 观看次数 警告 用户 正在使用 Hue 3 UI [23/Sep/2019 21:50:35 +0000] 装饰器 INFO AXES:调用修饰函数:dt_login [23/Sep/2019 21:50:35 +0000] 装饰器 INFO 参数:(True,) [23/Sep/2019 21:50:35 +0000] 访问 INFO 210.94.41.89, 34.96.109.171 -anon- - “GET /saml2/login/ HTTP/1.1”返回在 250 毫秒内(内存:158mb)

我用hue 4.0.0版本试过了,但它可以工作

【问题讨论】:

【参考方案1】:

我通过设置“redirect_whitelist”解决了这个问题。 我只是虽然这不是强制性的。但它是

【讨论】:

以上是关于如何修复在 Hue 应用程序中使用 SAML 的错误的主要内容,如果未能解决你的问题,请参考以下文章

如何在多租户环境中自动选择配置的 SAML 身份提供程序以使用 Spring SAML 进行 SSO

如何在名称 ID、ADFS3.0 的 SAML 响应中获取“域\用户 ID”

如何设置 Web 应用程序以在 JAVA 中使用 ADFS /SAML/WS-*?

如何在同一应用程序中使用 spring-sample 示例配置 Spring Security 基本身份验证和 SAML 身份验证

如何在Hue中使用Sentry创建角色,授权

如何使用 philips hue API 创建“场景”