• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SAMLObjectBuilder类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.opensaml.saml.common.SAMLObjectBuilder的典型用法代码示例。如果您正苦于以下问题:Java SAMLObjectBuilder类的具体用法?Java SAMLObjectBuilder怎么用?Java SAMLObjectBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SAMLObjectBuilder类属于org.opensaml.saml.common包,在下文中一共展示了SAMLObjectBuilder类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: buildEntityDescriptor

import org.opensaml.saml.common.SAMLObjectBuilder; //导入依赖的package包/类
@Override
public final EntityDescriptor buildEntityDescriptor() {
    final SAMLObjectBuilder<EntityDescriptor> builder = (
            SAMLObjectBuilder<EntityDescriptor>) this.builderFactory
            .getBuilder(EntityDescriptor.DEFAULT_ELEMENT_NAME);

    final EntityDescriptor descriptor = builder.buildObject();
    descriptor.setEntityID(this.entityId);
    descriptor.setValidUntil(DateTime.now().plusYears(20));
    descriptor.setID(generateEntityDescriptorId());
    descriptor.setExtensions(generateMetadataExtensions());
    descriptor.getRoleDescriptors().add(buildSPSSODescriptor());

    return descriptor;

}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:17,代码来源:SAML2MetadataGenerator.java


示例2: buildNameIDFormat

import org.opensaml.saml.common.SAMLObjectBuilder; //导入依赖的package包/类
protected final Collection<NameIDFormat> buildNameIDFormat() {

        final SAMLObjectBuilder<NameIDFormat> builder = (SAMLObjectBuilder<NameIDFormat>) this.builderFactory
                .getBuilder(NameIDFormat.DEFAULT_ELEMENT_NAME);
        final Collection<NameIDFormat> formats = new LinkedList<NameIDFormat>();
        final NameIDFormat transientNameID = builder.buildObject();
        transientNameID.setFormat(NameIDType.TRANSIENT);
        formats.add(transientNameID);
        final NameIDFormat persistentNameID = builder.buildObject();
        persistentNameID.setFormat(NameIDType.PERSISTENT);
        formats.add(persistentNameID);
        final NameIDFormat emailNameID = builder.buildObject();
        emailNameID.setFormat(NameIDType.EMAIL);
        formats.add(emailNameID);
        final NameIDFormat unspecNameID = builder.buildObject();
        unspecNameID.setFormat(NameIDType.UNSPECIFIED);
        formats.add(unspecNameID);
        return formats;
    }
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:20,代码来源:SAML2MetadataGenerator.java


示例3: newSamlObject

import org.opensaml.saml.common.SAMLObjectBuilder; //导入依赖的package包/类
/**
 * Create a new SAML object.
 *
 * @param <T> the generic type
 * @param objectType the object type
 * @return the t
 */
public final <T extends SAMLObject> T newSamlObject(final Class<T> objectType) {
    final QName qName = getSamlObjectQName(objectType);
    final SAMLObjectBuilder<T> builder = (SAMLObjectBuilder<T>)
            XMLObjectProviderRegistrySupport.getBuilderFactory().getBuilder(qName);
    if (builder == null) {
        throw new IllegalStateException("No SAMLObjectBuilder registered for class " + objectType.getName());
    }
    return objectType.cast(builder.buildObject(qName));
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:17,代码来源:AbstractSamlObjectBuilder.java


示例4: newSamlObject

import org.opensaml.saml.common.SAMLObjectBuilder; //导入依赖的package包/类
/**
 * Create a new SAML object.
 *
 * @param <T>        the generic type
 * @param objectType the object type
 * @return the t
 */
public <T extends SAMLObject> T newSamlObject(final Class<T> objectType) {
    final QName qName = getSamlObjectQName(objectType);
    final SAMLObjectBuilder<T> builder = (SAMLObjectBuilder<T>)
            XMLObjectProviderRegistrySupport.getBuilderFactory().getBuilder(qName);
    if (builder == null) {
        throw new IllegalStateException("No SAML object builder is registered for class " + objectType.getName());
    }
    return objectType.cast(builder.buildObject(qName));
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:17,代码来源:AbstractSamlObjectBuilder.java


示例5: getAssertionConsumerService

import org.opensaml.saml.common.SAMLObjectBuilder; //导入依赖的package包/类
protected final AssertionConsumerService getAssertionConsumerService(final String binding, final int index,
                                                                     final boolean isDefault) {
    final SAMLObjectBuilder<AssertionConsumerService> builder = (SAMLObjectBuilder<AssertionConsumerService>) this.builderFactory
            .getBuilder(AssertionConsumerService.DEFAULT_ELEMENT_NAME);
    final AssertionConsumerService consumer = builder.buildObject();
    consumer.setLocation(this.assertionConsumerServiceUrl);
    consumer.setBinding(binding);
    if (isDefault) {
        consumer.setIsDefault(true);
    }
    consumer.setIndex(index);
    return consumer;
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:14,代码来源:SAML2MetadataGenerator.java


示例6: getSingleLogoutService

import org.opensaml.saml.common.SAMLObjectBuilder; //导入依赖的package包/类
protected SingleLogoutService getSingleLogoutService(final String binding) {
    final SAMLObjectBuilder<SingleLogoutService> builder = (SAMLObjectBuilder<SingleLogoutService>) this.builderFactory
            .getBuilder(SingleLogoutService.DEFAULT_ELEMENT_NAME);
    final SingleLogoutService logoutService = builder.buildObject();
    logoutService.setLocation(this.singleLogoutServiceUrl);
    logoutService.setBinding(binding);
    return logoutService;
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:9,代码来源:SAML2MetadataGenerator.java


示例7: getKeyDescriptor

import org.opensaml.saml.common.SAMLObjectBuilder; //导入依赖的package包/类
protected final KeyDescriptor getKeyDescriptor(final UsageType type, final KeyInfo key) {
    final SAMLObjectBuilder<KeyDescriptor> builder = (SAMLObjectBuilder<KeyDescriptor>)
            Configuration.getBuilderFactory()
            .getBuilder(KeyDescriptor.DEFAULT_ELEMENT_NAME);
    final KeyDescriptor descriptor = builder.buildObject();
    descriptor.setUse(type);
    descriptor.setKeyInfo(key);
    return descriptor;
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:10,代码来源:SAML2MetadataGenerator.java


示例8: getIssuer

import org.opensaml.saml.common.SAMLObjectBuilder; //导入依赖的package包/类
@SuppressWarnings("unchecked")
protected final Issuer getIssuer(final String spEntityId) {
    final SAMLObjectBuilder<Issuer> issuerBuilder = (SAMLObjectBuilder<Issuer>) this.builderFactory
            .getBuilder(Issuer.DEFAULT_ELEMENT_NAME);
    final Issuer issuer = issuerBuilder.buildObject();
    issuer.setValue(spEntityId);
    return issuer;
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:9,代码来源:SAML2AuthnRequestBuilder.java


示例9: generateMetadataExtensions

import org.opensaml.saml.common.SAMLObjectBuilder; //导入依赖的package包/类
protected final Extensions generateMetadataExtensions() {

        final SAMLObjectBuilder<Extensions> builderExt =
                (SAMLObjectBuilder<Extensions>) this.builderFactory
                        .getBuilder(Extensions.DEFAULT_ELEMENT_NAME);

        final Extensions extensions = builderExt.buildObject();
        extensions.getNamespaceManager().registerAttributeName(DigestMethod.TYPE_NAME);

        final SAMLObjectBuilder<DigestMethod> builder =
                (SAMLObjectBuilder<DigestMethod>) this.builderFactory
                .getBuilder(DigestMethod.DEFAULT_ELEMENT_NAME);

        DigestMethod method = builder.buildObject();
        method.setAlgorithm("http://www.w3.org/2001/04/xmlenc#sha512");
        extensions.getUnknownXMLObjects().add(method);

        method = builder.buildObject();
        method.setAlgorithm("http://www.w3.org/2001/04/xmldsig-more#sha384");
        extensions.getUnknownXMLObjects().add(method);

        method = builder.buildObject();
        method.setAlgorithm("http://www.w3.org/2001/04/xmlenc#sha256");
        extensions.getUnknownXMLObjects().add(method);

        method = builder.buildObject();
        method.setAlgorithm("http://www.w3.org/2001/04/xmldsig-more#sha224");
        extensions.getUnknownXMLObjects().add(method);

        method = builder.buildObject();
        method.setAlgorithm("http://www.w3.org/2000/09/xmldsig#sha1");
        extensions.getUnknownXMLObjects().add(method);

        method = builder.buildObject();
        method.setAlgorithm("http://www.w3.org/2001/04/xmldsig-more#rsa-sha512");
        extensions.getUnknownXMLObjects().add(method);

        method = builder.buildObject();
        method.setAlgorithm("http://www.w3.org/2001/04/xmldsig-more#rsa-sha384");
        extensions.getUnknownXMLObjects().add(method);

        method = builder.buildObject();
        method.setAlgorithm("http://www.w3.org/2001/04/xmldsig-more#rsa-sha256");
        extensions.getUnknownXMLObjects().add(method);

        method = builder.buildObject();
        method.setAlgorithm("http://www.w3.org/2000/09/xmldsig#rsa-sha1");
        extensions.getUnknownXMLObjects().add(method);

        method = builder.buildObject();
        method.setAlgorithm("http://www.w3.org/2000/09/xmldsig#dsa-sha1");
        extensions.getUnknownXMLObjects().add(method);

        return extensions;
    }
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:56,代码来源:SAML2MetadataGenerator.java


示例10: buildSPSSODescriptor

import org.opensaml.saml.common.SAMLObjectBuilder; //导入依赖的package包/类
protected final SPSSODescriptor buildSPSSODescriptor() {
    final SAMLObjectBuilder<SPSSODescriptor> builder = (SAMLObjectBuilder<SPSSODescriptor>) this.builderFactory
            .getBuilder(SPSSODescriptor.DEFAULT_ELEMENT_NAME);
    final SPSSODescriptor spDescriptor = builder.buildObject();

    spDescriptor.setAuthnRequestsSigned(this.authnRequestSigned);
    spDescriptor.setWantAssertionsSigned(this.wantAssertionSigned);
    spDescriptor.addSupportedProtocol(SAMLConstants.SAML20P_NS);
    spDescriptor.addSupportedProtocol(SAMLConstants.SAML10P_NS);
    spDescriptor.addSupportedProtocol(SAMLConstants.SAML11P_NS);

    final SAMLObjectBuilder<Extensions> builderExt =
            (SAMLObjectBuilder<Extensions>) this.builderFactory
                    .getBuilder(Extensions.DEFAULT_ELEMENT_NAME);

    final Extensions extensions = builderExt.buildObject();
    extensions.getNamespaceManager().registerAttributeName(RequestInitiator.DEFAULT_ELEMENT_NAME);

    final SAMLObjectBuilder<RequestInitiator> builderReq =
            (SAMLObjectBuilder<RequestInitiator>) this.builderFactory
                    .getBuilder(RequestInitiator.DEFAULT_ELEMENT_NAME);

    final RequestInitiator requestInitiator = builderReq.buildObject();
    requestInitiator.setLocation(this.requestInitiatorLocation);
    requestInitiator.setBinding(RequestInitiator.DEFAULT_ELEMENT_NAME.getNamespaceURI());

    extensions.getUnknownXMLObjects().add(requestInitiator);
    spDescriptor.setExtensions(extensions);

    spDescriptor.getNameIDFormats().addAll(buildNameIDFormat());

    int index = 0;
    spDescriptor.getAssertionConsumerServices().add(
            getAssertionConsumerService(SAMLConstants.SAML2_POST_BINDING_URI, index++,
                    this.defaultACSIndex == index));

    if (credentialProvider != null) {
        spDescriptor.getKeyDescriptors().add(getKeyDescriptor(UsageType.SIGNING,
                this.credentialProvider.getKeyInfo()));
        spDescriptor.getKeyDescriptors().add(getKeyDescriptor(UsageType.ENCRYPTION,
                this.credentialProvider.getKeyInfo()));
    }

    return spDescriptor;

}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:47,代码来源:SAML2MetadataGenerator.java


示例11: buildAuthnRequest

import org.opensaml.saml.common.SAMLObjectBuilder; //导入依赖的package包/类
@SuppressWarnings("unchecked")
protected final AuthnRequest buildAuthnRequest(final SAML2MessageContext context,
                                               final AssertionConsumerService assertionConsumerService, final SingleSignOnService ssoService) {

    final SAMLObjectBuilder<AuthnRequest> builder = (SAMLObjectBuilder<AuthnRequest>) this.builderFactory
            .getBuilder(AuthnRequest.DEFAULT_ELEMENT_NAME);
    final AuthnRequest request = builder.buildObject();
    if (comparisonType != null) {
        final RequestedAuthnContext authnContext = new RequestedAuthnContextBuilder().buildObject();
        authnContext.setComparison(comparisonType);

        if (authnContextClassRef != null) {
            final AuthnContextClassRef classRef = new AuthnContextClassRefBuilder().buildObject();
            classRef.setAuthnContextClassRef(authnContextClassRef);
            authnContext.getAuthnContextClassRefs().add(classRef);
        }
        request.setRequestedAuthnContext(authnContext);
    }

    final SAMLSelfEntityContext selfContext = context.getSAMLSelfEntityContext();

    request.setID(generateID());
    request.setIssuer(getIssuer(selfContext.getEntityId()));
    request.setIssueInstant(DateTime.now().plusSeconds(this.issueInstantSkewSeconds));
    request.setVersion(SAMLVersion.VERSION_20);
    request.setIsPassive(false);
    request.setForceAuthn(this.forceAuth);
    request.setProviderName("pac4j-saml");

    if (nameIdPolicyFormat != null) {
        final NameIDPolicy nameIdPolicy = new NameIDPolicyBuilder().buildObject();
        nameIdPolicy.setAllowCreate(true);
        nameIdPolicy.setFormat(nameIdPolicyFormat);
        request.setNameIDPolicy(nameIdPolicy);
    }

    request.setDestination(ssoService.getLocation());
    request.setAssertionConsumerServiceURL(assertionConsumerService.getLocation());
    request.setProtocolBinding(assertionConsumerService.getBinding());
    return request;
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:42,代码来源:SAML2AuthnRequestBuilder.java


示例12: newSAMLObject

import org.opensaml.saml.common.SAMLObjectBuilder; //导入依赖的package包/类
protected static <T extends SAMLObject> T newSAMLObject(final Class<T> type, final QName elementName) {
    final SAMLObjectBuilder<T> builder = (SAMLObjectBuilder<T>)
            XMLObjectProviderRegistrySupport.getBuilderFactory().<T>getBuilderOrThrow(elementName);
    return builder.buildObject();
}
 
开发者ID:serac,项目名称:shibboleth-idp-ext-cas,代码行数:6,代码来源:AbstractOutgoingSamlMessageAction.java



注:本文中的org.opensaml.saml.common.SAMLObjectBuilder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java HSLFSlide类代码示例发布时间:2022-05-23
下一篇:
Java JSONValue类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap