【问题标题】:Adding SSOProfiles in spring-security using opensaml library使用 opensaml 库在 spring-security 中添加 SSOProfile
【发布时间】: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


【解决方案1】:

【讨论】:

  • @Bean public WebSSOProfileOptions defaultWebSSOProfileOptions() { WebSSOProfileOptions webSSOProfileOptions = new WebSSOProfileOptions(); webSSOProfileOptions.setIncludeScoping(false);返回 webSSOProfileOptions; } 看到这是使用默认选项我想添加 xacml 的 saml 配置文件,这就是为什么我试图覆盖这个方法。但不明白怎么做
猜你喜欢
  • 2019-11-15
  • 2011-01-14
  • 2013-12-28
  • 2018-07-02
  • 2020-09-12
  • 2011-09-19
  • 2013-09-12
  • 2014-03-07
  • 1970-01-01
相关资源
最近更新 更多