【发布时间】:2016-05-19 15:05:59
【问题描述】:
我正在学习 SAML 实现,我浏览了 spring-security saml 示例,目前由于默认情况下正在生成 AuthRequest,我正在尝试自定义我的 authRequest。
我一直在浏览 opensaml 库并尝试实现 WebSSOProfilesImpl 类,在 getAuthnRequest() 中我实现了以下代码。
protected AuthnRequest getAuthnRequest(SAMLMessageContext context, WebSSOProfileOptions options,
AssertionConsumerService assertionConsumer,
SingleSignOnService bindingService) throws SAMLException, MetadataProviderException {
SAMLObjectBuilder<AuthnRequest> builder =
(SAMLObjectBuilder<AuthnRequest>) builderFactory.getBuilder
(new QName("urn:oasis:names:tc:xacml:3.0:profile:saml2.0:v2:schema:protocol:wd-13", "XACMLAuthzDecisionQueryType",
"xacml-samlp"));
System.out.println("Builder : "+builder.toString()+" "+builder);
AuthnRequest request = builder.buildObject();
System.out.println("request : "+request.toString());
request.setIsPassive(options.getPassive());
request.setForceAuthn(options.getForceAuthN());
request.setProviderName(options.getProviderName());
request.setVersion(SAMLVersion.VERSION_20);
buildCommonAttributes(context.getLocalEntityId(), request, bindingService);
buildScoping(request, bindingService, options);
builNameIDPolicy(request, options);
buildAuthnContext(request, options);
buildReturnAddress(request, assertionConsumer);
return request;
}
但是在登录到我作为 IDP 使用的 IS 时,我在 SAMLObjectBuilder 对象中收到 NullPointerException。我做错什么了吗??请帮助,非常感谢任何帮助!!!!
注意: 我在 QName 中传递的值是我想要给出的值,我可以遵循 XACML-SAML 决策查询用例。
【问题讨论】:
-
嗨,你给 DefaultBootstrap.bootstrap() 打过电话了吗?
-
我以前见过但不知道具体在哪里实现
标签: authentication saml saml-2.0 wso2is opensaml