本文整理汇总了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;
}
示例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;
}
示例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");
}
}