当前位置: 首页>>代码示例>>Java>>正文


Java AbstractSAML2Artifact类代码示例

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


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

示例1: buildArtifact

import org.opensaml.saml2.binding.artifact.AbstractSAML2Artifact; //导入依赖的package包/类
/**
 * Builds the SAML 2 artifact for the outgoing message.
 * 
 * @param artifactContext current request context
 * 
 * @return SAML 2 artifact for outgoing message
 * 
 * @throws MessageEncodingException thrown if the artifact can not be created
 */
protected AbstractSAML2Artifact buildArtifact(SAMLMessageContext artifactContext) throws MessageEncodingException {

    SAML2ArtifactBuilder artifactBuilder;
    if (artifactContext.getOutboundMessageArtifactType() != null) {
        artifactBuilder = Configuration.getSAML2ArtifactBuilderFactory().getArtifactBuilder(
                artifactContext.getOutboundMessageArtifactType());
    } else {
        artifactBuilder = Configuration.getSAML2ArtifactBuilderFactory().getArtifactBuilder(defaultArtifactType);
        artifactContext.setOutboundMessageArtifactType(defaultArtifactType);
    }

    AbstractSAML2Artifact artifact = artifactBuilder.buildArtifact(artifactContext);
    String encodedArtifact = artifact.base64Encode();
    try {
        artifactMap.put(encodedArtifact, artifactContext.getInboundMessageIssuer(), artifactContext
                .getOutboundMessageIssuer(), artifactContext.getOutboundSAMLMessage());
    } catch (MarshallingException e) {
        log.error("Unable to marshall assertion to be represented as an artifact", e);
        throw new MessageEncodingException("Unable to marshall assertion to be represented as an artifact", e);
    }

    return artifact;
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:33,代码来源:HTTPArtifactEncoder.java

示例2: buildArtifact

import org.opensaml.saml2.binding.artifact.AbstractSAML2Artifact; //导入依赖的package包/类
/**
 * Builds the SAML 2 artifact for the outgoing message.
 * 
 * @param artifactContext current request context
 * 
 * @return SAML 2 artifact for outgoing message
 * 
 * @throws MessageEncodingException thrown if the artifact can not be created
 */
protected AbstractSAML2Artifact buildArtifact(SAMLMessageContext artifactContext) throws MessageEncodingException {

    SAML2ArtifactBuilder artifactBuilder;
    if (artifactContext.getOutboundMessageArtifactType() != null) {
        artifactBuilder = Configuration.getSAML2ArtifactBuilderFactory().getArtifactBuilder(
                artifactContext.getOutboundMessageArtifactType());
    } else {
        artifactBuilder = Configuration.getSAML2ArtifactBuilderFactory().getArtifactBuilder(defaultArtifactType);
        artifactContext.setOutboundMessageArtifactType(defaultArtifactType);
    }

    AbstractSAML2Artifact artifact = artifactBuilder.buildArtifact(artifactContext);
    if(artifact == null){
        log.error("Unable to build artifact for message to relying party");
        throw new MessageEncodingException("Unable to builder artifact for message to relying party");
    }
    String encodedArtifact = artifact.base64Encode();
    try {
        artifactMap.put(encodedArtifact, artifactContext.getInboundMessageIssuer(), artifactContext
                .getOutboundMessageIssuer(), artifactContext.getOutboundSAMLMessage());
    } catch (MarshallingException e) {
        log.error("Unable to marshall assertion to be represented as an artifact", e);
        throw new MessageEncodingException("Unable to marshall assertion to be represented as an artifact", e);
    }

    return artifact;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:37,代码来源:HTTPArtifactEncoder.java

示例3: decodeArtifact

import org.opensaml.saml2.binding.artifact.AbstractSAML2Artifact; //导入依赖的package包/类
/**
   * Decode the SAML artifact
   * @param samlArt The base64 encoded SAML artifact
   * @return The decoded SAML artifact
   * @throws BindingException If the SAML artifact is not valid
   */
  private SAML2ArtifactType0004 decodeArtifact(String samlArt) throws BindingException {
byte[] artifactBytes = Base64.decode(samlArt);
AbstractSAML2Artifact artifact = artifactFactory.buildArtifact(artifactBytes);
if (artifact instanceof SAML2ArtifactType0004) {
	return (SAML2ArtifactType0004) artifact;
} else {
	throw new BindingException("The artifact is not of the expected type: SAML2ArtifactType004");
}
  }
 
开发者ID:amagdenko,项目名称:oiosaml.java,代码行数:16,代码来源:BRSArtifact.java


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