org.opensaml.saml2.metadata.provider.FilesystemMetadataProvider Java Examples

The following examples show how to use org.opensaml.saml2.metadata.provider.FilesystemMetadataProvider. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MetadataDescriptorUtil.java    From MaxKey with Apache License 2.0 6 votes vote down vote up
public EntityDescriptor getEntityDescriptor(File file)
		throws Exception {
	try {
		FilesystemMetadataProvider filesystemMetadataProvider = new FilesystemMetadataProvider(
				file);
		filesystemMetadataProvider.setRequireValidMetadata(true); // Enable
		// validation
		filesystemMetadataProvider.setParserPool(new BasicParserPool());
		filesystemMetadataProvider.initialize();
		EntityDescriptor entityDescriptor = (EntityDescriptorImpl) filesystemMetadataProvider.getMetadata();
		return entityDescriptor;
	} catch (MetadataProviderException e) {
		logger.error("元数据解析出错", e);
		throw new Exception("元数据文件解析出错", e);
	}

}
 
Example #2
Source File: SAMLManager.java    From blackduck-alert with Apache License 2.0 5 votes vote down vote up
public Optional<ExtendedMetadataDelegate> createFileProvider() throws MetadataProviderException {
    Timer backgroundTaskTimer = new Timer(true);
    if (!filePersistenceUtil.uploadFileExists(AuthenticationDescriptor.SAML_METADATA_FILE)) {
        return Optional.empty();
    }
    logger.debug("SAML - Create File Metadata provider.");
    File metadataFile = filePersistenceUtil.createUploadsFile(AuthenticationDescriptor.SAML_METADATA_FILE);
    FilesystemMetadataProvider provider = new FilesystemMetadataProvider(backgroundTaskTimer, metadataFile);
    provider.setParserPool(parserPool);
    return Optional.of(createDelegate(provider));
}