java - 在 ColdFusion 中使用 OneLogin 实现 SAML 时抛出错误
问题描述
作为学习如何在我的 ColdFusion 应用程序中集成 OneLogin SSO 的一部分,我提取了这个 git 存储库 - https://github.com/GiancarloGomez/ColdFusion-OneLogin并在本地设置。但是,在向 OneLogin 发送身份验证请求时,我们收到一条错误消息:“我们很抱歉,但出了点问题。我们已收到有关此问题的通知,我们会尽快查看。 ”
我找不到这个问题的根本原因。感谢您在这方面的及时帮助。
OneLogin 上的配置如下所示。请注意,我将消费者 URL 修改为http://127.0.0.1:8500/coldfusion-onelogin/consume.cfm而不是YouTube中提到的实际格式 ( http://127.0.0.1:8500/coldfusion-onelogin/consume/ )此 git repo 的自述文件中提供的视频。我曾尝试将消费者 URL 格式更改为http://127.0.0.1:8500/coldfusion-onelogin/consume/但我们仍然收到错误消息。
OneLogin 中的访问选项卡如下所示,
下面是向 OneLogin 发送身份验证请求的代码。
<cfscript>
try{
// used to encode string - chose to use Java version just in case CF did not encode correctly
// encodeForURL appears to work but to keep the same as the samples from OneLogin I will use the Java reference
urlEncoder = createObject("java","java.net.URLEncoder");
// the appSettings object contain application specific settings used by the SAML library
appSettings = createObject("java","com.onelogin.AppSettings");
// set the URL of the consume file for this app. The SAML Response will be posted to this URL
appSettings.setAssertionConsumerServiceUrl(request.company.getConsumeUrl());
// set the issuer of the authentication request. This would usually be the URL of the issuing web application
appSettings.setIssuer(request.company.getIssuerUrl());
// the accSettings object contains settings specific to the users account.
accSettings = createObject("java","com.onelogin.AccountSettings");
// The URL at the Identity Provider where to the authentication request should be sent
accSettings.setIdpSsoTargetUrl("https://app.onelogin.com/saml/signon/" & request.company.getIssuerID());
// Generate an AuthRequest and send it to the identity provider
authReq = createObject("java","com.onelogin.saml.AuthRequest").init(appSettings, accSettings);
// now send to one login
location ( accSettings.getIdp_sso_target_url() & "?SAMLRequest=" & authReq.getRidOfCRLF(urlEncoder.encode(authReq.getRequest(authReq.base64),"UTF-8")), false);
}
catch(Any e){
writeDump(e);
}
</cfscript>
下面是 auth request URL 的格式,
https://app.onelogin.com/saml/signon/[issuerId]?SAMLRequest=[SamlRequest]。
我没有在这里提供实际的 URL,因为我不确定是否有人可以篡改它。但请让我们知道是否真的需要解决这个问题。
下面是 SAML 登录页面的屏幕截图,从这里我单击按钮并将身份验证请求发送到 OneLogin。
此外,在 index.cfm 中,表单操作属性是“/post/”。由于它抛出错误,我不得不用“/coldfusion-onelogin/post.cfm”替换它。这里coldfusion-onelogin是wwwroot下的一个文件夹。ColdFusion 中的任何设置都需要修改,这样如果我们将表单操作属性保持为“/post/”,它就不会抛出任何错误?
解决方案
推荐阅读
- python - Pandas:如何返回列在其单元格中有换行符/换行符( \n )的行?
- ios - 我怎么知道我是否连接到雪佛兰汽车上的 carplay
- c# - 更新 google firestore 数据库的任务未完成
- c++ - 渲染大量文本时如何提高 DirectWrite 性能?
- javascript - 无法访问linux服务器上的构建
- android - 以编程方式将视图添加到布局是否会节省应用程序空间(兆字节)与手动制作布局?
- reactjs - 将文件上传到 SharePoint Online 文档库时如何触发“自定义电子邮件”?
- webpack - 需要来自 HTML 中的 Webpack 包中的模块
- c# - 从数据库中进行关键字搜索编程?
- elixir - Dialyzer 发出类型规范是成功键入多个同名函数的子类型