本文整理汇总了Java中org.opensaml.xml.signature.ContentReference类的典型用法代码示例。如果您正苦于以下问题:Java ContentReference类的具体用法?Java ContentReference怎么用?Java ContentReference使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ContentReference类属于org.opensaml.xml.signature包,在下文中一共展示了ContentReference类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: declareNonVisibleNamespaces
import org.opensaml.xml.signature.ContentReference; //导入依赖的package包/类
/**
* Examines the {@link SignableSAMLObject} for the need to declare non-visible namespaces
* before marshalling and signing, and if required, performs the declarations.
*
* <p>
* If the object does not already have a cached DOM, does have a signature attached,
* and the signature contains a {@link SAMLObjectContentReference} with a transform of either
* {@link SignatureConstants#TRANSFORM_C14N_EXCL_OMIT_COMMENTS}
* or {@link SignatureConstants#TRANSFORM_C14N_EXCL_WITH_COMMENTS},
* it declares on the object all non-visible namespaces
* as determined by {@link NamespaceManager#getNonVisibleNamespaces()}.
* </p>
*
* @param signableObject the signable SAML object to evaluate
*/
public static void declareNonVisibleNamespaces(SignableSAMLObject signableObject) {
Logger log = getLogger();
if (signableObject.getDOM() == null && signableObject.getSignature() != null) {
log.debug("Examing signed object for content references with exclusive canonicalization transform");
boolean sawExclusive = false;
for (ContentReference cr : signableObject.getSignature().getContentReferences()) {
if (cr instanceof SAMLObjectContentReference) {
List<String> transforms = ((SAMLObjectContentReference)cr).getTransforms();
if (transforms.contains(SignatureConstants.TRANSFORM_C14N_EXCL_WITH_COMMENTS)
|| transforms.contains(SignatureConstants.TRANSFORM_C14N_EXCL_OMIT_COMMENTS)) {
sawExclusive = true;
break;
}
}
}
if (sawExclusive) {
log.debug("Saw exclusive transform, declaring non-visible namespaces on signed object");
for (Namespace ns : signableObject.getNamespaceManager().getNonVisibleNamespaces()) {
signableObject.getNamespaceManager().registerNamespaceDeclaration(ns);
}
}
}
}
示例2: getContentReferences
import org.opensaml.xml.signature.ContentReference; //导入依赖的package包/类
/** {@inheritDoc} */
public List<ContentReference> getContentReferences() {
// TODO worry about detecting changes and releasing this object's and parent's DOM?
// would need something like an Observable list/collection impl or something similar
return contentReferences;
}
示例3: SignatureImpl
import org.opensaml.xml.signature.ContentReference; //导入依赖的package包/类
/**
* Constructor.
*
* @param namespaceURI the namespace the element is in
* @param elementLocalName the local name of the XML element this Object represents
* @param namespacePrefix the prefix for the given namespace
*/
protected SignatureImpl(String namespaceURI, String elementLocalName, String namespacePrefix) {
super(namespaceURI, elementLocalName, namespacePrefix);
contentReferences = new LinkedList<ContentReference>();
}