本文整理匯總了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");
}
}