本文整理汇总了Java中org.opensaml.xml.parse.BasicParserPool类的典型用法代码示例。如果您正苦于以下问题:Java BasicParserPool类的具体用法?Java BasicParserPool怎么用?Java BasicParserPool使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BasicParserPool类属于org.opensaml.xml.parse包,在下文中一共展示了BasicParserPool类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: XMLConfigurator
import org.opensaml.xml.parse.BasicParserPool; //导入依赖的package包/类
/**
* Constructor.
*
* @param retainXML whether to retain the XML configuration elements within the {@link Configuration}.
*
* @throws ConfigurationException thrown if the validation schema for configuration files can not be created
*
* @deprecated this method will be removed once {@link Configuration} no longer has the option to store the XML configuration fragements
*/
public XMLConfigurator(boolean retainXML) throws ConfigurationException {
retainXMLConfiguration = retainXML;
parserPool = new BasicParserPool();
SchemaFactory factory = SchemaFactory.newInstance(javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI);
Source schemaSource = new StreamSource(XMLConfigurator.class
.getResourceAsStream(XMLConstants.XMLTOOLING_SCHEMA_LOCATION));
try {
configurationSchema = factory.newSchema(schemaSource);
parserPool.setIgnoreComments(true);
parserPool.setIgnoreElementContentWhitespace(true);
parserPool.setSchema(configurationSchema);
} catch (SAXException e) {
throw new ConfigurationException("Unable to read XMLTooling configuration schema", e);
}
}
示例2: Decrypter
import org.opensaml.xml.parse.BasicParserPool; //导入依赖的package包/类
/**
* Constructor.
*
* @param newResolver resolver for data encryption keys.
* @param newKEKResolver resolver for key encryption keys.
* @param newEncKeyResolver resolver for EncryptedKey elements
*/
public Decrypter(KeyInfoCredentialResolver newResolver, KeyInfoCredentialResolver newKEKResolver,
EncryptedKeyResolver newEncKeyResolver) {
resolver = newResolver;
kekResolver = newKEKResolver;
encKeyResolver = newEncKeyResolver;
resolverCriteria = null;
kekResolverCriteria = null;
// Note: this is hopefully only temporary, until Xerces implements DOM 3 LSParser.parseWithContext().
parserPool = new BasicParserPool();
parserPool.setNamespaceAware(true);
// Note: this is necessary due to an unresolved Xerces deferred DOM issue/bug
HashMap<String, Boolean> features = new HashMap<String, Boolean>();
features.put("http://apache.org/xml/features/dom/defer-node-expansion", Boolean.FALSE);
parserPool.setBuilderFeatures(features);
unmarshallerFactory = Configuration.getUnmarshallerFactory();
defaultRootInNewDocument = false;
}
示例3: SAMLClient
import org.opensaml.xml.parse.BasicParserPool; //导入依赖的package包/类
/**
* Create a new SAMLClient, using the IdPConfig for
* endpoints and validation.
*/
public SAMLClient(SPConfig spConfig, IdPConfig idpConfig)
throws SAMLException
{
this.spConfig = spConfig;
this.idpConfig = idpConfig;
BasicCredential cred = new BasicCredential();
cred.setEntityId(idpConfig.getEntityId());
cred.setPublicKey(idpConfig.getCert().getPublicKey());
sigValidator = new SignatureValidator(cred);
// create xml parsers
parsers = new BasicParserPool();
parsers.setNamespaceAware(true);
}
示例4: buildOpenSamlXmlObjectFromResource
import org.opensaml.xml.parse.BasicParserPool; //导入依赖的package包/类
/**
* Read a Ressource File.
*
* @param resourceFile
* @return the string representation of the file
* @throws IOException
* @throws SecurityException
* @throws MessageDecodingException
*/
public static XMLObject buildOpenSamlXmlObjectFromResource(final Resource resourceFile)
throws Exception {
// Parse XML file
BasicParserPool ppMgr = new BasicParserPool();
ppMgr.setNamespaceAware(true);
Document inCommonMDDoc = ppMgr.parse(resourceFile.getInputStream());
Element rootElement = inCommonMDDoc.getDocumentElement();
// Get apropriate unmarshaller
UnmarshallerFactory unmarshallerFactory = Configuration.getUnmarshallerFactory();
Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(rootElement);
// Unmarshall using the document root element, an EntitiesDescriptor in this case
XMLObject xmlObject = unmarshaller.unmarshall(rootElement);
Assert.assertNotNull("Unable to read test SAML XML file !", xmlObject);
return xmlObject;
}
示例5: getEntityDescriptor
import org.opensaml.xml.parse.BasicParserPool; //导入依赖的package包/类
/**
* @param entityId
* @param resource
* @return
* @throws MetadataProviderException
*/
private EntityDescriptor getEntityDescriptor(String entityId, ClasspathResource resource) throws MetadataProviderException {
AbstractReloadingMetadataProvider abstractReloadingMetadataProvider = new ResourceBackedMetadataProvider(new Timer(), resource);
BasicParserPool parser = new BasicParserPool();
parser.setNamespaceAware(true);
abstractReloadingMetadataProvider.setParserPool(parser);
abstractReloadingMetadataProvider.initialize();
EntityDescriptor entityDescriptor = abstractReloadingMetadataProvider.getEntityDescriptor(entityId);
return entityDescriptor;
}
示例6: BaseTestCase
import org.opensaml.xml.parse.BasicParserPool; //导入依赖的package包/类
/** Constructor. */
public BaseTestCase(){
super();
parser = new BasicParserPool();
parser.setNamespaceAware(true);
builderFactory = Configuration.getBuilderFactory();
marshallerFactory = Configuration.getMarshallerFactory();
unmarshallerFactory = Configuration.getUnmarshallerFactory();
}
示例7: parseTokenFromString
import org.opensaml.xml.parse.BasicParserPool; //导入依赖的package包/类
/**
* parseTokenFromString converts a raw wresult and extracts it into an assertion.
*
* @param wresult the raw token returned by the IdP
* @return an assertion
*/
public static Assertion parseTokenFromString(final String wresult) {
try (final InputStream in = new ByteArrayInputStream(wresult.getBytes("UTF-8"))) {
final BasicParserPool parserPool = new BasicParserPool();
parserPool.setNamespaceAware(true);
final Document document = parserPool.parse(in);
final Element metadataRoot = document.getDocumentElement();
final UnmarshallerFactory unmarshallerFactory = Configuration.getUnmarshallerFactory();
final Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(metadataRoot);
final RequestSecurityTokenResponseImpl rsToken = (RequestSecurityTokenResponseImpl) unmarshaller.unmarshall(metadataRoot);
//Get our SAML token
final List<RequestedSecurityToken> rst = rsToken.getRequestedSecurityToken();
final AssertionImpl assertion = (AssertionImpl) rst.get(0).getSecurityTokens().get(0);
if (assertion == null) {
LOGGER.debug("parseTokenFromString: assertion null");
} else {
LOGGER.debug("parseTokenFromString: {}", assertion);
}
return assertion;
} catch (final Exception ex) {
LOGGER.warn(ex.getMessage());
return null;
}
}
示例8: unmarshallArtifactResolve
import org.opensaml.xml.parse.BasicParserPool; //导入依赖的package包/类
public static ArtifactResolve unmarshallArtifactResolve(final InputStream input) throws IllegalAccessException, UnmarshallingException, XMLParserException {
BasicParserPool ppMgr = new BasicParserPool();
ppMgr.setNamespaceAware(true);
Document soap = ppMgr.parse(input);
Element soapRoot = soap.getDocumentElement();
// Get apropriate unmarshaller
UnmarshallerFactory unmarshallerFactory = Configuration.getUnmarshallerFactory();
Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(soapRoot);
Envelope soapEnvelope = (Envelope)unmarshaller.unmarshall(soapRoot);
return (ArtifactResolve)soapEnvelope.getBody().getUnknownXMLObjects().get(0);
}
示例9: BaseMessageDecoder
import org.opensaml.xml.parse.BasicParserPool; //导入依赖的package包/类
/** Constructor. */
public BaseMessageDecoder() {
parserPool = new BasicParserPool();
}