我正在尝试将SAML与ColdFusion 10 Standard集成。我正在使用https://github.com/anthony-id/cfSAML
中的示例代码问题是我在
时不断收到java.lang.NullPointerExceptionvar transforms = variables.TransformsClass.init(assertionNode.item(0).getOwnerDocument());
已执行。
非常感谢任何帮助。
<cffunction name="signSAML" output="false" access="private">
<cfargument name="samlAssert">
<cfargument name="assertionId">
<cfscript>
var samlAssertionXML = arguments.samlAssert;
//injest the xml
writedump(samlAssertionXML);
var samlAssertionElement = samlAssertionXML.getDocumentElement();
var samlAssertionDocument = samlAssertionElement.GetOwnerDocument();
var samlAssertion = samlAssertionDocument.getFirstChild();
var conditionsNode = samlAssertionElement.getElementsByTagName('saml:Conditions');
var assertionNode = samlAssertionElement.getElementsByTagName('saml:Assertion');
var statusNode = samlAssertionElement.getElementsByTagName('samlp:Status');
var signature = getSignature(samlAssertionDocument);
//set up signature transforms
var transforms = variables.TransformsClass.init(assertionNode.item(0).getOwnerDocument());
abort;
transforms.addTransform(variables.transformEnvStr);
transforms.addTransform(variables.transformOmitCommentsStr);
switch(getSAMLVersion()) {
case "1":
// Insert signature before statusNode
samlAssertion.insertBefore(signature.getElement(),statusNode.item(0));
break;
default:
// Insert signature AFTER issuer node
assertionNode.item(0).insertBefore(signature.getElement(),conditionsNode.item(0));
break;
}
//set up the signature
signature.addDocument("###arguments.assertionId#",transforms);
//optionally include the cert and public key
signature.addKeyInfo(getKeystore().getCert());
signature.addKeyInfo(getKeystore().getPublickey());
signature.sign(getKeystore().getPrivateKey());
return samlAssertionXML;
</cfscript>
</cffunction>
下面是StackTrace:
java.lang.NullPointerException at org.apache.xml.security.transforms.Transform.getImplementingClass(未知 来自org.apache.xml.security.transforms.Transform。(未知 来源)at org.apache.xml.security.transforms.Transform.getInstance(未知 来源)at org.apache.xml.security.transforms.Transform.getInstance(未知 来源)at org.apache.xml.security.transforms.Transforms.addTransform(未知 来源)sun.reflect.GeneratedMethodAccessor114.invoke(未知 来源)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 在java.lang.reflect.Method.invoke(Method.java:601)at coldfusion.runtime.StructBean.invoke(StructBean.java:508)at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2465)at at cfSAMLService2ecfc133932769 $ funcSIGNSAML.runFunction(C:\ ColdFusion10 \ cfusion \ wwwroot的\ PPNPFTEST \ SAMLTEST \ COM \ SAMLService.cfc:211) 在coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472)at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47)at coldfusion.runtime.UDFMethod $ ArgumentCollectionFilter.invoke(UDFMethod.java:368) 在 coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55) 在coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220)at at coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:2659)at at cfSAMLService2ecfc133932769 $ funcGETSAML.runFunction(C:\ ColdFusion10 \ cfusion \ wwwroot的\ PPNPFTEST \ SAMLTEST \ COM \ SAMLService.cfc:56) 在coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:472)at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:47)at coldfusion.runtime.UDFMethod $ ArgumentCollectionFilter.invoke(UDFMethod.java:368) 在 coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55) 在coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220)at at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:655)at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:444)at coldfusion.runtime.TemplateProxy.invoke(TemplateProxy.java:414)at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2432)at at cftest2ecfm775253356.runPage(C:\ ColdFusion10 \ cfusion \ wwwroot的\ PPNPFTEST \ SAMLTEST \ test.cfm:18) 在coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:244)at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:444)at at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65)at coldfusion.filter.IpFilter.invoke(IpFilter.java:64)at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:443) 在 coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48) at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40) 在coldfusion.filter.PathFilter.invoke(PathFilter.java:112)at coldfusion.filter.LicenseFilter.invoke(LicenseFilter.java:30)at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:94)at coldfusion.filter.BrowserDebugFilter.invoke(BrowserDebugFilter.java:79) 在 coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28) 在coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38)at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:46)at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)at at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)at at coldfusion.filter.CachingFilter.invoke(CachingFilter.java:62)at coldfusion.CfmServlet.service(CfmServlet.java:204)at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89) 在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) 在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) 在 coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42) 在 coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46) 在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) 在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) 在 org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224) 在 org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169) 在 org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) 在 org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168) 在 org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98) 在 org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:928) 在 org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) 在 org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:414) 在 org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987) 在 org.apache.coyote.AbstractProtocol $ AbstractConnectionHandler.process(AbstractProtocol.java:539) 在 org.apache.tomcat.util.net.JIoEndpoint $ SocketProcessor.run(JIoEndpoint.java:298) 在 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) 在 java.util.concurrent.ThreadPoolExecutor中的$ Worker.run(ThreadPoolExecutor.java:615) 在java.lang.Thread.run(Thread.java:722)
这是转储assertionNode.item(0).getOwnerDoument()时返回的内容