作为学习如何在我的ColdFusion应用程序中集成OneLogin SSO的一部分,我拉了这个git repo-https://github.com/GiancarloGomez/ColdFusion-OneLogin并在本地设置。但是,在将身份验证请求发送到OneLogin时,我们收到一条错误消息,内容为“ 很抱歉,出了点问题。我们已收到有关此问题的通知,我们将尽快对其进行查看。“
我找不到此问题的根本原因。感谢您的及时帮助。
OneLogin上的配置如下所示。请注意,我将消费者URL修改为http://127.0.0.1:8500/coldfusion-onelogin/consume.cfm,而不是此git repo自述文件中提供的YouTube视频中提到的实际格式(http://127.0.0.1:8500/coldfusion-onelogin/consume/)。我曾尝试将使用者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>
下面是身份验证请求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 /”?。],则不会引发任何错误。
嗯。使用者URL验证程序应该是正则表达式,但我不确定它如何处理文字HTTP值(因为它将尝试将其评估为正则表达式)
因此,请尝试将URL验证程序更改为类似*.
(匹配所有内容)的愚蠢选项>>
希望这样可以清除错误,直到您可以确定要在生产中进行的验证为止。