我目前正在使用passport.js和passport包通过okta认证我的nodejs应用程序。我目前的package.json包括以下与护照有关的包裹的版本:
"passport": "^0.3.2",
"passport-azure-ad": "^4.0.0",
"passport-oauth2": "^1.4.0",
"passport-saml": "^3.2.0",有了这些包,身份验证流程就像以前预期的那样工作了。
如果我重新安装node_modules并尝试从okta登录,我将得到以下错误:
Error: SAMLResponse is not valid base64-encoded XML
at SAML.validatePostResponseAsync (/opt/apache-tomcat-8.5.82/raptor-management-ui/node_modules/passport-saml/lib/node-saml/saml.js:562:23)
at MultiSamlStrategy.authenticate (/opt/apache-tomcat-8.5.82/raptor-management-ui/node_modules/passport-saml/lib/passport-saml/strategy.js:80:18)
at /opt/apache-tomcat-8.5.82/raptor-management-ui/node_modules/passport-saml/lib/passport-saml/multiSamlStrategy.js:28:32
at fetchSamlConfig (/opt/apache-tomcat-8.5.82/raptor-management-ui/routes/api-config/passport.js:31:14)
at Object.getSamlOptions (/opt/apache-tomcat-8.5.82/raptor-management-ui/routes/api-config/passport.js:37:9)
at MultiSamlStrategy.authenticate (/opt/apache-tomcat-8.5.82/raptor-management-ui/node_modules/passport-saml/lib/passport-saml/multiSamlStrategy.js:21:23)
at attempt (/opt/apache-tomcat-8.5.82/raptor-management-ui/node_modules/passport/lib/middleware/authenticate.js:348:16)
at authenticate (/opt/apache-tomcat-8.5.82/raptor-management-ui/node_modules/passport/lib/middleware/authenticate.js:349:7)
at /opt/apache-tomcat-8.5.82/raptor-management-ui/node_modules/newrelic/lib/shim/shim.js:1313:22
at LegacyContextManager.runInContext (/opt/apache-tomcat-8.5.82/raptor-management-ui/node_modules/newrelic/lib/context-manager/legacy-context-manager.js:59:23)
at WebFrameworkShim.applySegment (/opt/apache-tomcat-8.5.82/raptor-management-ui/node_modules/newrelic/lib/shim/shim.js:1303:25)
at _applyRecorderSegment (/opt/apache-tomcat-8.5.82/raptor-management-ui/node_modules/newrelic/lib/shim/shim.js:934:20)
at _doRecord (/opt/apache-tomcat-8.5.82/raptor-management-ui/node_modules/newrelic/lib/shim/shim.js:907:17)
at authenticate (/opt/apache-tomcat-8.5.82/raptor-management-ui/node_modules/newrelic/lib/shim/shim.js:867:24)
at Layer.handle [as handle_request] (/opt/apache-tomcat-8.5.82/raptor-management-ui/node_modules/express/lib/router/layer.js:95:5)
at next (/opt/apache-tomcat-8.5.82/raptor-management-ui/node_modules/express/lib/router/route.js:137:13)对于15天前安装了node_modules的旧版本,它可以正常工作,没有任何问题。在我的回购中没有代码更改,也没有包更新。就如何解决这一问题提供任何帮助。
我试过升级上面提到的所有软件包。但这并没有解决issue.There 7天前在@xmldom/xmldom中进行新版本升级的问题,这可能会导致问题。我不知道如何避免这个问题,因为@xmldom/xmldom是passport本身的依赖项。
发布于 2022-11-08 17:14:15
修正了这个问题,将@xmldom/xmldom作为直接依赖项添加到最后一个工作版本中,并将passport和护照包修复。
我更新的package.json包括:
"@xmldom/xmldom": "0.7.6",
"passport": "0.3.2",
"passport-saml": "3.2.3",在进行这些更改后,删除node_modules并再次进行npm安装。
https://stackoverflow.com/questions/74349005
复制相似问题