當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。